diff --git a/examples/08_custom_bend_geometry.png b/examples/08_custom_bend_geometry.png index ecb3f89..5276991 100644 Binary files a/examples/08_custom_bend_geometry.png and b/examples/08_custom_bend_geometry.png differ diff --git a/examples/08_custom_bend_geometry.py b/examples/08_custom_bend_geometry.py index 5ff6a88..837d37e 100644 --- a/examples/08_custom_bend_geometry.py +++ b/examples/08_custom_bend_geometry.py @@ -34,7 +34,8 @@ def main() -> None: # 4. Define a custom 'trapezoid' bend model # (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...") # Override bend_collision_type with a literal Polygon diff --git a/inire/geometry/components.py b/inire/geometry/components.py index 0d61862..aa1ce38 100644 --- a/inire/geometry/components.py +++ b/inire/geometry/components.py @@ -434,7 +434,8 @@ def _apply_collision_model( Applies the specified collision model to an arc geometry. """ 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": return [arc_poly]