Skip to main content

Intersection

Struct Intersection 

Source
pub struct Intersection<L, R> {
    pub point: [f64; 2],
    pub left: L,
    pub right: R,
}
Expand description

Intersection point and indices of the “left” and “right” composite types.

This struct is used as the Iterator::Item of the iterators created by the intersection methods of the Composite trait. It contains the intersection point itself as well as the segment keys of the involved composite types. These keys (SegmentIdx or ShapeIdx) can be used to retrieve the segments from the composite types where the intersection occurred (see Composite::segment).

Fields§

§point: [f64; 2]

The intersection point itself.

§left: L

Key to retrieve the intersected segment of the “left” side composite (self for the intersection functions in Composite).

§right: R

Key to retrieve the intersected segment of the “right” side composite (the second argument of the intersection functions in Composite).

Implementations§

Source§

impl<L, R> Intersection<L, R>

Source

pub fn switch(self) -> Intersection<R, L>

Switches the left and ``rightfields ofSelf`.

Source§

impl Intersection<ShapeIdx, ShapeIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&Shape, &Style)>, right: Option<(&Shape, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between two Shapes onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<ShapeIdx, SegmentIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&Shape, &Style)>, right: Option<(&SegmentChain, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a Shape and a SegmentChain onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<SegmentIdx, ShapeIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&SegmentChain, &Style)>, right: Option<(&Shape, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a SegmentChain and a Shape onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<ShapeIdx, ()>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&Shape, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a Shape and a Primitive onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<(), ShapeIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, right: Option<(&Shape, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a Primitive and a Shape onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<SegmentIdx, SegmentIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&SegmentChain, &Style)>, right: Option<(&SegmentChain, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between two SegmentChains onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<SegmentIdx, ()>

Source

pub fn draw( &self, style: &IntersectionStyle, left: Option<(&SegmentChain, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a SegmentChain and a Primitive onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<(), SegmentIdx>

Source

pub fn draw( &self, style: &IntersectionStyle, right: Option<(&SegmentChain, &Style)>, context: &Context, ) -> Result<(), Error>

Draws the intersection between a Primitive and a SegmentChain onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Source§

impl Intersection<(), ()>

Source

pub fn draw( &self, style: &IntersectionStyle, context: &Context, ) -> Result<(), Error>

Draws the intersection between two Primitives onto the given cairo::Context using the given IntersectionStyle.

Optionally, the intersected segments of the involved composite types SegmentChain, Contour or Shape can also be drawn onto the canvas if the corresponding (&Composite, &Style) tuple is provided. See the module documentation for an example.

Trait Implementations§

Source§

impl<L: PartialEq, R: PartialEq> AbsDiffEq for Intersection<L, R>

Source§

type Epsilon = f64

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> f64

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: f64) -> bool

A test for equality that uses the absolute difference to compute the approximimate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<L: Clone, R: Clone> Clone for Intersection<L, R>

Source§

fn clone(&self) -> Intersection<L, R>

Returns a duplicate 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<L: Debug, R: Debug> Debug for Intersection<L, R>

Source§

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

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

impl From<[f64; 2]> for Intersection<(), ()>

Source§

fn from(value: [f64; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<Intersection<(), ()>> for [f64; 2]

Source§

fn from(value: Intersection<(), ()>) -> Self

Converts to this type from the input type.
Source§

impl<L: PartialEq, R: PartialEq> PartialEq for Intersection<L, R>

Source§

fn eq(&self, other: &Intersection<L, R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: PartialEq, R: PartialEq> RelativeEq for Intersection<L, R>

Source§

fn default_max_relative() -> f64

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq(&self, other: &Self, epsilon: f64, max_relative: f64) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<L: PartialEq, R: PartialEq> UlpsEq for Intersection<L, R>

Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: f64, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl<L: Copy, R: Copy> Copy for Intersection<L, R>

Source§

impl<L, R> StructuralPartialEq for Intersection<L, R>

Auto Trait Implementations§

§

impl<L, R> Freeze for Intersection<L, R>
where L: Freeze, R: Freeze,

§

impl<L, R> RefUnwindSafe for Intersection<L, R>

§

impl<L, R> Send for Intersection<L, R>
where L: Send, R: Send,

§

impl<L, R> Sync for Intersection<L, R>
where L: Sync, R: Sync,

§

impl<L, R> Unpin for Intersection<L, R>
where L: Unpin, R: Unpin,

§

impl<L, R> UnsafeUnpin for Intersection<L, R>
where L: UnsafeUnpin, R: UnsafeUnpin,

§

impl<L, R> UnwindSafe for Intersection<L, R>
where L: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.