pub struct Line2D { /* private fields */ }Expand description
Concrete 2D line implementation backed by point ids and a shared point table.
Implementations§
Source§impl Line2D
impl Line2D
Sourcepub fn new(
head_id: PointId,
tail_id: PointId,
vertex_table: SharedGeometryTable<PointId, CoordinateVector2D>,
) -> Self
pub fn new( head_id: PointId, tail_id: PointId, vertex_table: SharedGeometryTable<PointId, CoordinateVector2D>, ) -> Self
Creates a line from two point ids and a shared point table.
Trait Implementations§
impl Eq for Line2D
impl GeometricPrimitive for Line2D
impl GeometricPrimitive2D for Line2D
Source§impl<'a> HasVertices<'a> for Line2D
impl<'a> HasVertices<'a> for Line2D
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<'a> IsLine<'a, CoordinateVector2D> for Line2D
impl<'a> IsLine<'a, CoordinateVector2D> for Line2D
Source§fn set_head_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>
fn set_head_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>
Sets the point-table id of the first endpoint.
Source§fn set_tail_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>
fn set_tail_id(&mut self, point_id: PointId) -> Result<(), ErrorsJSL>
Sets the point-table id of the second endpoint.
Source§fn length(&self) -> GeometryMeasure
fn length(&self) -> GeometryMeasure
Returns the Euclidean length of the line.
Source§fn midpoint(&self) -> Option<CoordinateVector2D>
fn midpoint(&self) -> Option<CoordinateVector2D>
Returns the midpoint of the line, if it can be derived from the point table.
Source§fn direction(&self) -> impl IsUnitVector
fn direction(&self) -> impl IsUnitVector
Returns the line direction as a unit vector.
Auto Trait Implementations§
impl !RefUnwindSafe for Line2D
impl !Send for Line2D
impl !Sync for Line2D
impl !UnwindSafe for Line2D
impl Freeze for Line2D
impl Unpin for Line2D
impl UnsafeUnpin for Line2D
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