pub struct TriangleFace<S: Scalar> {
pub a: Vector3<S>,
pub b: Vector3<S>,
pub c: Vector3<S>,
pub normal: Vector3<S>,
pub vertex_normals: Option<[Vector3<S>; 3]>,
}Fields§
§a: Vector3<S>§b: Vector3<S>§c: Vector3<S>§normal: Vector3<S>The triangle’s own (flat) normal, from its winding.
vertex_normals: Option<[Vector3<S>; 3]>The normal of the surface this triangle approximates, at each of
its three corners — what a renderer needs to shade a curved face
smoothly instead of as a field of facets. None where no surface
normal was available (a debug triangle, or a degenerate point like a
sphere’s pole), leaving a renderer with the flat Self::normal.
Implementations§
Source§impl<S: Scalar> TriangleFace<S>
impl<S: Scalar> TriangleFace<S>
Sourcepub fn try_new(a: Vector3<S>, b: Vector3<S>, c: Vector3<S>) -> GeopResult<Self>
pub fn try_new(a: Vector3<S>, b: Vector3<S>, c: Vector3<S>) -> GeopResult<Self>
Computes the normal from the cross product of (b-a) × (c-a). Fails if the cross product is zero (collinear or coincident points).
Sourcepub fn with_vertex_normals(self, normals: [Vector3<S>; 3]) -> Self
pub fn with_vertex_normals(self, normals: [Vector3<S>; 3]) -> Self
This triangle carrying the surface normals at its corners, each oriented to agree with the triangle’s own winding — a renderer picks front or back from the winding, so a vertex normal pointing the other way would light the face inside out.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for TriangleFace<S>where
S: Freeze,
impl<S> RefUnwindSafe for TriangleFace<S>where
S: RefUnwindSafe,
impl<S> Send for TriangleFace<S>
impl<S> Sync for TriangleFace<S>
impl<S> Unpin for TriangleFace<S>where
S: Unpin,
impl<S> UnsafeUnpin for TriangleFace<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for TriangleFace<S>where
S: 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
Mutably borrows from an owned value. Read more