Struct plane_split::Clipper
source · pub struct Clipper<T, U> { /* private fields */ }Expand description
A helper object to clip polygons by a number of planes.
Implementations§
source§impl<T: Copy + Debug + ApproxEq<T> + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Div<T, Output = T> + Zero + One + Float, U: Debug> Clipper<T, U>
impl<T: Copy + Debug + ApproxEq<T> + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Div<T, Output = T> + Zero + One + Float, U: Debug> Clipper<T, U>
sourcepub fn frustum_planes<V>(
t: &TypedTransform3D<T, U, V>,
bounds: Option<TypedRect<T, V>>
) -> Result<impl Iterator<Item = Plane<T, U>>, NegativeHemisphereError>
pub fn frustum_planes<V>(
t: &TypedTransform3D<T, U, V>,
bounds: Option<TypedRect<T, V>>
) -> Result<impl Iterator<Item = Plane<T, U>>, NegativeHemisphereError>
Extract the clipping planes that define the frustum for a given transformation.
sourcepub fn add(&mut self, plane: Plane<T, U>)
pub fn add(&mut self, plane: Plane<T, U>)
Add a clipping plane to the list. The plane will clip everything behind it, where the direction is set by the plane normal.
sourcepub fn clip(&mut self, polygon: Polygon<T, U>) -> &[Polygon<T, U>]
pub fn clip(&mut self, polygon: Polygon<T, U>) -> &[Polygon<T, U>]
Clip specified polygon by the contained planes, return the fragmented polygons.
sourcepub fn clip_transformed<'a, V>(
&'a mut self,
polygon: Polygon<T, U>,
transform: &'a TypedTransform3D<T, U, V>,
bounds: Option<TypedRect<T, V>>
) -> Result<impl 'a + Iterator<Item = Polygon<T, V>>, NegativeHemisphereError>where
T: Trig,
V: 'a + Debug,
pub fn clip_transformed<'a, V>(
&'a mut self,
polygon: Polygon<T, U>,
transform: &'a TypedTransform3D<T, U, V>,
bounds: Option<TypedRect<T, V>>
) -> Result<impl 'a + Iterator<Item = Polygon<T, V>>, NegativeHemisphereError>where
T: Trig,
V: 'a + Debug,
Clip the primitive with the frustum of the specified transformation, returning a sequence of polygons in the transformed space. Returns None if the transformation can’t be frustum clipped.