Skip to main content

Turn

Struct Turn 

Source
pub struct Turn<P: Point> {
    pub point: P,
    pub method: Method,
    pub operations: [Operation; 2],
    pub touch_only: bool,
}
Expand description

An intersection point between the two inputs, plus the metadata traversal needs.

Mirrors turn_info in boost/geometry/algorithms/detail/overlay/turn_info.hpp:78-88: the intersection point, the method by which it was formed, and the two operations (one per input geometry). touch_only mirrors Boost’s flag for a touch where the lines do not cross.

§Examples

use geometry_cs::Cartesian;
use geometry_model::Point2D;
use geometry_overlay::turn::info::{
    Method, Operation, RingKind, SegmentId, Turn,
};

type P = Point2D<f64, Cartesian>;
let seg = |src, seg| SegmentId { source_index: src, ring: RingKind::Exterior, segment_index: seg };
let t = Turn {
    point: P::new(1.0, 1.0),
    method: Method::Crosses,
    operations: [Operation::new(seg(0, 3)), Operation::new(seg(1, 5))],
    touch_only: false,
};
assert_eq!(t.method, Method::Crosses);
assert_eq!(t.operations[1].seg_id.segment_index, 5);

Fields§

§point: P

The intersection point. Boost’s turn_info::point.

§method: Method

How the turn was formed. Boost’s turn_info::method.

§operations: [Operation; 2]

One operation per input geometry. Boost’s turn_info::operations[2].

§touch_only: bool

True for a Touch / TouchInterior turn where the two lines do not actually cross. Boost’s turn_info::touch_only.

Implementations§

Source§

impl<P: Point> Turn<P>

Source

pub fn both(&self, op: OperationType) -> bool

True when both operations carry op. Mirrors turn_info::both (turn_info.hpp:102-105).

Source

pub fn has(&self, op: OperationType) -> bool

True when either operation carries op. Mirrors turn_info::has (turn_info.hpp:107-111).

Source

pub fn blocked(&self) -> bool

True when the turn is blocked on both sides. Mirrors turn_info::blocked (turn_info.hpp:118-121).

Trait Implementations§

Source§

impl<P: Clone + Point> Clone for Turn<P>

Source§

fn clone(&self) -> Turn<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<P: Copy + Point> Copy for Turn<P>

Source§

impl<P: Debug + Point> Debug for Turn<P>

Source§

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

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

impl<P: PartialEq + Point> PartialEq for Turn<P>

Source§

fn eq(&self, other: &Turn<P>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<P: PartialEq + Point> StructuralPartialEq for Turn<P>

Auto Trait Implementations§

§

impl<P> Freeze for Turn<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Turn<P>
where P: RefUnwindSafe,

§

impl<P> Send for Turn<P>
where P: Send,

§

impl<P> Sync for Turn<P>
where P: Sync,

§

impl<P> Unpin for Turn<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for Turn<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for Turn<P>
where P: 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> SameAs<T> for T

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.