Struct plane_split::Polygon

source ·
pub struct Polygon<A> {
    pub points: [Point3D<f64>; 4],
    pub plane: Plane,
    pub anchor: A,
}
Expand description

A convex polygon with 4 points lying on a plane.

Fields

points: [Point3D<f64>; 4]

Points making the polygon.

plane: Plane

A plane describing polygon orientation.

anchor: A

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

Implementations

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

Construct a polygon from a non-transformed rectangle.

Construct a polygon from a rectangle with 3D transform.

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

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

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

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 the polygon doesn’t contain any space. This may happen after a sequence of splits, and such polygons should be discarded.

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 an infinite plane.

Compute the line of intersection with another polygon.

👎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.

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.

Cut a polygon with another one.

Write the resulting polygons in front and back if the polygon needs to be split.

Returns whether both polygon’s planes are parallel.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.