fix custom poly transform
This commit is contained in:
parent
bc4184693d
commit
7455917b4a
3 changed files with 4 additions and 2 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 89 KiB |
|
|
@ -34,7 +34,8 @@ def main() -> None:
|
||||||
|
|
||||||
# 4. Define a custom 'trapezoid' bend model
|
# 4. Define a custom 'trapezoid' bend model
|
||||||
# (Just for demonstration - we override the collision model during search)
|
# (Just for demonstration - we override the collision model during search)
|
||||||
custom_poly = Polygon([(0, 0), (20, 0), (20, 20), (0, 20)]) # Oversized box
|
# Define a custom centered 20x20 box
|
||||||
|
custom_poly = Polygon([(-10, -10), (10, -10), (10, 10), (-10, 10)])
|
||||||
|
|
||||||
print("Routing with custom collision model...")
|
print("Routing with custom collision model...")
|
||||||
# Override bend_collision_type with a literal Polygon
|
# Override bend_collision_type with a literal Polygon
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,8 @@ def _apply_collision_model(
|
||||||
Applies the specified collision model to an arc geometry.
|
Applies the specified collision model to an arc geometry.
|
||||||
"""
|
"""
|
||||||
if isinstance(collision_type, Polygon):
|
if isinstance(collision_type, Polygon):
|
||||||
return [collision_type]
|
# Translate the custom polygon to the bend center (cx, cy)
|
||||||
|
return [shapely.transform(collision_type, lambda x: x + [cx, cy])]
|
||||||
|
|
||||||
if collision_type == "arc":
|
if collision_type == "arc":
|
||||||
return [arc_poly]
|
return [arc_poly]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue