Struct fenris_geometry::Triangle
source · pub struct Triangle<T, D>(pub [OPoint<T, D>; 3])
where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>;
Tuple Fields§
§0: [OPoint<T, D>; 3]
Implementations§
source§impl<T, D> Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
pub fn swap_vertices(&mut self, i: usize, j: usize)
pub fn edge(&self, index: usize) -> LineSegment<T, D>
source§impl<T> Triangle<T, Const<2>>where
T: Real,
impl<T> Triangle<T, Const<2>>where
T: Real,
pub fn orientation(&self) -> Orientation
pub fn signed_area(&self) -> T
pub fn area(&self) -> T
source§impl<T> Triangle<T, Const<3>>where
T: Real,
impl<T> Triangle<T, Const<3>>where
T: Real,
sourcepub fn normal_dir(&self) -> Vector3<T>
pub fn normal_dir(&self) -> Vector3<T>
Returns a vector normal to the triangle. The vector is not normalized.
pub fn normal(&self) -> Vector3<T>
sourcepub fn orientation(&self) -> Orientation
pub fn orientation(&self) -> Orientation
TODO: Remove this. It makes no sense for 3D.
sourcepub fn signed_area(&self) -> T
pub fn signed_area(&self) -> T
TODO: Remove this. It makes no sense for 3D (moreover, the current implementation gives the non-negative ara in any case).
pub fn area(&self) -> T
sourcepub fn point_orientation(&self, point: &Point3<T>) -> OrientationTestResult
pub fn point_orientation(&self, point: &Point3<T>) -> OrientationTestResult
Determines the orientation of a point with respect to the plane containing the triangle.
This is the common “orientation test” used in computational geometry. The test returns
a value whose sign is the same as dot(n, x - x0)
, where x0
is the projection of
the point onto the triangle plane.
Note that at the moment, this implementation is NOT robust (in the sense of exact/robust geometric predicates).
Trait Implementations§
source§impl<T, D> BoundedGeometry<T> for Triangle<T, D>where
T: Real,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> BoundedGeometry<T> for Triangle<T, D>where
T: Real,
D: DimName,
DefaultAllocator: Allocator<T, D>,
type Dimension = D
fn bounding_box(&self) -> AxisAlignedBoundingBox<T, D>
source§impl<T, D> Clone for Triangle<T, D>where
T: Scalar + Clone,
D: DimName + Clone,
DefaultAllocator: Allocator<T, D>,
impl<T, D> Clone for Triangle<T, D>where
T: Scalar + Clone,
D: DimName + Clone,
DefaultAllocator: Allocator<T, D>,
source§impl<T, D> Debug for Triangle<T, D>where
T: Scalar + Debug,
D: DimName + Debug,
DefaultAllocator: Allocator<T, D>,
impl<T, D> Debug for Triangle<T, D>where
T: Scalar + Debug,
D: DimName + Debug,
DefaultAllocator: Allocator<T, D>,
source§impl<'de, T, D> Deserialize<'de> for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
OPoint<T, D>: Deserialize<'de>,
impl<'de, T, D> Deserialize<'de> for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
OPoint<T, D>: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> From<Triangle<T, Const<2>>> for ConvexPolygon<T>where
T: Scalar,
impl<T> From<Triangle<T, Const<2>>> for ConvexPolygon<T>where
T: Scalar,
source§fn from(triangle: Triangle2d<T>) -> Self
fn from(triangle: Triangle2d<T>) -> Self
Converts to this type from the input type.
source§impl<T, D> PartialEq<Triangle<T, D>> for Triangle<T, D>where
T: Scalar + PartialEq,
D: DimName + PartialEq,
DefaultAllocator: Allocator<T, D>,
impl<T, D> PartialEq<Triangle<T, D>> for Triangle<T, D>where
T: Scalar + PartialEq,
D: DimName + PartialEq,
DefaultAllocator: Allocator<T, D>,
source§impl<T, D> Serialize for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
OPoint<T, D>: Serialize,
impl<T, D> Serialize for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
OPoint<T, D>: Serialize,
impl<T, D> Copy for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
OPoint<T, D>: Copy,
impl<T, D> Eq for Triangle<T, D>where
T: Scalar + Eq,
D: DimName + Eq,
DefaultAllocator: Allocator<T, D>,
impl<T, D> StructuralEq for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
impl<T, D> StructuralPartialEq for Triangle<T, D>where
T: Scalar,
D: DimName,
DefaultAllocator: Allocator<T, D>,
Auto Trait Implementations§
impl<T, D> !RefUnwindSafe for Triangle<T, D>
impl<T, D> !Send for Triangle<T, D>
impl<T, D> !Sync for Triangle<T, D>
impl<T, D> !Unpin for Triangle<T, D>
impl<T, D> !UnwindSafe for Triangle<T, D>
Blanket Implementations§
§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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.