pub trait Geometry:
Clone
+ Send
+ Sync {
type Scalar: RealField + Copy;
// Required methods
fn id(&self) -> &GeometryId;
fn quantity(&self) -> usize;
fn measure(&self) -> Self::Scalar;
fn aabb_vec(&self) -> (Vec<Self::Scalar>, Vec<Self::Scalar>);
fn centroid(&self) -> Vec<Self::Scalar>;
fn validate(&self) -> Result<()>;
fn rotation_constraint(&self) -> &RotationConstraint<Self::Scalar>;
// Provided methods
fn aabb(&self) -> ([Self::Scalar; 2], [Self::Scalar; 2]) { ... }
fn allow_mirror(&self) -> bool { ... }
fn priority(&self) -> i32 { ... }
}Expand description
Trait for geometric shapes that can be nested or packed.
Required Associated Types§
Required Methods§
Sourcefn id(&self) -> &GeometryId
fn id(&self) -> &GeometryId
Returns the unique identifier for this geometry.
Sourcefn aabb_vec(&self) -> (Vec<Self::Scalar>, Vec<Self::Scalar>)
fn aabb_vec(&self) -> (Vec<Self::Scalar>, Vec<Self::Scalar>)
Returns the axis-aligned bounding box as Vec (for generic dimension support).
Sourcefn centroid(&self) -> Vec<Self::Scalar>
fn centroid(&self) -> Vec<Self::Scalar>
Returns the centroid (center of mass) of this geometry.
Sourcefn rotation_constraint(&self) -> &RotationConstraint<Self::Scalar>
fn rotation_constraint(&self) -> &RotationConstraint<Self::Scalar>
Returns the allowed rotations for this geometry.
Provided Methods§
Sourcefn aabb(&self) -> ([Self::Scalar; 2], [Self::Scalar; 2])
fn aabb(&self) -> ([Self::Scalar; 2], [Self::Scalar; 2])
Returns the axis-aligned bounding box as (min, max) corners.
Sourcefn allow_mirror(&self) -> bool
fn allow_mirror(&self) -> bool
Returns whether mirroring/flipping is allowed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.