is_collision_poly_poly_xy
- compas_model.geometry.is_collision_poly_poly_xy(A, B)
Determine whether two convex polygons collide in the XY plane using the GJK algorithm.
- Parameters:
- A
compas.geometry.Polygon
The first polygon.
- B
compas.geometry.Polygon
The second polygon.
- A
- Returns:
- bool
True if the polygons collide. False otherwise.
- Raises:
- RuntimeError
If the GJK algorithm doesn’t converge after 100 iterations.
Warning
Only works for convex polygons in the XY plane.
Examples
>>> from compas.geometry import Polygon >>> from compas_model.geometry import is_collision_poly_poly_xy
Construct two polygons in the XY plane.
>>> A = Polygon.from_rectangle([0, 0, 0], 2, 1) >>> B = Polygon.from_rectangle([1.5, 0.5, 0], 1, 1)
Check if the polygons collide.
>>> is_collision_poly_poly_xy(A, B) True