[][src]Struct plane_split::Polygon

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

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: usize

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

Methods

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

pub fn from_points(points: [Point3D<T, U>; 4], anchor: usize) -> 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: usize) -> 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: usize
) -> 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: usize
) -> 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>> 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: PartialEq, U: PartialEq> PartialEq<Polygon<T, U>> for Polygon<T, U>[src]

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

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

impl<T, U> Plane for Polygon<T, U> 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
[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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.

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

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

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