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:
Node
Base 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:
Geometry
A 3D point in space.
- Parameters:
- class Spline(node_id: str, points: list[Vector3], tangents: list[Vector3] | None = None)¶
Bases:
Geometry
A 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:
- 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, look_ahead_value: float = 0.01) Vector3 ¶
Given a particular progress value, get a rotation vector useful for aligning assets along the spline.
- Parameters:
t (float) – The time parameter in the range [0, 1].
look_ahead_value (float, optional) – The amount to look ahead to calculate the rotation. Defaults to 0.01.
- 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
width
distance 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, origin: Vector3, size: Vector3, rotation: Vector3)¶
Bases:
Geometry
A 3D cuboid defined by an origin and size.
- Parameters:
- uniform_random_points(n: int) list[Vector3] ¶
Return n uniformly random points within the cuboid.
- Parameters:
n (int) – The number of points to sample.
- property min_x: float¶
- property min_y: float¶
- property min_z: float¶
- property max_x: float¶
- property max_y: float¶
- property max_z: float¶
- class Polygon(node_id: str, points: list[Vector3])¶
Bases:
Geometry
A 3D polygon defined by a list of Vector3 points.
- Parameters:
node_id (str) – The node ID of the polygon.
points (list[Vector3]) – The list of points that define the polygon.
- property is_simple: bool¶
- property area: float¶