[][src]Struct plane_split::Polygon

pub struct Polygon<T, U, A> {
    pub points: [Point3D<T, U>; 4],
    pub plane: Plane<T, U>,
    pub anchor: A,
}

A convex polygon with 4 points lying on a plane.

Fields

points: [Point3D<T, U>; 4]

Points making the polygon.

plane: Plane<T, U>

A plane describing polygon orientation.

anchor: A

A simple anchoring index to allow association of the produced split polygons with the original one.

Implementations

impl<T, U, A> Polygon<T, U, A> where
    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,
    A: Copy
[src]

pub fn from_points(points: [Point3D<T, U>; 4], anchor: A) -> Option<Self>[src]

Construct a polygon from points that are already transformed. Return None if the polygon doesn't contain any space.

pub fn from_rect(rect: Rect<T, U>, anchor: A) -> Self[src]

Construct a polygon from a non-transformed rectangle.

pub fn from_transformed_rect<V>(
    rect: Rect<T, V>,
    transform: Transform3D<T, V, U>,
    anchor: A
) -> Option<Self> where
    T: Trig + Neg<Output = T>, 
[src]

Construct a polygon from a rectangle with 3D transform.

pub fn from_transformed_rect_with_inverse<V>(
    rect: Rect<T, V>,
    transform: &Transform3D<T, V, U>,
    inv_transform: &Transform3D<T, U, V>,
    anchor: A
) -> Option<Self> where
    T: Trig + Neg<Output = T>, 
[src]

Construct a polygon from a rectangle with an invertible 3D transform.

pub fn untransform_point(&self, point: Point3D<T, U>) -> Point2D<T>[src]

Bring a point into the local coordinate space, returning the 2D normalized coordinates.

pub fn transform<V>(
    &self,
    transform: &Transform3D<T, U, V>
) -> Option<Polygon<T, V, A>> where
    T: Trig,
    V: Debug
[src]

Transform a polygon by an affine transform (preserving straight lines).

pub fn is_valid(&self) -> bool[src]

Check if all the points are indeed placed on the plane defined by the normal and offset, and the winding order is consistent.

pub fn is_empty(&self) -> bool[src]

Check if the polygon doesn't contain any space. This may happen after a sequence of splits, and such polygons should be discarded.

pub fn contains(&self, other: &Self) -> bool[src]

Check if this polygon contains another one.

pub fn project_on(&self, vector: &Vector3D<T, U>) -> LineProjection<T>[src]

Project this polygon onto a 3D vector, returning a line projection. Note: we can think of it as a projection to a ray placed at the origin.

pub fn intersect_plane(&self, other: &Plane<T, U>) -> Intersection<Line<T, U>>[src]

Compute the line of intersection with an infinite plane.

pub fn intersect(&self, other: &Self) -> Intersection<Line<T, U>>[src]

Compute the line of intersection with another polygon.

pub fn split(&mut self, line: &Line<T, U>) -> (Option<Self>, Option<Self>)[src]

👎 Deprecated:

Use split_with_normal instead

Split the polygon along the specified Line. Will do nothing if the line doesn't belong to the polygon plane.

pub fn split_with_normal(
    &mut self,
    line: &Line<T, U>,
    normal: &Vector3D<T, U>
) -> (Option<Self>, Option<Self>)
[src]

Split the polygon along the specified Line, with a normal to the split line provided. This is useful when called by the plane splitter, since the other plane's normal forms the side direction here, and figuring out the actual line of split isn't needed. Will do nothing if the line doesn't belong to the polygon plane.

Trait Implementations

impl<T: Clone, U, A: Copy> Clone for Polygon<T, U, A>[src]

impl<T: Debug, U: Debug, A: Debug> Debug for Polygon<T, U, A>[src]

impl<T: PartialEq, U: PartialEq, A: PartialEq> PartialEq<Polygon<T, U, A>> for Polygon<T, U, A>[src]

impl<T, U, A> Plane for Polygon<T, U, A> where
    T: Copy + Debug + ApproxEq<T> + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Div<T, Output = T> + Zero + Float,
    U: Debug,
    A: Copy + Debug
[src]

impl<T, U, A> StructuralPartialEq for Polygon<T, U, A>[src]

Auto Trait Implementations

impl<T, U, A> RefUnwindSafe for Polygon<T, U, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T, U, A> Send for Polygon<T, U, A> where
    A: Send,
    T: Send,
    U: Send

impl<T, U, A> Sync for Polygon<T, U, A> where
    A: Sync,
    T: Sync,
    U: Sync

impl<T, U, A> Unpin for Polygon<T, U, A> where
    A: Unpin,
    T: Unpin,
    U: Unpin

impl<T, U, A> UnwindSafe for Polygon<T, U, A> where
    A: UnwindSafe,
    T: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.