Struct plane_split::Polygon [] [src]

pub struct Polygon<T, U> {
    pub points: [TypedPoint3D<T, U>; 4],
    pub normal: TypedPoint3D<T, U>,
    pub offset: T,
    pub anchor: usize,
}

A convex flat polygon with 4 points, defined by equation: dot(v, normal) + offset = 0

Fields

Points making the polygon.

Normalized vector perpendicular to the polygon plane.

Constant offset from the normal plane, specified in the direction opposite to the normal.

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]

Construct a polygon from a transformed rectangle.

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

Return the signed distance from this polygon to a point. The distance is negative if the point is on the other side of the polygon from the direction of the normal.

Compute the distance across the line to the polygon plane, starting from the line origin.

Compute the sum of signed distances to each of the points of another polygon. Useful to know the relation of a polygon that is a product of a split, and we know it doesn't intersect self.

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

Check if a convex shape defined by a set of points is completely outside of this polygon. Merely touching the surface is not considered an intersection.

Check if this polygon contains another one.

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.

Compute the line of intersection with another polygon.

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

Trait Implementations

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 + One + Float,
    U: Debug
[src]

Try to cut a different plane by this one.

Check if a different plane is aligned in the same direction as this one. Read more

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

Formats the value using the given formatter.

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more