#[repr(C)]pub struct Triangle<N: RealField + Copy> {
pub a: Point<N>,
pub b: Point<N>,
pub c: Point<N>,
}Expand description
A triangle shape.
Fields§
§a: Point<N>The triangle first point.
b: Point<N>The triangle second point.
c: Point<N>The triangle third point.
Implementations§
Source§impl<N: RealField + Copy> Triangle<N>
impl<N: RealField + Copy> 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 a(&self) -> &Point<N>
👎Deprecated: use the self.a public field directly.
pub fn a(&self) -> &Point<N>
self.a public field directly.The fist point of this triangle.
Sourcepub fn b(&self) -> &Point<N>
👎Deprecated: use the self.b public field directly.
pub fn b(&self) -> &Point<N>
self.b public field directly.The second point of this triangle.
Sourcepub fn c(&self) -> &Point<N>
👎Deprecated: use the self.c public field directly.
pub fn c(&self) -> &Point<N>
self.c public field directly.The third point of this triangle.
Sourcepub fn vertices(&self) -> &[Point<N>; 3]
pub fn vertices(&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 transformed(&self, m: &Isometry<N>) -> Self
pub fn transformed(&self, m: &Isometry<N>) -> Self
Returns a new triangle with vertices transformed by m.
Sourcepub fn edges_scaled_directions(&self) -> [Vector<N>; 3]
pub fn edges_scaled_directions(&self) -> [Vector<N>; 3]
The three edges scaled directions of this triangle: [B - A, C - B, A - C].
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).
Sourcepub fn extents_on_dir(&self, dir: &Unit<Vector<N>>) -> (N, N)
pub fn extents_on_dir(&self, dir: &Unit<Vector<N>>) -> (N, N)
Computes the extents of this triangle on the given direction.
This computes the min and max values of the dot products between each
vertex of this triangle and dir.
Trait Implementations§
Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Triangle<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Triangle<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self transformed by m.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self.Source§impl<N: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for Triangle<N>
impl<N: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for Triangle<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> BoundingSphere<N>
fn bounding_volume(&self, m: &Isometry<N>) -> BoundingSphere<N>
self transformed by m.Source§fn local_bounding_volume(&self) -> BoundingSphere<N>
fn local_bounding_volume(&self) -> BoundingSphere<N>
self.Source§impl<N: RealField + Copy> PointQuery<N> for Triangle<N>
impl<N: RealField + Copy> 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>
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)
self transformed by m and retuns the id of the
feature the point was projected on.Source§impl<N: RealField + Copy> PointQueryWithLocation<N> for Triangle<N>
impl<N: RealField + Copy> PointQueryWithLocation<N> for Triangle<N>
Source§type Location = TrianglePointLocation<N>
type Location = TrianglePointLocation<N>
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)
self transformed by m.Source§impl<N: RealField + Copy> RayCast<N> for Triangle<N>
Available on crate feature dim2 only.
impl<N: RealField + Copy> RayCast<N> for Triangle<N>
dim2 only.Source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§impl<N: RealField + Copy> SupportMap<N> for Triangle<N>
impl<N: RealField + Copy> SupportMap<N> for Triangle<N>
Source§impl<N: RealField + Copy> ToPolyline<N> for Triangle<N>
impl<N: RealField + Copy> ToPolyline<N> for Triangle<N>
type DiscretizationParameter = ()
impl<N: Copy + RealField + Copy> Copy for Triangle<N>
impl<N: RealField + Copy> StructuralPartialEq for Triangle<N>
Auto Trait Implementations§
impl<N> Freeze for Triangle<N>where
N: Freeze,
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<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.