Skip to main content

Triangle3D

Struct Triangle3D 

Source
pub struct Triangle3D { /* private fields */ }
Expand description

Concrete 3D triangle implementation backed by three point ids.

Implementations§

Source§

impl Triangle3D

Source

pub fn new( a_id: PointId, b_id: PointId, c_id: PointId, vertex_table: SharedGeometryTable<PointId, CoordinateVector3D>, ) -> Self

Creates a triangle from three point ids and a shared point table.

The ids are interpreted in order as vertices a, b, and c.

Trait Implementations§

Source§

impl CanMirror for Triangle3D

Source§

type Point = CoordinateVector3D

Point type used by the mirror plane.
Source§

type Normal = UnitVector3D

Unit normal type used by the mirror plane.
Source§

fn mirror<P>(&mut self, mirror_plane: &P)
where P: IsPlane<Point = Self::Point, Normal = Self::Normal>,

Reflects self across mirror_plane.
Source§

impl CanRotate for Triangle3D

Source§

type Point = CoordinateVector3D

Point type used by the rotation axis.
Source§

fn rotate<'a, L>(&mut self, axis: &L, angle_radians: GeometryMeasure)
where L: IsLine<'a, Self::Point>,

Mutates self by rotating about axis.
Source§

impl CanShear for Triangle3D

Source§

type Point = CoordinateVector3D

Point type used by the shear line.
Source§

fn shear<'a, L>(&mut self, shear_line: &L)
where L: IsLine<'a, Self::Point>,

Mutates self by the shear x ← x + k·y, with k = shear_line.length().
Source§

impl CanTranslate for Triangle3D

Source§

type Point = CoordinateVector3D

Point type used by the translation line.
Source§

fn translate<'a, L>(&mut self, translation_vector: &L)
where L: IsLine<'a, Self::Point>,

Mutates self by applying the translation vector.
Source§

impl Clone for Triangle3D

Source§

fn clone(&self) -> Self

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 Triangle3D

Source§

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

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

impl Display for Triangle3D

Source§

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

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

impl Eq for Triangle3D

Source§

impl GeometricPrimitive for Triangle3D

Source§

impl GeometricPrimitive3D for Triangle3D

Source§

impl HasCentroid for Triangle3D

Source§

type Point = CoordinateVector3D

Point type used to represent the centroid.
Source§

fn centroid(&self) -> Self::Point

Returns the centroid.
Source§

impl HasEdges for Triangle3D

Source§

type Edge = Line3D

Edge type returned by the implementor.
Source§

fn edge_count(&self) -> usize

Number of edges available on the shape.
Source§

fn edge(&self, index: usize) -> Option<Self::Edge>

Returns an edge by index.
Source§

impl HasMeasure for Triangle3D

Source§

fn measure(&self) -> GeometryMeasure

Returns the primitive’s primary measure, such as length or area.
Source§

impl HasOrientation for Triangle3D

Source§

fn orientation(&self) -> Orientation2D

Returns the primitive orientation.
Source§

impl<'a> HasVertices<'a> for Triangle3D

Source§

type Vertex = CoordinateVector3D

Point primitive stored in the vertex table.
Source§

type VertexTable = Rc<RefCell<HashGeometryTable<PointId, CoordinateVector3D>>>

Borrowed point-table type.
Source§

fn vertex_table(&self) -> &Self::VertexTable

Returns an immutable reference to the vertex table.
Source§

fn vertex_table_mut(&mut self) -> &mut Self::VertexTable

Returns a mutable reference to the vertex table.
Source§

fn set_vertex_table(&mut self, table: &'a mut Self::VertexTable)

Rebinds the implementor to a different borrowed vertex table.
Source§

fn vertex_table_size(&self) -> usize

Returns the number of entries in the vertex table.
Source§

fn get_vertex(&self, id: &PointId) -> Option<Self::Vertex>

Returns the vertex stored at id.
Source§

fn contains_vertex(&self, id: &PointId) -> bool

Returns true if the vertex table contains id.
Source§

fn insert_vertex( &mut self, id: PointId, value: Self::Vertex, ) -> Result<(), ErrorsJSL>

Inserts or replaces the vertex stored at id.
Source§

fn remove_vertex(&mut self, id: &PointId) -> Option<Self::Vertex>

Removes and returns the vertex stored at id, if present.
Source§

impl Hash for Triangle3D

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> IsPolygon<'a, CoordinateVector3D, UnitVector3D> for Triangle3D

Source§

fn vertex_ids(&self) -> Box<dyn Iterator<Item = PointId> + '_>

Returns the ordered point-table ids that define this polygon.
Source§

fn set_vertex_id( &mut self, index: usize, point_id: PointId, ) -> Result<(), ErrorsJSL>

Replaces the point-table id at the given polygon vertex position.
Source§

fn normal(&self) -> UnitVector3D

Returns the polygon normal.
Source§

fn perimeter(&self) -> GeometryMeasure

Returns the polygon perimeter.
Source§

fn area(&self) -> GeometryMeasure

Returns the polygon area.
Source§

fn plane( &self, ) -> impl IsPlane<Point = CoordinateVector3D, Normal = UnitVector3D>

Returns the plane containing the polygon.
Source§

impl<'a> IsTriangle<'a, CoordinateVector3D, UnitVector3D> for Triangle3D

Source§

fn a_id(&self) -> PointId

Returns the point-table id of the first vertex.
Source§

fn set_a_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>

Sets the point-table id of the first vertex.
Source§

fn b_id(&self) -> PointId

Returns the point-table id of the second vertex.
Source§

fn set_b_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>

Sets the point-table id of the second vertex.
Source§

fn c_id(&self) -> PointId

Returns the point-table id of the third vertex.
Source§

fn set_c_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>

Sets the point-table id of the third vertex.
Source§

fn a(&self) -> Option<T>

Resolves and returns the first vertex from the point table.
Source§

fn b(&self) -> Option<T>

Resolves and returns the second vertex from the point table.
Source§

fn c(&self) -> Option<T>

Resolves and returns the third vertex from the point table.
Source§

fn edge_ab(&self) -> Option<<Self as HasEdges>::Edge>

Returns the edge from a to b.
Source§

fn edge_bc(&self) -> Option<<Self as HasEdges>::Edge>

Returns the edge from b to c.
Source§

fn edge_ca(&self) -> Option<<Self as HasEdges>::Edge>

Returns the edge from c to a.
Source§

impl PartialEq for Triangle3D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. 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> 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> MaybeSerialize for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.