Mesh

Struct Mesh 

Source
pub struct Mesh(/* private fields */);
Expand description

Wrapper around a C++ mesh object.

Implementations§

Source§

impl Mesh

Implementations for the Mesh struct.

Source

pub fn new(vertices: &[f32], indices: &[u32]) -> Self

Create a new mesh from vertices and indices.

Source

pub fn num_props(&self) -> u32

Number of properties per vertex

Source

pub fn vertices(&self) -> Vec<f32>

Get the vertices of the mesh.

Examples found in repository?
examples/simple.rs (line 3)
1fn main() {
2    let sphere = manifold_rs::Manifold::sphere(4.0, 32);
3    let vertices = sphere.to_mesh().vertices();
4    let indices = sphere.to_mesh().indices();
5
6    assert!(!vertices.is_empty());
7    assert!(!indices.is_empty());
8
9    println!("Vertices:\n{vertices:?}");
10    println!("Indices:\n{indices:?}");
11}
Source

pub fn indices(&self) -> Vec<u32>

Get the indices of the mesh.

Examples found in repository?
examples/simple.rs (line 4)
1fn main() {
2    let sphere = manifold_rs::Manifold::sphere(4.0, 32);
3    let vertices = sphere.to_mesh().vertices();
4    let indices = sphere.to_mesh().indices();
5
6    assert!(!vertices.is_empty());
7    assert!(!indices.is_empty());
8
9    println!("Vertices:\n{vertices:?}");
10    println!("Indices:\n{indices:?}");
11}
Source

pub fn to_manifold(&self) -> Manifold

Get the manifold representation of the mesh.

Trait Implementations§

Source§

impl From<Manifold> for Mesh

Convert Manifold to Mesh struct

Source§

fn from(manifold: Manifold) -> Self

Converts to this type from the input type.
Source§

impl From<Mesh> for Manifold

Convert Mesh to Manifold struct

Source§

fn from(mesh: Mesh) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Mesh

§

impl RefUnwindSafe for Mesh

§

impl !Send for Mesh

§

impl !Sync for Mesh

§

impl Unpin for Mesh

§

impl UnwindSafe for Mesh

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.