Struct iron_shapes_booleanop::sweep_line::sweep_event::SweepEvent
source · pub struct SweepEvent<T, Ctr, Property = ()> {
mutable: RefCell<MutablePart<T, Ctr, Property>>,
pub p: Point<T>,
pub original_edge: Edge<T>,
is_left_event: bool,
pub is_upper_boundary: bool,
edge_id: usize,
pub property: Option<Property>,
}Fields§
§mutable: RefCell<MutablePart<T, Ctr, Property>>Mutable part of the sweep event. Borrow checking happens at runtime.
p: Point<T>Point associated with the event. Starting point or end point of the edge.
original_edge: Edge<T>Original edge from which this SweepEvent was created
is_left_event: boolIs p the left endpoint of the edge (p, other.p)?
is_upper_boundary: boolIs this edge an upper boundary of the input polygon?
edge_id: usizeUnique ID of the edge. Used to break ties and guarantee ordering for overlapping edges.
property: Option<Property>Property associated with this event. Only left events store a property. The field is ‘None’ for right events. Can be used to store an ID of the polygon. For binary boolean operations this field is used to store the polygon type (‘clipping’ or ‘subject’).
Implementations§
source§impl<T, Ctr, Property> SweepEvent<T, Ctr, Property>where
T: CoordinateType,
Ctr: Default,
impl<T, Ctr, Property> SweepEvent<T, Ctr, Property>where T: CoordinateType, Ctr: Default,
sourcepub fn new_rc_with_property(
edge_id: usize,
point: Point<T>,
other_point: Point<T>,
is_left_event: bool,
other_event: Weak<SweepEvent<T, Ctr, Property>>,
is_upper_boundary: bool,
property: Option<Property>
) -> Rc<SweepEvent<T, Ctr, Property>>
pub fn new_rc_with_property( edge_id: usize, point: Point<T>, other_point: Point<T>, is_left_event: bool, other_event: Weak<SweepEvent<T, Ctr, Property>>, is_upper_boundary: bool, property: Option<Property> ) -> Rc<SweepEvent<T, Ctr, Property>>
Create a new sweep event wrapped into a Rc.
source§impl<T, Ctr, Property> SweepEvent<T, Ctr, Property>where
T: CoordinateType,
impl<T, Ctr, Property> SweepEvent<T, Ctr, Property>where T: CoordinateType,
pub fn is_left_event(&self) -> bool
sourcepub fn get_other_event(&self) -> Option<Rc<Self>>
pub fn get_other_event(&self) -> Option<Rc<Self>>
Get the event that represents the other end point of this segment.
sourcepub fn set_other_event(&self, other_event: &Rc<Self>)
pub fn set_other_event(&self, other_event: &Rc<Self>)
Set the event that represents the other end point of this segment.
sourcepub fn get_edge(&self) -> Option<Edge<T>>
pub fn get_edge(&self) -> Option<Edge<T>>
Get the segment associated with the event.
The start point will be the point of the first event,
end will be the point of the second event.
sourcepub fn get_original_edge(&self) -> Edge<T>
pub fn get_original_edge(&self) -> Edge<T>
Get the original edge associated with this event. Start and end point are sorted.
pub fn with_counter<F, R>(&self, f: F) -> Rwhere F: FnMut(&Ctr) -> R,
pub fn with_counter_mut<F, R>(&self, f: F) -> Rwhere F: FnMut(&mut Ctr) -> R,
pub fn get_pos(&self) -> usize
pub fn set_pos(&self, pos: usize)
pub fn get_edge_id(&self) -> usize
pub fn get_prev(&self) -> Weak<Self>
pub fn set_prev(&self, prev: Weak<Self>)
sourcepub fn edge_weight(&self) -> i32
pub fn edge_weight(&self) -> i32
Lower boundaries have a weight 1, upper boundaries have a weight -1.
Trait Implementations§
source§impl<T: Clone, Ctr: Clone, Property: Clone> Clone for SweepEvent<T, Ctr, Property>
impl<T: Clone, Ctr: Clone, Property: Clone> Clone for SweepEvent<T, Ctr, Property>
source§fn clone(&self) -> SweepEvent<T, Ctr, Property>
fn clone(&self) -> SweepEvent<T, Ctr, Property>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'a, T, Ctr, P> Ord for SweepEvent<T, Ctr, P>where
T: CoordinateType,
impl<'a, T, Ctr, P> Ord for SweepEvent<T, Ctr, P>where T: CoordinateType,
source§impl<'a, T, Ctr, P> PartialEq<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where
T: CoordinateType,
impl<'a, T, Ctr, P> PartialEq<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where T: CoordinateType,
source§impl<T, Ctr, P> PartialOrd<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where
T: CoordinateType,
impl<T, Ctr, P> PartialOrd<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where T: CoordinateType,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more