spatialgeometry.CollisionShape
- class CollisionShape(collision: bool = True, **kwargs)[source]
Bases:
ShapeBase class for a
Shapethat also has associated collision geometry, so instances can be used for collision checking (via coal) as well as being rendered in the scene.- Parameters:
pose – Local reference frame of the shape, defaults to the identity transform.
color – Color as (r, g, b) or (r, g, b, a) in [0-1] (or [0-255], auto-normalised), or a matplotlib color name. Defaults to a mid-grey
(0.3, 0.3, 0.3, 1.0).stype – Shape type identifier used by the renderer/wire protocol (e.g.
"cuboid","mesh") – set by each concrete subclass, not normally passed directly by a caller.base – Deprecated alias for
pose.
- closest_point(shape: CollisionShape, inf_dist: float = 1.0) tuple[float | None, ndarray | None, ndarray | None][source]
Return the minimum euclidean distance between self and shape.
- Parameters:
shape – The shape (or
CollisionShapeGroup) to compare distance toinf_dist – Only return a result when distance < inf_dist
- Returns:
(d, p1, p2) — distance and closest points in world frame, or (None, None, None) when the shapes are farther than inf_dist. d is negative when the shapes are penetrating.
- collided(shape: CollisionShape) bool[source]
Deprecated — use iscollided instead.
- iscollided(shape: CollisionShape) bool[source]
Return True if self and shape have collided (distance ≤ 0).
- Parameters:
shape – The shape (or
CollisionShapeGroup) to check against