pub struct ConvexPolyhedron<S>where
S: BaseFloat,{ /* private fields */ }
Expand description
Convex polyhedron primitive.
Can contain any number of vertices, but a high number of vertices will affect performance of course. It is recommended for high vertex counts, to also provide the faces, this will cause the support function to use hill climbing on a half edge structure, resulting in better performance. The breakpoint is around 250 vertices, but the face version is only marginally slower on lower vertex counts (about 1-2%), while for higher vertex counts it’s about 2-5 times faster.
Implementations§
Source§impl<S> ConvexPolyhedron<S>where
S: BaseFloat,
impl<S> ConvexPolyhedron<S>where
S: BaseFloat,
Sourcepub fn new(vertices: Vec<Point3<S>>) -> Self
pub fn new(vertices: Vec<Point3<S>>) -> Self
Create a new convex polyhedron from the given vertices.
Sourcepub fn new_with_faces(
vertices: Vec<Point3<S>>,
faces: Vec<(usize, usize, usize)>,
) -> Self
pub fn new_with_faces( vertices: Vec<Point3<S>>, faces: Vec<(usize, usize, usize)>, ) -> Self
Create a new convex polyhedron from the given vertices and faces.
Sourcepub fn new_with_faces_dedup(
vertices: Vec<Point3<S>>,
faces: Vec<(usize, usize, usize)>,
) -> Self
pub fn new_with_faces_dedup( vertices: Vec<Point3<S>>, faces: Vec<(usize, usize, usize)>, ) -> Self
Create a new convex polyhedron from the given vertices and faces. Will remove any duplicate vertices.
Sourcepub fn faces_iter(&self) -> FaceIterator<'_, S>
pub fn faces_iter(&self) -> FaceIterator<'_, S>
Return an iterator that will yield tuples of the 3 vertices of each face
Trait Implementations§
Source§impl<S> Clone for ConvexPolyhedron<S>
impl<S> Clone for ConvexPolyhedron<S>
Source§fn clone(&self) -> ConvexPolyhedron<S>
fn clone(&self) -> ConvexPolyhedron<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<S> ComputeBound<Aabb3<S>> for ConvexPolyhedron<S>where
S: BaseFloat,
impl<S> ComputeBound<Aabb3<S>> for ConvexPolyhedron<S>where
S: BaseFloat,
Source§fn compute_bound(&self) -> Aabb3<S>
fn compute_bound(&self) -> Aabb3<S>
Source§impl<S> ComputeBound<Sphere<S>> for ConvexPolyhedron<S>where
S: BaseFloat,
impl<S> ComputeBound<Sphere<S>> for ConvexPolyhedron<S>where
S: BaseFloat,
Source§fn compute_bound(&self) -> Sphere<S>
fn compute_bound(&self) -> Sphere<S>
Source§impl<S> Continuous<Ray<S, Point3<S>, Vector3<S>>> for ConvexPolyhedron<S>where
S: BaseFloat,
impl<S> Continuous<Ray<S, Point3<S>, Vector3<S>>> for ConvexPolyhedron<S>where
S: BaseFloat,
Source§impl<S> Debug for ConvexPolyhedron<S>
impl<S> Debug for ConvexPolyhedron<S>
Source§impl<S> Discrete<Ray<S, Point3<S>, Vector3<S>>> for ConvexPolyhedron<S>where
S: BaseFloat,
TODO: better algorithm for finding faces to intersect with?
impl<S> Discrete<Ray<S, Point3<S>, Vector3<S>>> for ConvexPolyhedron<S>where
S: BaseFloat,
TODO: better algorithm for finding faces to intersect with?
Source§fn intersects(&self, ray: &Ray3<S>) -> bool
fn intersects(&self, ray: &Ray3<S>) -> bool
Ray must be in object space