Fix arc gerber export bug
This commit is contained in:
parent
87413855bf
commit
2647709215
2 changed files with 4 additions and 2 deletions
|
|
@ -307,6 +307,7 @@ class Region(GraphicObject):
|
|||
|
||||
def _offset(self, dx, dy):
|
||||
self.outline = [ (x+dx, y+dy) for x, y in self.outline ]
|
||||
self.arc_centers = [ (c[0], (c[1][0]+dx, c[1][1]+dy)) if c else None for c in self.arc_centers ]
|
||||
|
||||
def _rotate(self, angle, cx=0, cy=0):
|
||||
self.outline = [ gp.rotate_point(x, y, angle, cx, cy) for x, y in self.outline ]
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ def test_region_rectangle(w, h, tmpfile, img_support):
|
|||
def test_region_arc_segments(start_angle_deg, sweep_angle_deg, tmpfile, img_support):
|
||||
"""Test Region objects with arc segments."""
|
||||
with object_test(tmpfile, img_support, epsilon=1e-2) as gbr:
|
||||
print(f'{start_angle_deg=} {sweep_angle_deg=}')
|
||||
start_angle = math.radians(start_angle_deg)
|
||||
sweep_angle = math.radians(sweep_angle_deg)
|
||||
r = 15
|
||||
|
|
@ -185,11 +186,11 @@ def test_region_arc_segments(start_angle_deg, sweep_angle_deg, tmpfile, img_supp
|
|||
region = Region(unit=MM)
|
||||
|
||||
region.outline.append((0, 0))
|
||||
region.outline.append((r * math.cos(start_angle), r * math.sin(start_angle)))
|
||||
region.outline.append((r * math.cos(start_angle + sweep_angle), r * math.sin(start_angle + sweep_angle)))
|
||||
region.outline.append((r * math.cos(start_angle), r * math.sin(start_angle)))
|
||||
region.outline.append((0, 0))
|
||||
region.arc_centers.append(None)
|
||||
region.arc_centers.append(None)
|
||||
region.arc_centers.append((True, (0, 0)))
|
||||
region.arc_centers.append(None)
|
||||
|
||||
gbr.objects.append(region)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue