Expand description
BSP (Binary Space Partitioning) tree implementation.
This crate provides a BSP tree for 3D polygon management, enabling efficient spatial partitioning, ordered traversal, and polygon cutting operations.
§Core Types
Polygon,Triangle,Rectangle: Geometric primitivesPlane3D: 3D plane representation with classification operationsCuttable: Trait for splitting geometry by planesBspTree: The BSP tree containerBspNode: Tree nodes holding splitting planes and coplanar polygons
§Example
use bsp_tree::{BspTree, Polygon};
use nalgebra::Point3;
// Create some polygons
let poly1 = Polygon::new(vec![
Point3::new(0.0, 0.0, 0.0),
Point3::new(1.0, 0.0, 0.0),
Point3::new(0.0, 1.0, 0.0),
]);
// Build the tree
let tree = BspTree::from_polygons(vec![poly1]);
assert_eq!(tree.polygon_count(), 1);Re-exports§
pub use bsp::BspNode;pub use bsp::BspTree;pub use bsp::BspVisitor;pub use bsp::FirstPolygon;pub use bsp::PlaneSelector;
Modules§
- bsp
- Binary Space Partitioning tree for 3D polygon management.
Structs§
- Plane3D
- A plane in 3D space, represented as
normal · point = offset. - Polygon
- A convex polygon in 3D space, defined by an ordered list of vertices.
- Rectangle
- A rectangle (quad) in 3D space, defined by a corner and two edge vectors.
- Triangle
- A triangle in 3D space, defined by three vertices.
Enums§
- Classification
- Classification of geometry (polygon, triangle, rectangle) relative to a plane.
- Plane
Side - Which side of a plane a point lies on.
Constants§
- PLANE_
EPSILON - Default epsilon for plane classification. Points within this distance of the plane are considered “on” the plane.
Traits§
- Cuttable
- Trait for geometry that can be cut by a plane.