25template <
class Number,
class Label>
26template <
class ResultNumber>
39template <
class Number,
class Label>
40template <
class ResultNumber>
42 assert(
x() != 0 ||
y() != 0);
67template <
class Po
intType,
class LabelType>
68template <
class ResultNumber>
70 ResultNumber qx =
static_cast<ResultNumber
>(
min().x());
71 ResultNumber qy =
static_cast<ResultNumber
>(
min().y());
72 ResultNumber px =
static_cast<ResultNumber
>(
max().x());
73 ResultNumber py =
static_cast<ResultNumber
>(
max().y());
75 ResultNumber den = px - qx;
76 ResultNumber anum = py - qy;
77 ResultNumber bnum = anum * px - py * den;
78 return std::make_tuple(anum, bnum, den);
87template <
class Po
intType,
class LabelType>
88template <
class ResultNumber>
89constexpr auto Line<PointType, LabelType>::polarCoordinates()
const {
90 ResultNumber qx =
static_cast<ResultNumber
>(min().x());
91 ResultNumber qy =
static_cast<ResultNumber
>(min().y());
92 ResultNumber px =
static_cast<ResultNumber
>(max().x());
93 ResultNumber py =
static_cast<ResultNumber
>(max().y());
95 ResultNumber den = px * qy - py * qx;
96 ResultNumber anum = qy - py;
97 ResultNumber bnum = px - qx;
98 return std::make_tuple(anum, bnum, den);
107template <
class Po
intType,
class LabelType>
108template <
class ResultNumber>
123template <
class Po
intType,
class LabelType>
124template <
class ResultNumber>
127 const auto [anum, bnum, den] = polarCoordinates<ResultNumber>();
Bounding-box and rectangle-boundary operations.
Definition arrangement.hpp:67
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
constexpr std::partial_ordering crossSign(const Point< UNumber, ULabel > &u, const Point< VNumber, VLabel > &v)
Classifies the turn from one vector to another.
Definition orientation.hpp:583
Unoriented infinite line.
Definition line.hpp:52
constexpr auto dualCoordinates() const
Returns normalized dual-line coordinates for the supporting line.
Definition duality.hpp:69
constexpr const PointType & max() const
Returns the largest stored defining point.
Definition line.hpp:189
constexpr bool isVertical() const
Returns whether the line is vertical.
Definition predicates.hpp:461
constexpr const PointType & min() const
Returns the smallest stored defining point.
Definition line.hpp:180
constexpr Point< ResultNumber, typename PointType::LabelType > polar() const
Returns the polar point.
Definition duality.hpp:125
constexpr Point< ResultNumber, typename PointType::LabelType > dual() const
Returns the dual point.
Definition duality.hpp:109
Two-dimensional point with optional label payload.
Definition point.hpp:129
constexpr Point()=default
constexpr Line< Point< ResultNumber, LabelType > > dual() const
Returns the dual Line.
constexpr const NumberType & y() const
Returns the y coordinate.
Definition point.hpp:205
constexpr Line< Point< ResultNumber, LabelType > > polar() const
Returns the polar Line.