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: PThe intersection point. Boost’s turn_info::point.
method: MethodHow 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: boolTrue 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>
impl<P: Point> Turn<P>
Sourcepub fn both(&self, op: OperationType) -> bool
pub fn both(&self, op: OperationType) -> bool
True when both operations carry op. Mirrors
turn_info::both (turn_info.hpp:102-105).
Sourcepub fn has(&self, op: OperationType) -> bool
pub fn has(&self, op: OperationType) -> bool
True when either operation carries op. Mirrors
turn_info::has (turn_info.hpp:107-111).