6namespace fishnet::geometry::__impl{
10 using numeric_type = T;
11 constexpr static GeometryType type = GeometryType::SEGMENT;
12 PointStub<T> p()
const{
13 return PointStub<T>(0,0);
15 PointStub<T> q()
const{
16 return PointStub<T>(1,1);
18 SegmentStub(PointStub<T> p, PointStub<T> q){}
19 bool operator==(
const SegmentStub & other)
const noexcept{
22 PointStub<T> direction()
const{
23 return PointStub<T>(1,1);
25 double length()
const{
28 PointStub<T> upperEndpoint()
const{
29 return PointStub<T>(0,0);
31 PointStub<T> lowerEndpoint()
const{
32 return PointStub<T>(0,0);
34 PointStub<T> leftEndpoint()
const{
35 return PointStub<T>(0,0);
37 PointStub<T> rightEndpoint()
const{
38 return PointStub<T>(0,0);
40 bool isEndpoint(PointStub<T> point)
const{
46 bool overlaps(SegmentStub segment)
const{
49 bool contains(PointStub<T> point)
const{
52 bool contains(SegmentStub segment)
const{
55 bool touches(SegmentStub segment)
const{
58 double distance(PointStub<T> point)
const{
61 double distance(SegmentStub segment)
const{
64 bool isParallel(LineStub<T> line)
const{
67 bool isParallel(SegmentStub segment)
const{
70 bool intersects(LineStub<T> line)
const{
73 bool intersects(SegmentStub segment)
const{
76 std::optional<PointStub<T>> intersection(LineStub<T> line)
const{
79 std::optional<PointStub<T>> intersection(SegmentStub segment)
const{
82 LineStub<T> toLine()
const{
83 return LineStub(p(),q());
85 SegmentStub flip()
const{
86 return SegmentStub(q(),p());
88 size_t hash() const noexcept {
91 std::string toString()
const{
106 const std::remove_cvref_t<S> & segment,
107 const __impl::SegmentStub<typename std::remove_cvref_t<S>::numeric_type> & otherSegment,
108 const __impl::PointStub<typename std::remove_cvref_t<S>::numeric_type> & point,
109 const __impl::LineStub<typename std::remove_cvref_t<S>::numeric_type> & line
113 {segment.direction()} ->
IPoint;
114 {segment.length()} -> std::convertible_to<double>;
115 {segment.upperEndpoint()} ->
IPoint;
116 {segment.lowerEndpoint()} ->
IPoint;
117 {segment.leftEndpoint()} ->
IPoint;
118 {segment.rightEndpoint()} ->
IPoint;
119 {segment.isEndpoint(point)} -> std::same_as<bool>;
120 {segment.isValid()} -> std::same_as<bool>;
121 {segment.overlaps(otherSegment)} -> std::same_as<bool>;
122 {segment.contains(point)} -> std::same_as<bool>;
123 {segment.contains(otherSegment)} -> std::same_as<bool>;
124 {segment.touches(otherSegment)} -> std::same_as<bool>;
125 {segment.distance(point)} -> std::convertible_to<double>;
126 {segment.distance(otherSegment)} -> std::convertible_to<double>;
127 {segment.isParallel(line)} -> std::same_as<bool>;
128 {segment.isParallel(otherSegment)} -> std::same_as<bool>;
129 {segment.intersects(line)} -> std::same_as<bool>;
130 {segment.intersects(otherSegment)} -> std::same_as<bool>;
133 {segment.toLine()} ->
ILine;
134 {segment.flip()} -> std::same_as<std::remove_cvref_t<S>>;
IPolygon implementation backed by an OGRPolygon.
Definition OGRPolygonAdapter.hpp:22
Definition GeometryBase.hpp:11
Interface for a line A line is defined through two points p and q, defining a direction vector.
Definition ILine.hpp:76
Definition IPoint.hpp:135
Interface for a point.
Definition IPoint.hpp:92
Interface for a segment A segment is formed between two points p and q, containing only the points on...
Definition ISegment.hpp:105
Definition ISegment.hpp:141
Definition BoundingBoxWrapper.hpp:5