summaryrefslogtreecommitdiff
path: root/gerber/utils.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-02-27 18:18:04 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-02-27 18:18:04 +0800
commit223a010831f0d9dae4bd6d2e626a603a78eb0b1d (patch)
treef8e341156d652990b79f182df65c321549222e74 /gerber/utils.py
parent29c0d82bf53907030d11df9eb09471b716a0be2e (diff)
downloadgerbonara-223a010831f0d9dae4bd6d2e626a603a78eb0b1d.tar.gz
gerbonara-223a010831f0d9dae4bd6d2e626a603a78eb0b1d.tar.bz2
gerbonara-223a010831f0d9dae4bd6d2e626a603a78eb0b1d.zip
Fix critical issue with rotatin points (when the angle is zero the y would be flipped). Render AM with outline to gerber
Diffstat (limited to 'gerber/utils.py')
-rw-r--r--gerber/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gerber/utils.py b/gerber/utils.py
index 16323d6..72bf2d1 100644
--- a/gerber/utils.py
+++ b/gerber/utils.py
@@ -284,10 +284,13 @@ def rotate_point(point, angle, center=(0.0, 0.0)):
`point` rotated about `center` by `angle` degrees.
"""
angle = radians(angle)
- xdelta, ydelta = tuple(map(sub, point, center))
- x = center[0] + (cos(angle) * xdelta) - (sin(angle) * ydelta)
- y = center[1] + (sin(angle) * xdelta) - (cos(angle) * ydelta)
- return (x, y)
+
+ cos_angle = cos(angle)
+ sin_angle = sin(angle)
+
+ return (
+ cos_angle * (point[0] - center[0]) - sin_angle * (point[1] - center[1]) + center[0],
+ sin_angle * (point[0] - center[0]) + cos_angle * (point[1] - center[1]) + center[1])
def nearly_equal(point1, point2, ndigits = 6):