pub struct LineArrangement {
pub lines: Vec<Line2D>,
pub vertices: Vec<ArrangementVertex>,
}Expand description
An arrangement of lines in the plane.
Stores the vertices (pairwise intersections) and adjacency information.
Fields§
§lines: Vec<Line2D>The input lines.
vertices: Vec<ArrangementVertex>All vertices of the arrangement (pairwise intersections).
Implementations§
Source§impl LineArrangement
impl LineArrangement
Sourcepub fn build(lines: &[Line2D]) -> Self
pub fn build(lines: &[Line2D]) -> Self
Construct the arrangement from a set of lines.
Computes all O(n²) pairwise intersections, merging near-coincident ones.
Sourcepub fn num_vertices(&self) -> usize
pub fn num_vertices(&self) -> usize
Number of vertices (intersection points).
Sourcepub fn euler_face_count(&self) -> usize
pub fn euler_face_count(&self) -> usize
By Euler’s formula V - E + F = 2, compute the number of faces (including the unbounded outer face) from V and E.
For n lines in general position: V = n(n-1)/2, E = n(n+1), F = n(n-1)/2 + n + 1.
Sourcepub fn vertices_on_line(&self, line_idx: usize) -> Vec<usize>
pub fn vertices_on_line(&self, line_idx: usize) -> Vec<usize>
Sort the vertices along a given line by arc-length parameter.
Trait Implementations§
Source§impl Clone for LineArrangement
impl Clone for LineArrangement
Source§fn clone(&self) -> LineArrangement
fn clone(&self) -> LineArrangement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LineArrangement
impl Debug for LineArrangement
Source§impl Default for LineArrangement
impl Default for LineArrangement
Source§fn default() -> LineArrangement
fn default() -> LineArrangement
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LineArrangement
impl RefUnwindSafe for LineArrangement
impl Send for LineArrangement
impl Sync for LineArrangement
impl Unpin for LineArrangement
impl UnsafeUnpin for LineArrangement
impl UnwindSafe for LineArrangement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.