add s-bend example and surface config

This commit is contained in:
Jan Petykiewicz 2026-03-08 20:18:53 -07:00
commit 18b2f83a7b

View file

@ -34,7 +34,7 @@ class Straight:
ex = start_port.x + dx
ey = start_port.y + dy
if snap_to_grid:
ex = snap_search_grid(ex)
ey = snap_search_grid(ey)
@ -89,10 +89,10 @@ class Bend90:
# End port (snapped to lattice)
ex = snap_search_grid(cx + radius * np.cos(t_end))
ey = snap_search_grid(cy + radius * np.sin(t_end))
end_orientation = (start_port.orientation + turn_angle) % 360
end_port = Port(ex, ey, float(end_orientation))
actual_length = radius * np.pi / 2.0
# Generate arc geometry
@ -124,12 +124,12 @@ class SBend:
ex = snap_search_grid(start_port.x + dx * np.cos(rad_start) - dy * np.sin(rad_start))
ey = snap_search_grid(start_port.y + dx * np.sin(rad_start) + dy * np.cos(rad_start))
end_port = Port(ex, ey, start_port.orientation)
actual_length = 2 * radius * theta
# Arc centers and angles (Relative to start orientation)
direction = 1 if offset > 0 else -1
# Arc 1
c1_angle = rad_start + direction * np.pi / 2
cx1 = start_port.x + radius * np.cos(c1_angle)