Gilbert–Johnson–Keerthi Algorithm¤
compas_model.geometry.gjk2
¤
Functions:¤
is_collision_poly_poly_xy
¤
Determine whether two convex polygons collide in the XY plane using the GJK algorithm.
Parameters:
Returns:
-
bool–True if the polygons collide. False otherwise.
Raises:
-
RuntimeError–If the GJK algorithm doesn't converge after 100 iterations.
Warnings
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.
Check if the polygons collide.
support_poly
¤
support_poly_poly
¤
support_poly_poly(
A: Polygon | Sequence[Point | Vector],
B: Polygon | Sequence[Point | Vector],
direction: Vector,
) -> Vector
Compute a support point on the Minkowski sum of A and -B in the given direction.
Parameters:
-
A(Polygon | Sequence[Point | Vector]) –Shape A represented by a list of point vectors.
-
B(Polygon | Sequence[Point | Vector]) –Shape B represented by a list of point vectors.
-
direction(Vector) –The support direction.
Returns:
-
Vector–The support point.