#[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> ConvexPolyhedron<N> for Triangle<N>
impl<N: RealField + Copy> ConvexPolyhedron<N> for Triangle<N>
Source§fn vertex(&self, id: FeatureId) -> Point<N>
fn vertex(&self, id: FeatureId) -> Point<N>
Source§fn edge(&self, id: FeatureId) -> (Point<N>, Point<N>, FeatureId, FeatureId)
fn edge(&self, id: FeatureId) -> (Point<N>, Point<N>, FeatureId, FeatureId)
Source§fn face(&self, id: FeatureId, face: &mut ConvexPolygonalFeature<N>)
fn face(&self, id: FeatureId, face: &mut ConvexPolygonalFeature<N>)
face with the geometric description of the specified face, in the shape’s local-space.Source§fn feature_normal(&self, _: FeatureId) -> Unit<Vector<N>>
fn feature_normal(&self, _: FeatureId) -> Unit<Vector<N>>
Source§fn support_face_toward(
&self,
m: &Isometry<N>,
dir: &Unit<Vector<N>>,
face: &mut ConvexPolygonalFeature<N>,
)
fn support_face_toward( &self, m: &Isometry<N>, dir: &Unit<Vector<N>>, face: &mut ConvexPolygonalFeature<N>, )
dir.Source§fn support_feature_toward(
&self,
transform: &Isometry<N>,
dir: &Unit<Vector<N>>,
eps: N,
out: &mut ConvexPolygonalFeature<N>,
)
fn support_feature_toward( &self, transform: &Isometry<N>, dir: &Unit<Vector<N>>, eps: N, out: &mut ConvexPolygonalFeature<N>, )
dir.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>
impl<N: RealField + Copy> RayCast<N> for Triangle<N>
Source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
_: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, _: bool, ) -> Option<RayIntersection<N>>
Source§fn toi_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<N>
fn toi_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<N>
Source§fn toi_and_normal_and_uv_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_and_uv_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§impl<N: RealField + Copy> Shape<N> for Triangle<N>
impl<N: RealField + Copy> Shape<N> for Triangle<N>
Source§fn local_aabb(&self) -> AABB<N>
fn local_aabb(&self) -> AABB<N>
self.Source§fn bounding_sphere(&self, m: &Isometry<N>) -> BoundingSphere<N>
fn bounding_sphere(&self, m: &Isometry<N>) -> BoundingSphere<N>
self transformed by m.Source§fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
RayCast implementation of self.Source§fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
PointQuery implementation of self.Source§fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
self if applicable.Source§fn is_support_map(&self) -> bool
fn is_support_map(&self) -> bool
self uses a support-mapping based representation.Source§fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
self if applicable.Source§fn is_convex_polyhedron(&self) -> bool
fn is_convex_polyhedron(&self) -> bool
self uses a convex polyhedron representation.Source§fn tangent_cone_contains_dir(
&self,
feature: FeatureId,
m: &Isometry<N>,
_: Option<&[N]>,
dir: &Unit<Vector<N>>,
) -> bool
fn tangent_cone_contains_dir( &self, feature: FeatureId, m: &Isometry<N>, _: Option<&[N]>, dir: &Unit<Vector<N>>, ) -> bool
_feature of the i-th subshape of self transformed by m has a tangent
cone that contains dir at the point pt.Source§fn local_bounding_sphere(&self) -> BoundingSphere<N>
fn local_bounding_sphere(&self) -> BoundingSphere<N>
self.Source§fn subshape_containing_feature(&self, _i: FeatureId) -> usize
fn subshape_containing_feature(&self, _i: FeatureId) -> usize
Source§fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
self if applicable.Source§fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
self if applicable.Source§fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
self if applicable.Source§fn is_composite_shape(&self) -> bool
fn is_composite_shape(&self) -> bool
self uses a composite shape-based representation.Source§fn is_deformable_shape(&self) -> bool
fn is_deformable_shape(&self) -> bool
self uses a composite shape-based representation.Source§impl<N: RealField + Copy> SupportMap<N> for Triangle<N>
impl<N: RealField + Copy> SupportMap<N> for Triangle<N>
Source§impl<N: RealField + Copy> ToTriMesh<N> for Triangle<N>
impl<N: RealField + Copy> ToTriMesh<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> 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<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.