pub struct ConvexShape { /* private fields */ }Expand description
A convex shape as its vertices and face normals.
Storing normals alongside points is what keeps SAT honest: the candidate axes for two polyhedra are their face normals plus the cross products of their edge pairs. Deriving normals from a point cloud every call would repeat work the caller usually already has.
A shape with no normals still works – a point cloud’s hull is implied by the edge-pair axes – but supplying them makes the test exact for polyhedra rather than conservative.
Implementations§
Source§impl ConvexShape
impl ConvexShape
Sourcepub fn from_points(points: &[Point3]) -> Self
pub fn from_points(points: &[Point3]) -> Self
A shape from its vertices alone.
Face normals are not inferred: computing a hull here would make a
cheap constructor expensive and would silently discard the caller’s
own topology. Use ConvexShape::with_faces when face normals are
available.
Sourcepub fn with_faces(points: &[Point3], normals: &[Vec3]) -> Self
pub fn with_faces(points: &[Point3], normals: &[Vec3]) -> Self
A shape with known face normals and edge directions.
Trait Implementations§
Source§impl Clone for ConvexShape
impl Clone for ConvexShape
Source§fn clone(&self) -> ConvexShape
fn clone(&self) -> ConvexShape
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more