Skip to main content

TriMesh

Struct TriMesh 

Source
pub struct TriMesh {
    pub positions: Vec<[f32; 3]>,
    pub normals: Vec<[f32; 3]>,
    pub indices: Vec<u32>,
    pub edges: Vec<u32>,
    pub colors: Vec<[f32; 3]>,
    pub faces: Vec<u32>,
    pub edge_ids: Vec<u32>,
    pub face_surfaces: Vec<FaceSurface>,
    pub face_names: Vec<u64>,
    pub face_makers: Vec<u64>,
    pub edge_faces: Vec<[u64; 2]>,
}
Expand description

Triangular mesh generated from kernel bodies for viewports and export.

Fields§

§positions: Vec<[f32; 3]>§normals: Vec<[f32; 3]>§indices: Vec<u32>§edges: Vec<u32>

Optional line-list of feature edges that should be drawn as outlines on top of the shaded surface (e.g. face boundaries from a STEP import). Stored as flat pairs of indices into Self::positions; the slice length is therefore always a multiple of two. Empty when the source has no edge information available.

§colors: Vec<[f32; 3]>

Optional per-vertex linear RGB albedo in 0..1 (same length as Self::positions when set). Empty means the renderer uses the body tint from push constants only.

§faces: Vec<u32>

Which kernel face each triangle was cut from: one entry per triangle (indices.len() / 3), an index into the body’s faces in the kernel’s own order. A curved face is many triangles with many normals, and this is what lets a click on one of them select the whole face. Empty when the source has no faces (a sketch, a datum, a mesh saved before faces were recorded), and a consumer falls back to geometry.

§edge_ids: Vec<u32>

Which kernel edge each outline segment belongs to: one entry per pair in Self::edges, an index into the body’s edges in the kernel’s own order. A curved edge is many segments, and this is what lets a click on one of them select the whole edge. Empty when the outline came from triangle boundaries rather than kernel edges.

§face_surfaces: Vec<FaceSurface>

The exact surface of each kernel face, indexed like Self::faces: what a picked face is, beyond the triangles drawn for it. Empty when the source has no faces.

§face_names: Vec<u64>

The name of each kernel face, indexed like Self::faces: what a pick keeps so a rebuild finds the face again. Zero where a face has none; empty when the source names none.

§face_makers: Vec<u64>

The tag of the op that made each kernel face, indexed like Self::faces: the name of the feature a body’s chain built it under (naming::name_of_id of its id), kept by a face a later op splits or trims. Zero where unknown; empty when the source names none.

§edge_faces: Vec<[u64; 2]>

The names of the two faces each kernel edge runs between, indexed like Self::edge_ids.

Implementations§

Source§

impl TriMesh

Source

pub fn bounds(&self) -> Option<([f32; 3], [f32; 3])>

Compute axis-aligned bounding box (min, max) of the mesh, if non-empty.

Source

pub fn aabb(&self) -> Option<Aabb>

The box around the mesh’s points; None for a mesh with none.

Trait Implementations§

Source§

impl Clone for TriMesh

Source§

fn clone(&self) -> TriMesh

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TriMesh

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for TriMesh

Source§

fn default() -> TriMesh

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TriMesh

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TriMesh, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TriMesh

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.