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

pub struct Object3D { /* 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;

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

Implementations

impl Object3D[src]

pub fn new<P: AsRef<Path>>(path: P) -> Self[src]

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

pub fn empty() -> Self[src]

Create an empty 3D object.

pub fn add_vertex(&mut self, vertex: &V3<f64>)[src]

Add a vertex to the 3D object.

pub fn add_face(&mut self, face: &V3<usize>)[src]

Add a face to the 3D object.

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

Add a face to the 3D object.

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 invert_normals(&mut self)[src]

To invert the normals.

pub fn recompute_faces(&mut self)[src]

In case the position of vertices, the indices of faces or the mask are updated, recompute the table data. If the size of the mask does not match the size of the number of faces, it reset the mask.

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 mask_face(&mut self, face: usize)[src]

Mask one face.

pub fn mask_all_faces_except_this(&mut self, face: usize)[src]

Mask all faces except this one.

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

Faces’ mask getter with true indices only.

pub fn set_equator_mask(&mut self, equator_threshold: Option<f64>)[src]

Faces’ mask that match the equator (latitude = 0°). By default, it will look up for the smallest latitude and consider it as the threshold for the equator. Otherwise, you can specify yourself the threshold.

pub fn set_prime_meridian_mask(&mut self, longitude_threshold: Option<f64>)[src]

Faces’ mask that match the prime meridian (longitude = 0°). By default, it will look up for the smallest longitude and consider it as the threshold for the prime meridian. Otherwise, you can specify yourself the threshold.

pub fn set_longitude_latitude_zero(&mut self)[src]

Faces’ mask that match the point at longitude = latitude = 0°. TODO

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