summaryrefslogtreecommitdiff
path: root/gerberex/utility.py
diff options
context:
space:
mode:
authoropiopan <opiopan@gmail.com>2019-04-03 00:30:00 +0900
committeropiopan <opiopan@gmail.com>2019-04-03 00:30:00 +0900
commitcb420e39e278f7ab6f002600a7698d7be101eb7d (patch)
tree1d82fcd72627c71715ec0b9724c8f976a49bdfdd /gerberex/utility.py
parentb72d891998cc87273b9dd8bfe4d864cbe6a8cc62 (diff)
downloadgerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.tar.gz
gerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.tar.bz2
gerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.zip
fix a rotaion issue
Diffstat (limited to 'gerberex/utility.py')
-rw-r--r--gerberex/utility.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gerberex/utility.py b/gerberex/utility.py
index 852519a..f90df96 100644
--- a/gerberex/utility.py
+++ b/gerberex/utility.py
@@ -11,3 +11,11 @@ def rotate(x, y, angle, center):
angle = angle * pi / 180.0
return (cos(angle) * x0 - sin(angle) * y0 + center[0],
sin(angle) * x0 + cos(angle) * y0 + center[1])
+
+def is_equal_value(a, b, error_range=0):
+ return a - b <= error_range and a - b >= -error_range
+
+
+def is_equal_point(a, b, error_range=0):
+ return is_equal_value(a[0], b[0], error_range) and \
+ is_equal_value(a[1], b[1], error_range)