#[repr(C)]pub struct Triangle<N>{
pub a: OPoint<N, Const<2>>,
pub b: OPoint<N, Const<2>>,
pub c: OPoint<N, Const<2>>,
}Expand description
A triangle shape.
Fields§
§a: OPoint<N, Const<2>>The triangle first point.
b: OPoint<N, Const<2>>The triangle second point.
c: OPoint<N, Const<2>>The triangle third point.
Implementations§
Source§impl<N> Triangle<N>
impl<N> Triangle<N>
Sourcepub fn new(
a: OPoint<N, Const<2>>,
b: OPoint<N, Const<2>>,
c: OPoint<N, Const<2>>,
) -> Triangle<N>
pub fn new( a: OPoint<N, Const<2>>, b: OPoint<N, Const<2>>, c: OPoint<N, Const<2>>, ) -> Triangle<N>
Creates a triangle from three points.
Sourcepub fn from_array(arr: &[OPoint<N, Const<2>>; 3]) -> &Triangle<N>
pub fn from_array(arr: &[OPoint<N, Const<2>>; 3]) -> &Triangle<N>
Creates the reference to a triangle from the reference to an array of three points.
Sourcepub fn a(&self) -> &OPoint<N, Const<2>>
👎Deprecated: use the self.a public field directly.
pub fn a(&self) -> &OPoint<N, Const<2>>
use the self.a public field directly.
The fist point of this triangle.
Sourcepub fn b(&self) -> &OPoint<N, Const<2>>
👎Deprecated: use the self.b public field directly.
pub fn b(&self) -> &OPoint<N, Const<2>>
use the self.b public field directly.
The second point of this triangle.
Sourcepub fn c(&self) -> &OPoint<N, Const<2>>
👎Deprecated: use the self.c public field directly.
pub fn c(&self) -> &OPoint<N, Const<2>>
use the self.c public field directly.
The third point of this triangle.
Sourcepub fn vertices(&self) -> &[OPoint<N, Const<2>>; 3]
pub fn vertices(&self) -> &[OPoint<N, Const<2>>; 3]
Reference to an array containing the three vertices of this triangle.
Sourcepub fn normal(
&self,
) -> Option<Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>>
pub fn normal( &self, ) -> Option<Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>>
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, Unit<Complex<N>>, 2>) -> Triangle<N>
pub fn transformed(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> Triangle<N>
Returns a new triangle with vertices transformed by m.
Sourcepub fn edges_scaled_directions(
&self,
) -> [Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>; 3]
pub fn edges_scaled_directions( &self, ) -> [Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>; 3]
The three edges scaled directions of this triangle: [B - A, C - B, A - C].
Sourcepub fn scaled_normal(
&self,
) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
pub fn scaled_normal( &self, ) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
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<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>,
) -> (N, N)
pub fn extents_on_dir( &self, dir: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>, ) -> (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<'de, N> Deserialize<'de> for Triangle<N>
impl<'de, N> Deserialize<'de> for Triangle<N>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Triangle<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Triangle<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<N> HasBoundingVolume<N, AABB<N>> for Triangle<N>
impl<N> HasBoundingVolume<N, AABB<N>> for Triangle<N>
Source§impl<N> HasBoundingVolume<N, BoundingSphere<N>> for Triangle<N>
impl<N> HasBoundingVolume<N, BoundingSphere<N>> for Triangle<N>
Source§fn bounding_volume(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
) -> BoundingSphere<N>
fn bounding_volume( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ) -> 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> PartialEq for Triangle<N>
impl<N> PartialEq for Triangle<N>
Source§impl<N> PointQuery<N> for Triangle<N>
impl<N> PointQuery<N> for Triangle<N>
Source§fn project_point(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
pt: &OPoint<N, Const<2>>,
solid: bool,
) -> PointProjection<N>
fn project_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool, ) -> PointProjection<N>
self transformed by m.Source§fn project_point_with_feature(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
pt: &OPoint<N, Const<2>>,
) -> (PointProjection<N>, FeatureId)
fn project_point_with_feature( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, ) -> (PointProjection<N>, FeatureId)
self transformed by m and retuns the id of the
feature the point was projected on.Source§impl<N> PointQueryWithLocation<N> for Triangle<N>
impl<N> PointQueryWithLocation<N> for Triangle<N>
Source§type Location = TrianglePointLocation<N>
type Location = TrianglePointLocation<N>
Source§fn project_point_with_location(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
pt: &OPoint<N, Const<2>>,
solid: bool,
) -> (PointProjection<N>, <Triangle<N> as PointQueryWithLocation<N>>::Location)
fn project_point_with_location( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool, ) -> (PointProjection<N>, <Triangle<N> as PointQueryWithLocation<N>>::Location)
self transformed by m.Source§impl<N> RayCast<N> for Triangle<N>
Available on crate feature dim2 only.
impl<N> RayCast<N> for Triangle<N>
dim2 only.Source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§impl<N> Serialize for Triangle<N>
impl<N> Serialize for Triangle<N>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<N> SupportMap<N> for Triangle<N>
impl<N> SupportMap<N> for Triangle<N>
fn local_support_point( &self, dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, ) -> OPoint<N, Const<2>>
Source§fn local_support_point_toward(
&self,
dir: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>,
) -> OPoint<N, Const<2>>
fn local_support_point_toward( &self, dir: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>, ) -> OPoint<N, Const<2>>
self.local_support_point except that dir is normalized.fn support_point( &self, transform: &Isometry<N, Unit<Complex<N>>, 2>, dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, ) -> OPoint<N, Const<2>>
Source§impl<N> ToPolyline<N> for Triangle<N>
impl<N> ToPolyline<N> for Triangle<N>
type DiscretizationParameter = ()
impl<N> Copy for Triangle<N>
impl<N> 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> UnsafeUnpin for Triangle<N>where
N: UnsafeUnpin,
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.