Skip to main content

HasTriangles

Trait HasTriangles 

Source
pub trait HasTriangles<'a>: Sized {
    type Point: IsPoint;
    type Normal: IsUnitVector;
    type Triangle: IsTriangle<'a, Self::Point, Self::Normal>;
    type TriangleTable: IsGeometryTable<Key = TriangleId, Item = Self::Triangle> + ?Sized + 'a;

    // Required methods
    fn triangle_table(&self) -> &Self::TriangleTable;
    fn triangle_table_mut(&mut self) -> &mut Self::TriangleTable;
    fn set_triangle_table(&mut self, table: &'a mut Self::TriangleTable);

    // Provided methods
    fn triangle_table_size(&self) -> usize { ... }
    fn get_triangle(&self, id: &TriangleId) -> Option<Self::Triangle> { ... }
    fn contains_triangle(&self, id: &TriangleId) -> bool { ... }
    fn insert_triangle(
        &mut self,
        id: TriangleId,
        value: Self::Triangle,
    ) -> Result<(), ErrorsJSL> { ... }
    fn remove_triangle(&mut self, id: &TriangleId) -> Option<Self::Triangle> { ... }
}
Expand description

Provides access to a borrowed triangle table.

Required Associated Types§

Source

type Point: IsPoint

Point primitive referenced by the stored triangles.

Source

type Normal: IsUnitVector

Unit normal type used by the stored triangles.

Source

type Triangle: IsTriangle<'a, Self::Point, Self::Normal>

Triangle primitive stored in the triangle table.

Source

type TriangleTable: IsGeometryTable<Key = TriangleId, Item = Self::Triangle> + ?Sized + 'a

Borrowed triangle-table type.

Required Methods§

Source

fn triangle_table(&self) -> &Self::TriangleTable

Returns an immutable reference to the triangle table.

Source

fn triangle_table_mut(&mut self) -> &mut Self::TriangleTable

Returns a mutable reference to the triangle table.

Source

fn set_triangle_table(&mut self, table: &'a mut Self::TriangleTable)

Rebinds the implementor to a different borrowed triangle table.

Provided Methods§

Source

fn triangle_table_size(&self) -> usize

Returns the number of entries in the triangle table.

Source

fn get_triangle(&self, id: &TriangleId) -> Option<Self::Triangle>

Returns the triangle stored at id.

Source

fn contains_triangle(&self, id: &TriangleId) -> bool

Returns true if the triangle table contains id.

Source

fn insert_triangle( &mut self, id: TriangleId, value: Self::Triangle, ) -> Result<(), ErrorsJSL>

Inserts or replaces the triangle stored at id.

Source

fn remove_triangle(&mut self, id: &TriangleId) -> Option<Self::Triangle>

Removes and returns the triangle stored at id, if present.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§