diff options
author | jaseg <git@jaseg.de> | 2021-12-30 16:40:14 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-12-30 16:40:14 +0100 |
commit | f4b2e74923cc95c683cd7f5c4732d92e4aafd3ba (patch) | |
tree | f713a247d3cc2c11463be1af54ff42b0cd9dfb44 /gerbonara/gerber/graphic_primitives.py | |
parent | e4941dd5e371e8c9e729a72b8ec30d021bceb0cc (diff) | |
download | gerbonara-f4b2e74923cc95c683cd7f5c4732d92e4aafd3ba.tar.gz gerbonara-f4b2e74923cc95c683cd7f5c4732d92e4aafd3ba.tar.bz2 gerbonara-f4b2e74923cc95c683cd7f5c4732d92e4aafd3ba.zip |
Fix rotation bugs, all tests run through
Diffstat (limited to 'gerbonara/gerber/graphic_primitives.py')
-rw-r--r-- | gerbonara/gerber/graphic_primitives.py | 11 |
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 |