Struct ncollide2d::shape::Triangle
source · pub struct Triangle<N: Real> { /* private fields */ }
Expand description
A triangle shape.
Implementations§
source§impl<N: Real> Triangle<N>
impl<N: Real> Triangle<N>
sourcepub fn new(a: Point<N>, b: Point<N>, c: Point<N>) -> Triangle<N>
pub fn new(a: Point<N>, b: Point<N>, c: Point<N>) -> Triangle<N>
Creates a triangle from three points.
sourcepub fn from_array(arr: &[Point<N>; 3]) -> &Triangle<N>
pub fn from_array(arr: &[Point<N>; 3]) -> &Triangle<N>
Creates the reference to a triangle from the reference to an array of three points.
sourcepub fn as_array(&self) -> &[Point<N>; 3]
pub fn as_array(&self) -> &[Point<N>; 3]
Reference to an array containing the three vertices of this triangle.
sourcepub fn normal(&self) -> Option<Unit<Vector<N>>>
pub fn normal(&self) -> Option<Unit<Vector<N>>>
The normal of this triangle assuming it is oriented ccw.
The normal points such that it is collinear to AB × AC
(where ×
denotes the cross
product).
sourcepub fn scaled_normal(&self) -> Vector<N>
pub fn scaled_normal(&self) -> Vector<N>
A vector normal of this triangle.
The vector points such that it is collinear to AB × AC
(where ×
denotes the cross
product).
Trait Implementations§
source§impl<N: PartialEq + Real> PartialEq<Triangle<N>> for Triangle<N>
impl<N: PartialEq + Real> PartialEq<Triangle<N>> for Triangle<N>
source§impl<N: Real> PointQuery<N> for Triangle<N>
impl<N: Real> PointQuery<N> for Triangle<N>
source§fn project_point(
&self,
m: &Isometry<N>,
pt: &Point<N>,
solid: bool
) -> PointProjection<N>
fn project_point(
&self,
m: &Isometry<N>,
pt: &Point<N>,
solid: bool
) -> PointProjection<N>
Projects a point on
self
transformed by m
.source§fn project_point_with_feature(
&self,
m: &Isometry<N>,
pt: &Point<N>
) -> (PointProjection<N>, FeatureId)
fn project_point_with_feature(
&self,
m: &Isometry<N>,
pt: &Point<N>
) -> (PointProjection<N>, FeatureId)
Projects a point on the boundary of
self
transformed by m
and retuns the id of the
feature the point was projected on. Read moresource§impl<N: Real> PointQueryWithLocation<N> for Triangle<N>
impl<N: Real> PointQueryWithLocation<N> for Triangle<N>
§type Location = TrianglePointLocation<N>
type Location = TrianglePointLocation<N>
Additional shape-specific projection information Read more
source§fn project_point_with_location(
&self,
m: &Isometry<N>,
pt: &Point<N>,
solid: bool
) -> (PointProjection<N>, Self::Location)
fn project_point_with_location(
&self,
m: &Isometry<N>,
pt: &Point<N>,
solid: bool
) -> (PointProjection<N>, Self::Location)
Projects a point on
self
transformed by m
.source§impl<N: Real> SupportMap<N> for Triangle<N>
impl<N: Real> SupportMap<N> for Triangle<N>
source§impl<N: Real> ToPolyline<N> for Triangle<N>
impl<N: Real> ToPolyline<N> for Triangle<N>
type DiscretizationParameter = ()
impl<N: Real> StructuralPartialEq for Triangle<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Triangle<N>where
N: RefUnwindSafe,
impl<N> Send for Triangle<N>
impl<N> Sync for Triangle<N>
impl<N> Unpin for Triangle<N>where
N: Unpin,
impl<N> UnwindSafe for Triangle<N>where
N: UnwindSafe,
Blanket Implementations§
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.