pub struct Triangle {
pub a: OPoint<f32, Const<2>>,
pub b: OPoint<f32, Const<2>>,
pub c: OPoint<f32, Const<2>>,
}
Expand description
A triangle shape.
Fields
a: OPoint<f32, Const<2>>
The triangle first point.
b: OPoint<f32, Const<2>>
The triangle second point.
c: OPoint<f32, Const<2>>
The triangle third point.
Implementations
sourceimpl Triangle
impl Triangle
sourcepub fn bounding_sphere(
&self,
pos: &Isometry<f32, Unit<Complex<f32>>, 2>
) -> BoundingSphere
pub fn bounding_sphere(
&self,
pos: &Isometry<f32, Unit<Complex<f32>>, 2>
) -> BoundingSphere
Computes the world-space bounding sphere of this triangle, transformed by pos
.
sourcepub fn local_bounding_sphere(&self) -> BoundingSphere
pub fn local_bounding_sphere(&self) -> BoundingSphere
Computes the local-space bounding sphere of this triangle.
sourceimpl Triangle
impl Triangle
sourcepub fn new(
a: OPoint<f32, Const<2>>,
b: OPoint<f32, Const<2>>,
c: OPoint<f32, Const<2>>
) -> Triangle
pub fn new(
a: OPoint<f32, Const<2>>,
b: OPoint<f32, Const<2>>,
c: OPoint<f32, Const<2>>
) -> Triangle
Creates a triangle from three points.
sourcepub fn from_array(arr: &[OPoint<f32, Const<2>>; 3]) -> &Triangle
pub fn from_array(arr: &[OPoint<f32, Const<2>>; 3]) -> &Triangle
Creates the reference to a triangle from the reference to an array of three points.
sourcepub fn vertices(&self) -> &[OPoint<f32, Const<2>>; 3]
pub fn vertices(&self) -> &[OPoint<f32, Const<2>>; 3]
Reference to an array containing the three vertices of this triangle.
sourcepub fn normal(
&self
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>
pub fn normal(
&self
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 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 scaled(
self,
scale: &Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> Triangle
pub fn scaled(
self,
scale: &Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> Triangle
Computes a scaled version of this triangle.
sourcepub fn transformed(&self, m: &Isometry<f32, Unit<Complex<f32>>, 2>) -> Triangle
pub fn transformed(&self, m: &Isometry<f32, Unit<Complex<f32>>, 2>) -> Triangle
Returns a new triangle with vertices transformed by m
.
sourcepub fn edges_scaled_directions(
&self
) -> [Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>; 3]
pub fn edges_scaled_directions(
&self
) -> [Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>; 3]
The three edges scaled directions of this triangle: [B - A, C - B, A - C].
sourcepub fn local_support_edge_segment(
&self,
dir: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> Segment
pub fn local_support_edge_segment(
&self,
dir: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> Segment
Return the edge segment of this cuboid with a normal cone containing
a direction that that maximizes the dot product with local_dir
.
sourcepub fn support_face(
&self,
dir: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> PolygonalFeature
pub fn support_face(
&self,
dir: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> PolygonalFeature
Return the face of this triangle with a normal that maximizes
the dot product with dir
.
sourcepub fn scaled_normal(
&self
) -> Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
pub fn scaled_normal(
&self
) -> Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 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<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>
) -> (f32, f32)
pub fn extents_on_dir(
&self,
dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>
) -> (f32, f32)
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
.
sourcepub fn unit_angular_inertia(&self) -> f32
pub fn unit_angular_inertia(&self) -> f32
Computes the unit angular inertia of this triangle.
sourcepub fn contains_point(&self, p: &OPoint<f32, Const<2>>) -> bool
pub fn contains_point(&self, p: &OPoint<f32, Const<2>>) -> bool
Tests if a point is inside of this triangle.
sourcepub fn feature_normal(
&self,
_: FeatureId
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>
pub fn feature_normal(
&self,
_: FeatureId
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>
The normal of the given feature of this shape.
sourcepub fn orientation(&self, epsilon: f32) -> TriangleOrientation
pub fn orientation(&self, epsilon: f32) -> TriangleOrientation
The orientation of the triangle, based on its signed area.
Returns TriangleOrientation::Degenerate
if the triangle’s area is
smaller than epsilon
.
Trait Implementations
sourceimpl PointQuery for Triangle
impl PointQuery for Triangle
sourcefn project_local_point(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> PointProjection
fn project_local_point(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> PointProjection
self
. Read moresourcefn project_local_point_and_get_feature(
&self,
pt: &OPoint<f32, Const<2>>
) -> (PointProjection, FeatureId)
fn project_local_point_and_get_feature(
&self,
pt: &OPoint<f32, Const<2>>
) -> (PointProjection, FeatureId)
self
and returns the id of the
feature the point was projected on. Read moresourcefn project_local_point_with_max_dist(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
fn project_local_point_with_max_dist(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
self
, unless the projection lies further than the given max distance. Read moresourcefn project_point_with_max_dist(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
fn project_point_with_max_dist(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
self
transformed by m
, unless the projection lies further than the given max distance.sourcefn distance_to_local_point(&self, pt: &OPoint<f32, Const<2>>, solid: bool) -> f32
fn distance_to_local_point(&self, pt: &OPoint<f32, Const<2>>, solid: bool) -> f32
self
.sourcefn contains_local_point(&self, pt: &OPoint<f32, Const<2>>) -> bool
fn contains_local_point(&self, pt: &OPoint<f32, Const<2>>) -> bool
self
.sourcefn project_point(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> PointProjection
fn project_point(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> PointProjection
self
transformed by m
.sourcefn distance_to_point(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> f32
fn distance_to_point(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> f32
self
transformed by m
.sourceimpl PointQueryWithLocation for Triangle
impl PointQueryWithLocation for Triangle
type Location = TrianglePointLocation
type Location = TrianglePointLocation
sourcefn project_local_point_and_get_location(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> (PointProjection, <Triangle as PointQueryWithLocation>::Location)
fn project_local_point_and_get_location(
&self,
pt: &OPoint<f32, Const<2>>,
solid: bool
) -> (PointProjection, <Triangle as PointQueryWithLocation>::Location)
self
.sourceimpl PolygonalFeatureMap for Triangle
impl PolygonalFeatureMap for Triangle
sourcefn local_support_feature(
&self,
dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>,
out_feature: &mut PolygonalFeature
)
fn local_support_feature(
&self,
dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>,
out_feature: &mut PolygonalFeature
)
self
towards the dir
.sourceimpl RayCast for Triangle
impl RayCast for Triangle
sourcefn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
fn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
sourcefn cast_local_ray(&self, ray: &Ray, max_toi: f32, solid: bool) -> Option<f32>
fn cast_local_ray(&self, ray: &Ray, max_toi: f32, solid: bool) -> Option<f32>
sourcefn intersects_local_ray(&self, ray: &Ray, max_toi: f32) -> bool
fn intersects_local_ray(&self, ray: &Ray, max_toi: f32) -> bool
sourcefn cast_ray(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<f32>
fn cast_ray(
&self,
m: &Isometry<f32, Unit<Complex<f32>>, 2>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<f32>
sourceimpl Shape for Triangle
impl Shape for Triangle
sourcefn clone_box(&self) -> Box<dyn Shape + 'static, Global>
fn clone_box(&self) -> Box<dyn Shape + 'static, Global>
sourcefn compute_local_aabb(&self) -> AABB
fn compute_local_aabb(&self) -> AABB
sourcefn compute_local_bounding_sphere(&self) -> BoundingSphere
fn compute_local_bounding_sphere(&self) -> BoundingSphere
sourcefn compute_aabb(&self, position: &Isometry<f32, Unit<Complex<f32>>, 2>) -> AABB
fn compute_aabb(&self, position: &Isometry<f32, Unit<Complex<f32>>, 2>) -> AABB
sourcefn mass_properties(&self, _density: f32) -> MassProperties
fn mass_properties(&self, _density: f32) -> MassProperties
sourcefn shape_type(&self) -> ShapeType
fn shape_type(&self) -> ShapeType
sourcefn as_typed_shape(&self) -> TypedShape<'_>
fn as_typed_shape(&self) -> TypedShape<'_>
fn ccd_thickness(&self) -> f32
fn ccd_angular_thickness(&self) -> f32
sourcefn as_support_map(&self) -> Option<&dyn SupportMap>
fn as_support_map(&self) -> Option<&dyn SupportMap>
sourcefn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
sourcefn feature_normal_at_point(
&self,
feature: FeatureId,
_point: &OPoint<f32, Const<2>>
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>
fn feature_normal_at_point(
&self,
feature: FeatureId,
_point: &OPoint<f32, Const<2>>
) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>
sourcefn compute_bounding_sphere(
&self,
position: &Isometry<f32, Unit<Complex<f32>>, 2>
) -> BoundingSphere
fn compute_bounding_sphere(
&self,
position: &Isometry<f32, Unit<Complex<f32>>, 2>
) -> BoundingSphere
fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape>
sourceimpl SupportMap for Triangle
impl SupportMap for Triangle
fn local_support_point(
&self,
dir: &Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> OPoint<f32, Const<2>>
sourcefn local_support_point_toward(
&self,
dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>
) -> OPoint<f32, Const<2>>
fn local_support_point_toward(
&self,
dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>
) -> OPoint<f32, Const<2>>
self.local_support_point
except that dir
is normalized.fn support_point(
&self,
transform: &Isometry<f32, Unit<Complex<f32>>, 2>,
dir: &Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
) -> OPoint<f32, Const<2>>
impl Copy for Triangle
impl StructuralPartialEq for Triangle
Auto Trait Implementations
impl RefUnwindSafe for Triangle
impl Send for Triangle
impl Sync for Triangle
impl Unpin for Triangle
impl UnwindSafe for Triangle
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn 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. Read morefn 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. Read moreimpl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given [World]sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn 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).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.