Struct crystal_ball::shapes::Triangle
source · pub struct Triangle {
pub triangle_mesh: Arc<TriangleMesh>,
pub index: usize,
}
Expand description
A single triangle from a TriangleMesh
.
Fields§
§triangle_mesh: Arc<TriangleMesh>
The triangle’s corresponding TriangleMesh
.
index: usize
The triangle’s index in the TriangleMesh
.
Implementations§
source§impl Triangle
impl Triangle
sourcepub fn normals(&self) -> [Vec3; 3]
pub fn normals(&self) -> [Vec3; 3]
Return the triangle’s normals.
If the TriangleMesh
doesn’t provide any normals,
they are automatically calculated assuming flat shading.
sourcepub fn tangents(&self) -> Option<[Vec4; 3]>
pub fn tangents(&self) -> Option<[Vec4; 3]>
Return the triangle’s tangents.
Returns None
if the TriangleMesh
doesn’t provide any tangents.
sourcepub fn uvs(&self) -> Option<[Point2; 3]>
pub fn uvs(&self) -> Option<[Point2; 3]>
Return the triangle’s UV coordinates.
Returns None
if the TriangleMesh
doesn’t provide UV coordinates.
sourcepub fn face_normal(&self) -> Vec3
pub fn face_normal(&self) -> Vec3
Calculate the normal of the triangle’s face (flat normal).
sourcepub fn circumcenter(&self) -> Point3
pub fn circumcenter(&self) -> Point3
Calculate the triangle’s circumcenter.
sourcepub fn vertex_mean(&self) -> Point3
pub fn vertex_mean(&self) -> Point3
Calculate the triangle’s vertex mean.
Trait Implementations§
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§
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
Mutably borrows from an owned value. Read more