[][src]Struct kalast::base::object_3d::Object3D

pub struct Object3D {
    pub path: &'static Path,
    // some fields omitted
}

A shape model representation for 3D object files.

Definition

Compute attributes relative of the shape model of a 3D object file. Faces are assumed triangular. The file must contain positions of vertices and indices of vertices that form a face.

Calculate for each face:

  • the position of the center point (in cartesian and spherical)
  • the outward normal vector
  • the area

Example

Example of the creation of a 3D object.

use kalast::Object3D;
use std::path::Path;

let object = Object3D::new(Path::new("rsc/obj/dimorphos.obj"));

Fields

path: &'static Path

Path to the 3D object file.

Implementations

impl Object3D[src]

pub fn new(path: &'static Path) -> Self[src]

3D object constructor. Reads a 3D object file and compute attributes for the faces.

pub fn number_faces_raw(&self) -> usize[src]

Get the number of faces of the 3D object without the mask.

pub fn number_faces(&self) -> usize[src]

Get the number of faces of the 3D object with the mask applied.

pub fn apply_factor(&mut self, factor: f64)[src]

Apply a multiplication factor to vertices positions.

pub fn recompute_faces(&mut self)[src]

In case the position of vertices, the indices of faces or the mask is updated, recompute the table data.

pub fn vertices(&self) -> &V3X<f64>[src]

Vertices getter.

pub fn set_vertices(&mut self, vertices: V3X<f64>)[src]

Vertices setter. Also recompute the table data.

pub fn faces(&self) -> &V3X<usize>[src]

Faces getter.

pub fn set_faces(&mut self, faces: V3X<usize>)[src]

Faces setter. Also recompute the table data.

pub fn vertices_iter(
    &self
) -> impl Iterator<Item = (MatrixSlice3x1<'_, f64>, MatrixSlice3x1<'_, f64>, MatrixSlice3x1<'_, f64>)>
[src]

Iterators over the three vertices of each face.

pub fn edges_iter(&self) -> impl Iterator<Item = (V3<f64>, V3<f64>)> + '_[src]

Iterators over the two first edges of each face.

pub fn centers(&self) -> MatrixSlice3xX<'_, f64, U1, U10>[src]

Centers getter.

pub fn centers_mut(&mut self) -> MatrixSliceMut3xX<'_, f64, U1, U10>[src]

Centers getter as mutable.

pub fn compute_centers(&mut self)[src]

Compute centers from vertices and faces.

pub fn normals(&self) -> MatrixSlice3xX<'_, f64, U1, U10>[src]

Normals getter.

pub fn normals_mut(&mut self) -> MatrixSliceMut3xX<'_, f64, U1, U10>[src]

Normals getter as mutable.

pub fn compute_normals(&mut self)[src]

Compute normals from vertices and faces.

pub fn sphericals(&self) -> MatrixSlice3xX<'_, f64, U1, U10>[src]

Sphericals getter.

pub fn sphericals_mut(&mut self) -> MatrixSliceMut3xX<'_, f64, U1, U10>[src]

Sphericals getter as mutable.

pub fn compute_sphericals(&mut self)[src]

Compute sphericals from centers.

pub fn areas(&self) -> MatrixSlice1xX<'_, f64, U1, U10>[src]

Areas getter.

pub fn areas_mut(&mut self) -> MatrixSliceMut1xX<'_, f64, U1, U10>[src]

Areas getter as mutable.

pub fn compute_areas(&mut self)[src]

Compute areas from vertices and faces.

pub fn face_iter_all(
    &self
) -> impl Iterator<Item = MatrixSlice10x1<'_, f64, U1, U10>> + '_ + Clone
[src]

Iterate over table data face by face yielding all attributes of faces.

pub fn face_iter_mut_all(
    &mut self
) -> impl Iterator<Item = MatrixSliceMut10x1<'_, f64, U1, U10>> + '_
[src]

Iterate over table data face by face yielding all attributes of faces as mutable.

pub fn faces_mask(&self) -> &VX<bool>[src]

Faces' mask getter.

pub fn set_faces_mask(&mut self, faces_mask: VX<bool>)[src]

Faces' mask setter.

pub fn faces_mask_true_indices(&self) -> VX<usize>[src]

Faces' mask getter with true indices only.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,