Skip to main content

TriangleFace

Struct TriangleFace 

Source
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>

Source

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).

Source

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§

Source§

impl<S: Scalar> Debug for TriangleFace<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.