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: bool

Is p the left endpoint of the edge (p, other.p)?

§is_upper_boundary: bool

Is this edge an upper boundary of the input polygon?

§edge_id: usize

Unique 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,

source

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,

source

pub fn is_left_event(&self) -> bool

source

pub fn get_other_event(&self) -> Option<Rc<Self>>

Get the event that represents the other end point of this segment.

source

pub fn set_other_event(&self, other_event: &Rc<Self>)

Set the event that represents the other end point of this segment.

source

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.

source

pub fn get_original_edge(&self) -> Edge<T>

Get the original edge associated with this event. Start and end point are sorted.

source

pub fn with_counter<F, R>(&self, f: F) -> Rwhere F: FnMut(&Ctr) -> R,

source

pub fn with_counter_mut<F, R>(&self, f: F) -> Rwhere F: FnMut(&mut Ctr) -> R,

source

pub fn get_pos(&self) -> usize

source

pub fn set_pos(&self, pos: usize)

source

pub fn get_edge_id(&self) -> usize

source

pub fn get_prev(&self) -> Weak<Self>

source

pub fn set_prev(&self, prev: Weak<Self>)

source

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>

source§

fn clone(&self) -> SweepEvent<T, Ctr, Property>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, Ctr: Debug, Property: Debug> Debug for SweepEvent<T, Ctr, Property>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, T, Ctr, P> Ord for SweepEvent<T, Ctr, P>where T: CoordinateType,

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<'a, T, Ctr, P> PartialEq<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where T: CoordinateType,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, Ctr, P> PartialOrd<SweepEvent<T, Ctr, P>> for SweepEvent<T, Ctr, P>where T: CoordinateType,

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T, Ctr, P> Eq for SweepEvent<T, Ctr, P>where T: CoordinateType,

Auto Trait Implementations§

§

impl<T, Ctr, Property = ()> !RefUnwindSafe for SweepEvent<T, Ctr, Property>

§

impl<T, Ctr, Property = ()> !Send for SweepEvent<T, Ctr, Property>

§

impl<T, Ctr, Property = ()> !Sync for SweepEvent<T, Ctr, Property>

§

impl<T, Ctr, Property> Unpin for SweepEvent<T, Ctr, Property>where Ctr: Unpin, Property: Unpin, T: Unpin,

§

impl<T, Ctr, Property = ()> !UnwindSafe for SweepEvent<T, Ctr, Property>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.