pub struct Loop {
pub segments: Vec<Segment>,
}Expand description
A closed, directed sequence of segments (each ends where the next starts).
Fields§
§segments: Vec<Segment>Implementations§
Source§impl Loop
impl Loop
pub fn new(segments: Vec<Segment>) -> Self
Sourcepub fn polygon(points: &[Point2]) -> Self
pub fn polygon(points: &[Point2]) -> Self
A closed polygon through points (last joins back to first).
Sourcepub fn rectangle(min: Point2, max: Point2) -> Self
pub fn rectangle(min: Point2, max: Point2) -> Self
An axis-aligned rectangle, counter-clockwise.
Sourcepub fn circle(center: Point2, radius: f64, ccw: bool) -> Self
pub fn circle(center: Point2, radius: f64, ccw: bool) -> Self
A full circle as four quadrant arcs, counter-clockwise when ccw.
Sourcepub fn stadium(a: Point2, b: Point2, radius: f64) -> Self
pub fn stadium(a: Point2, b: Point2, radius: f64) -> Self
A stadium (slot) around the centre line a-b with the given
radius, counter-clockwise.
pub fn reversed(&self) -> Self
Sourcepub fn signed_area(&self) -> f64
pub fn signed_area(&self) -> f64
Shoelace area of the chords plus the arc bulges; positive counter-clockwise.
pub fn is_ccw(&self) -> bool
pub fn length(&self) -> f64
pub fn bounds(&self) -> (Point2, Point2)
Sourcepub fn discretize(&self, tol: f64) -> Vec<Point2>
pub fn discretize(&self, tol: f64) -> Vec<Point2>
Chord points around the loop (first point not repeated at the end).
Sourcepub fn winding(&self, p: Point2, tol: &Tolerance) -> i32
pub fn winding(&self, p: Point2, tol: &Tolerance) -> i32
Winding number of p about this loop alone.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Loop
impl<'de> Deserialize<'de> for Loop
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Loop
Auto Trait Implementations§
impl Forget for Loop
impl Freeze for Loop
impl Move for Loop
impl RefUnwindSafe for Loop
impl Send for Loop
impl Sync for Loop
impl Unpin for Loop
impl UnsafeUnpin for Loop
impl UnwindSafe for Loop
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