summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-07-19 19:22:26 +0200
committerjaseg <git@jaseg.de>2024-07-19 19:22:26 +0200
commiteadd250ee3230753c4d3d013751324878e84345e (patch)
tree0041e91dcdb074f5ab2e17eb017d47754f4e1846
parent5f5bbccd050414afaf01dd578198d19b4d26ef87 (diff)
downloadgerbonara-eadd250ee3230753c4d3d013751324878e84345e.tar.gz
gerbonara-eadd250ee3230753c4d3d013751324878e84345e.tar.bz2
gerbonara-eadd250ee3230753c4d3d013751324878e84345e.zip
kicad: Fix footprint rotation
Previously, footprint rotation was mirrored compared with everything else in the kicad API
-rw-r--r--gerbonara/cad/kicad/footprints.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/gerbonara/cad/kicad/footprints.py b/gerbonara/cad/kicad/footprints.py
index da2c61e..1d7ee08 100644
--- a/gerbonara/cad/kicad/footprints.py
+++ b/gerbonara/cad/kicad/footprints.py
@@ -876,20 +876,20 @@ class Footprint:
around the given coordinates in the global coordinate space. Otherwise rotate around the footprint's origin. """
if (cx, cy) != (None, None):
x, y = self.at.x-cx, self.at.y-cy
- self.at.x = math.cos(angle)*x - math.sin(angle)*y + cx
- self.at.y = math.sin(angle)*x + math.cos(angle)*y + cy
+ self.at.x = math.cos(-angle)*x - math.sin(-angle)*y + cx
+ self.at.y = math.sin(-angle)*x + math.cos(-angle)*y + cy
- self.at.rotation = (self.at.rotation - math.degrees(angle)) % 360
+ self.at.rotation = (self.at.rotation + math.degrees(angle)) % 360
for pad in self.pads:
- pad.at.rotation = (pad.at.rotation - math.degrees(angle)) % 360
+ pad.at.rotation = (pad.at.rotation + math.degrees(angle)) % 360
for prop in self.properties:
if prop.at is not None:
- prop.at.rotation = (prop.at.rotation - math.degrees(angle)) % 360
+ prop.at.rotation = (prop.at.rotation + math.degrees(angle)) % 360
for text in self.texts:
- text.at.rotation = (text.at.rotation - math.degrees(angle)) % 360
+ text.at.rotation = (text.at.rotation + math.degrees(angle)) % 360
def set_rotation(self, angle):
old_deg = self.at.rotation