pub struct Segment<P: PointTrait> { /* private fields */ }Expand description
Two-point segment.
Mirrors boost::geometry::model::segment<P> from
boost/geometry/geometries/segment.hpp:55-71. The two endpoints
are addressed by index 0 (start) and 1 (end), matching the
traits::indexed_access<segment, 0|1, D> specialisations at
boost/geometry/geometries/segment.hpp:136-169.
Implementations§
Source§impl<P: PointTrait> Segment<P>
impl<P: PointTrait> Segment<P>
Sourcepub const fn new(start: P, end: P) -> Self
pub const fn new(start: P, end: P) -> Self
Construct a segment from its two endpoints.
Mirrors the segment(Point const& p1, Point const& p2)
constructor at boost/geometry/geometries/segment.hpp:67-70.
Sourcepub const fn start(&self) -> &P
pub const fn start(&self) -> &P
Borrow the start endpoint (I = 0).
Mirrors reading s.first on model::segment — the Boost
traits::indexed_access<segment, 0, D>::get(...) accessor at
boost/geometry/geometries/segment.hpp:142-150 returns a
coordinate of that endpoint; this method returns the whole
point.
Trait Implementations§
impl<P: Copy + PointTrait> Copy for Segment<P>
Source§impl<P: PointTrait> Geometry for Segment<P>
Tag this concrete type as a Segment. Mirrors the
traits::tag<model::segment<...>> specialisation at
boost/geometry/geometries/segment.hpp:121-124.
impl<P: PointTrait> Geometry for Segment<P>
Tag this concrete type as a Segment. Mirrors the
traits::tag<model::segment<...>> specialisation at
boost/geometry/geometries/segment.hpp:121-124.
Source§impl<P: PointMut> IndexedAccess for Segment<P>
Two-axis access on the segment. Collapses the
traits::indexed_access<segment, 0|1, D> specialisations at
boost/geometry/geometries/segment.hpp:136-169 into one Rust
impl: the I axis selects the endpoint, D then dispatches to
Point::get / Point::set on that endpoint.
impl<P: PointMut> IndexedAccess for Segment<P>
Two-axis access on the segment. Collapses the
traits::indexed_access<segment, 0|1, D> specialisations at
boost/geometry/geometries/segment.hpp:136-169 into one Rust
impl: the I axis selects the endpoint, D then dispatches to
Point::get / Point::set on that endpoint.
impl<P: PointMut> Segment for Segment<P>
Wire the Segment concept up. The trait body is empty — the
concept is satisfied by the two super-bounds Geometry and
IndexedAccess already proven above.