bbi.geometry¶
Construct 3D points, areas, and volumes using the following geometry primitives.
These geometry primitives also implement methods for sampling points, which can be used by placement strategies to sample points for object placement.
- class Geometry(node_id: str, transform: Transform)¶
Bases:
NodeBase Geometry class. Geometries must be named uniquely for identification within the scene hierarchy.
They implement a bounds method for calculating the 3D bounding volume of the geometry, useful for collision detection and spatial queries.
- class Point(node_id: str, position: Vector3, rotation: Vector3 = Vector3.zero())¶
Bases:
GeometryA 3D point in space.
- Parameters:
- class Spline(node_id: str, points: list[Vector3], tangents: list[Vector3] | None = None, rotations: list[Vector3] | None = None)¶
Bases:
GeometryA curved spline constructed using a list of Vector3 positions, and optionally a list of Vector3 tangents.
Spline will pass through all points provided. A minimum of one point must be provided to construct a spline. If tangents are not provided, they are automatically calculated using the points.
- Parameters:
node_id (str) – The node ID of the spline.
points (list[Vector3]) – The list of input positions in Vector3.
tangents (list[Vector3], optional) – The list of tangents at each point. Defaults to None.
rotations (list[Vector3], optional) – The list of rotations at each point. Defaults to None. If rotations are not provided, they are automatically calculated using
points.
- property length: float¶
The length of the spline in meters.
- get_position(t: float) Vector3¶
Given a particular progress value, get the position along the spline.
- Parameters:
t (float) – The time parameter in the range [0, 1].
- get_rotation(t: float) Vector3¶
Given a particular progress value, get a rotation vector based on the given rotations at the keypoints. If no rotations are provided, the direction along the spline is given.
- Parameters:
t (float) – The time parameter in the range [0, 1].
- get_direction_along_spline(t: float) Vector3¶
Given a particular progress value, get the direction (or tangent) along the spline.
- Parameters:
t (float) – The time parameter in the range [0, 1].
- Returns:
Rotation vector (roll, pitch, yaw) at the given point.
- Return type:
- set_width(width: float) None¶
Assign a width to the spline. The width would act as an obstacle, so that collision checks would factor in
widthdistance from the spline. The spline must be added to the scene before calling this function.- Parameters:
width (float) – The width of the spline.
- class Cuboid(node_id: str, centroid: Vector3, size: Vector3, rotation: Vector3 = Vector3.zero())¶
Bases:
GeometryA 3D cuboid defined by centroid, size and rotation.
- Parameters:
- class Polygon(node_id: str, points: list[Vector3], holes: list[list[Vector3]] | None = None)¶
Bases:
GeometryA 3D polygon defined by a list of Vector3 points.
- Parameters:
- property is_simple: bool¶
- property area: float¶
- intersection(other: Polygon) list[Polygon] | None¶
Returns the intersection of this polygon with another polygon.
- Parameters:
other (Polygon) – The polygon to intersect with.
- intersection_many(others: list[Polygon]) list[Polygon] | None¶
Returns the intersection of this polygon with a list of other polygons.
- Parameters:
others (list[Polygon]) – The list of polygons to intersect with this polygon.