Struct plane_split::Polygon [−][src]
pub struct Polygon<T, U> {
pub points: [TypedPoint3D<T, U>; 4],
pub plane: Plane<T, U>,
pub anchor: usize,
}A convex polygon with 4 points lying on a plane.
Fields
points: [TypedPoint3D<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]
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, pub fn from_points(points: [TypedPoint3D<T, U>; 4], anchor: usize) -> Self[src]
pub fn from_points(points: [TypedPoint3D<T, U>; 4], anchor: usize) -> Self: Use try_from_points instead
Construct a polygon from points that are already transformed.
pub fn try_from_points(
points: [TypedPoint3D<T, U>; 4],
anchor: usize
) -> Option<Self>[src]
pub fn try_from_points(
points: [TypedPoint3D<T, U>; 4],
anchor: usize
) -> Option<Self>Construct a polygon from points that are already transformed.
Return None if the polygon doesn't contain any space.
This method will be removed in from_points in the next breaking release.
pub fn from_rect(rect: TypedRect<T, U>, anchor: usize) -> Self[src]
pub fn from_rect(rect: TypedRect<T, U>, anchor: usize) -> SelfConstruct a polygon from a non-transformed rectangle.
pub fn from_transformed_rect<V>(
rect: TypedRect<T, V>,
transform: TypedTransform3D<T, V, U>,
anchor: usize
) -> Option<Self> where
T: Trig + Neg<Output = T>, [src]
pub fn from_transformed_rect<V>(
rect: TypedRect<T, V>,
transform: TypedTransform3D<T, V, U>,
anchor: usize
) -> Option<Self> where
T: Trig + Neg<Output = T>, Construct a polygon from a rectangle with 3D transform.
pub fn untransform_point(&self, point: TypedPoint3D<T, U>) -> Point2D<T>[src]
pub fn untransform_point(&self, point: TypedPoint3D<T, U>) -> Point2D<T>Bring a point into the local coordinate space, returning the 2D normalized coordinates.
pub fn transform<V>(
&self,
transform: &TypedTransform3D<T, U, V>
) -> Option<Polygon<T, V>> where
T: Trig,
V: Debug, [src]
pub fn transform<V>(
&self,
transform: &TypedTransform3D<T, U, V>
) -> Option<Polygon<T, V>> where
T: Trig,
V: Debug, Transform a polygon by an affine transform (preserving straight lines).
pub fn is_valid(&self) -> bool[src]
pub fn is_valid(&self) -> boolCheck 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]
pub fn is_empty(&self) -> boolCheck 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]
pub fn contains(&self, other: &Self) -> boolCheck if this polygon contains another one.
pub fn project_on(&self, vector: &TypedVector3D<T, U>) -> LineProjection<T>[src]
pub fn project_on(&self, vector: &TypedVector3D<T, U>) -> LineProjection<T>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]
pub fn intersect_plane(&self, other: &Plane<T, U>) -> Intersection<Line<T, U>>Compute the line of intersection with an infinite plane.
pub fn intersect(&self, other: &Self) -> Intersection<Line<T, U>>[src]
pub fn intersect(&self, other: &Self) -> Intersection<Line<T, U>>Compute the line of intersection with another polygon.
pub fn split(&mut self, line: &Line<T, U>) -> (Option<Self>, Option<Self>)[src]
pub fn split(&mut self, line: &Line<T, U>) -> (Option<Self>, Option<Self>)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> BspPlane 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]
impl<T, U> BspPlane 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, fn cut(&self, plane: Self) -> PlaneCut<Self>[src]
fn cut(&self, plane: Self) -> PlaneCut<Self>Try to cut a different plane by this one.
fn is_aligned(&self, other: &Self) -> bool[src]
fn is_aligned(&self, other: &Self) -> boolCheck 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]
impl<T: Debug, U: Debug> Debug for Polygon<T, U>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: PartialEq, U: PartialEq> PartialEq for Polygon<T, U>[src]
impl<T: PartialEq, U: PartialEq> PartialEq for Polygon<T, U>fn eq(&self, other: &Polygon<T, U>) -> bool[src]
fn eq(&self, other: &Polygon<T, U>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Polygon<T, U>) -> bool[src]
fn ne(&self, other: &Polygon<T, U>) -> boolThis method tests for !=.
impl<T: Clone, U> Clone for Polygon<T, U>[src]
impl<T: Clone, U> Clone for Polygon<T, U>