pub struct PolygonFace2D { /* private fields */ }Expand description
Concrete 2D polygon face backed by ordered point ids.
Implementations§
Source§impl PolygonFace2D
impl PolygonFace2D
Sourcepub fn new(
vertex_ids: Vec<PointId>,
vertex_table: SharedGeometryTable<PointId, CoordinateVector2D>,
) -> Self
pub fn new( vertex_ids: Vec<PointId>, vertex_table: SharedGeometryTable<PointId, CoordinateVector2D>, ) -> Self
Creates a polygon face from ordered point ids and a shared point table.
Sourcepub fn triangulate(&self) -> Vec<Triangle2D>
pub fn triangulate(&self) -> Vec<Triangle2D>
Decomposes the polygon into a fan of triangles rooted at the first vertex.
Sourcepub fn from_triangles(triangles: &[Triangle2D]) -> Result<Self, ErrorsJSL>
pub fn from_triangles(triangles: &[Triangle2D]) -> Result<Self, ErrorsJSL>
Composes a polygon from a set of triangles that share a common boundary.
Trait Implementations§
Source§impl CanMirror for PolygonFace2D
impl CanMirror for PolygonFace2D
Source§impl CanRotate for PolygonFace2D
impl CanRotate for PolygonFace2D
Source§impl CanShear for PolygonFace2D
impl CanShear for PolygonFace2D
Source§impl CanTranslate for PolygonFace2D
impl CanTranslate for PolygonFace2D
Source§impl Clone for PolygonFace2D
impl Clone for PolygonFace2D
Source§impl Debug for PolygonFace2D
impl Debug for PolygonFace2D
Source§impl Display for PolygonFace2D
impl Display for PolygonFace2D
impl Eq for PolygonFace2D
impl GeometricPrimitive for PolygonFace2D
impl GeometricPrimitive2D for PolygonFace2D
Source§impl HasCentroid for PolygonFace2D
impl HasCentroid for PolygonFace2D
Source§impl HasEdges for PolygonFace2D
impl HasEdges for PolygonFace2D
Source§impl HasMeasure for PolygonFace2D
impl HasMeasure for PolygonFace2D
Source§fn measure(&self) -> GeometryMeasure
fn measure(&self) -> GeometryMeasure
Returns the primitive’s primary measure, such as length or area.
Source§impl HasOrientation for PolygonFace2D
impl HasOrientation for PolygonFace2D
Source§fn orientation(&self) -> Orientation2D
fn orientation(&self) -> Orientation2D
Returns the primitive orientation.
Source§impl<'a> HasVertices<'a> for PolygonFace2D
impl<'a> HasVertices<'a> for PolygonFace2D
Source§type Vertex = CoordinateVector2D
type Vertex = CoordinateVector2D
Point primitive stored in the vertex table.
Source§type VertexTable = Rc<RefCell<HashGeometryTable<PointId, CoordinateVector2D>>>
type VertexTable = Rc<RefCell<HashGeometryTable<PointId, CoordinateVector2D>>>
Borrowed point-table type.
Source§fn vertex_table(&self) -> &Self::VertexTable
fn vertex_table(&self) -> &Self::VertexTable
Returns an immutable reference to the vertex table.
Source§fn vertex_table_mut(&mut self) -> &mut Self::VertexTable
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)
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
fn vertex_table_size(&self) -> usize
Returns the number of entries in the vertex table.
Source§fn contains_vertex(&self, id: &PointId) -> bool
fn contains_vertex(&self, id: &PointId) -> bool
Returns
true if the vertex table contains id.Source§impl Hash for PolygonFace2D
impl Hash for PolygonFace2D
Source§impl<'a> IsPolygon<'a, CoordinateVector2D, UnitVector2D> for PolygonFace2D
impl<'a> IsPolygon<'a, CoordinateVector2D, UnitVector2D> for PolygonFace2D
Source§fn vertex_ids(&self) -> Box<dyn Iterator<Item = PointId> + '_>
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>
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) -> UnitVector2D
fn normal(&self) -> UnitVector2D
Returns the polygon normal.
Source§fn perimeter(&self) -> GeometryMeasure
fn perimeter(&self) -> GeometryMeasure
Returns the polygon perimeter.
Source§fn area(&self) -> GeometryMeasure
fn area(&self) -> GeometryMeasure
Returns the polygon area.
Source§fn plane(
&self,
) -> impl IsPlane<Point = CoordinateVector2D, Normal = UnitVector2D>
fn plane( &self, ) -> impl IsPlane<Point = CoordinateVector2D, Normal = UnitVector2D>
Returns the plane containing the polygon.
Auto Trait Implementations§
impl !RefUnwindSafe for PolygonFace2D
impl !Send for PolygonFace2D
impl !Sync for PolygonFace2D
impl !UnwindSafe for PolygonFace2D
impl Freeze for PolygonFace2D
impl Unpin for PolygonFace2D
impl UnsafeUnpin for PolygonFace2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more