summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/graphic_primitives.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerbonara/gerber/graphic_primitives.py')
-rw-r--r--gerbonara/gerber/graphic_primitives.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/gerbonara/gerber/graphic_primitives.py b/gerbonara/gerber/graphic_primitives.py
index c917365..de1a0bc 100644
--- a/gerbonara/gerber/graphic_primitives.py
+++ b/gerbonara/gerber/graphic_primitives.py
@@ -12,12 +12,11 @@ class GraphicPrimitive:
polarity_dark : bool = True
-def rotate_point(x, y, angle, cx=None, cy=None):
- if cx is None:
- return (x, y)
- else:
- return (cx + (x - cx) * math.cos(angle) - (y - cy) * math.sin(angle),
- cy + (x - cx) * math.sin(angle) + (y - cy) * math.cos(angle))
+def rotate_point(x, y, angle, cx=0, cy=0):
+ """ rotate point (x,y) around (cx,cy) clockwise angle radians """
+
+ return (cx + (x - cx) * math.cos(-angle) - (y - cy) * math.sin(-angle),
+ cy + (x - cx) * math.sin(-angle) + (y - cy) * math.cos(-angle))
@dataclass