Draft: fix SVG rotation around non-origin center

Fixes #6869
This commit is contained in:
Chris Hennes
2022-05-16 11:10:04 -05:00
parent a8411881c9
commit cd53c06b98

View File

@@ -1591,14 +1591,15 @@ class svgHandler(xml.sax.ContentHandler):
cy = 0
angle = argsplit[0]
if len(argsplit) >= 3:
# Rotate around a non-origin centerpoint (note: SVG y axis is opposite FreeCAD y axis)
cx = argsplit[1]
cy = argsplit[2]
m.move(Vector(cx, -cy, 0))
m.move(Vector(-cx, cy, 0)) # Reposition for rotation
# Mirroring one axis is equal to changing the direction
# of rotation
m.rotateZ(math.radians(-angle))
if len(argsplit) >= 3:
m.move(Vector(-cx, cy, 0))
m.move(Vector(cx, -cy, 0)) # Reverse repositioning
elif transformation == 'skewX':
_m = FreeCAD.Matrix(1,
-math.tan(math.radians(argsplit[0])))