63 constexpr ManhattanArc(T1 xcoord, T2 ycoord) :
impl{std::move(xcoord), std::move(ycoord)} {}
108 template <
typename U1,
typename U2>
110 return this->impl == rhs.impl;
126 template <
typename U1,
typename U2>
128 return this->impl != rhs.impl;
143 template <
typename U1,
typename U2>
145 return this->impl.
overlaps(other.impl);
164 template <
typename U1,
typename U2>
168 return ManhattanArc<
decltype(xcoord),
decltype(ycoord)>{std::move(xcoord),
186 template <
typename U1,
typename U2>
203 template <
typename R>
207 return ManhattanArc<
decltype(xcoord),
decltype(ycoord)>{std::move(xcoord),
217 auto m =
impl.get_center();
218 return m.inv_rotates();
227 auto m =
impl.lower_corner();
228 return m.inv_rotates();
237 auto m =
impl.upper_corner();
238 return m.inv_rotates();
247 template <
typename U1,
typename U2>
251 auto trr = ms.enlarge_with(distance);
252 auto lb =
impl.lower_corner();
253 auto ub =
impl.upper_corner();
254 auto m =
impl.get_center();
255 if (trr.impl.contains(lb)) {
257 }
else if (trr.impl.contains(ub)) {
260 return m.inv_rotates();
270 template <
typename U1,
typename U2>
275 auto localimpl = trr1.impl.intersect_with(trr2.impl);
276 auto x = localimpl.xcoord();
277 auto y = localimpl.ycoord();
278 return ManhattanArc<
decltype(x),
decltype(y)>{std::move(x), std::move(y)};
293 template <
class Stream>
295 out <<
"/" << manhattan_arc.impl.xcoord() <<
", " << manhattan_arc.impl.ycoord() <<
"/";
Merging Object (for deferred-merge embedding (DME) algorithm)
Definition manhattan_arc.hpp:41
static constexpr auto from_point(const Point< T1, T2 > &pt)
Construct a ManhattanArc from a Point.
Definition manhattan_arc.hpp:71
constexpr auto merge_with(const ManhattanArc< U1, U2 > &other, int alpha) const
Merge with another ManhattanArc using a given alpha.
Definition manhattan_arc.hpp:271
constexpr auto enlarge_with(const R &alpha) const
Enlarge the ManhattanArc object by a given scale factor.
Definition manhattan_arc.hpp:204
constexpr auto operator==(const ManhattanArc< U1, U2 > &rhs) const -> bool
Compares two ManhattanArc objects for equality.
Definition manhattan_arc.hpp:109
constexpr auto get_center() const
Calculate the center of the ManhattanArc.
Definition manhattan_arc.hpp:216
constexpr auto operator!=(const ManhattanArc< U1, U2 > &rhs) const -> bool
Not equal to.
Definition manhattan_arc.hpp:127
Point< T1, T2 > impl
Definition manhattan_arc.hpp:43
constexpr auto get_lower_corner() const
Calculate the lower corner of the ManhattanArc.
Definition manhattan_arc.hpp:226
constexpr auto intersect_with(const ManhattanArc< U1, U2 > &other) const
Compute the intersection of two ManhattanArc objects.
Definition manhattan_arc.hpp:165
constexpr auto overlaps(const ManhattanArc< U1, U2 > &other) const -> bool
Check if two ManhattanArc objects overlap.
Definition manhattan_arc.hpp:144
constexpr auto nearest_point_to(const Point< U1, U2 > &other) const
Find the nearest point to a given Point.
Definition manhattan_arc.hpp:248
friend auto operator<<(Stream &out, const ManhattanArc &manhattan_arc) -> Stream &
Overload the stream insertion operator << to output a ManhattanArc object.
Definition manhattan_arc.hpp:294
constexpr ManhattanArc(T1 xcoord, T2 ycoord)
Construct a new ManhattanArc object.
Definition manhattan_arc.hpp:63
constexpr auto get_upper_corner() const
Calculate the upper corner of the ManhattanArc.
Definition manhattan_arc.hpp:236
constexpr ManhattanArc()
Default constructor.
Definition manhattan_arc.hpp:49
constexpr auto min_dist_with(const ManhattanArc< U1, U2 > &other) const
Compute the minimum distance between the x and y coordinates of two ManhattanArc objects.
Definition manhattan_arc.hpp:187
static constexpr auto construct(const T1 &xcoord, const T2 &ycoord) -> ManhattanArc
Construct a new ManhattanArc object from the given x and y coordinates.
Definition manhattan_arc.hpp:88
Point.
Definition point.hpp:30
constexpr auto rotates() const -> Point< T1, T2 >
Rotate the point by 45 degrees (used for ManhattanArc).
Definition point.hpp:378
constexpr auto xcoord() const -> const T1 &
Gets the x coordinate of this Point.
Definition point.hpp:72
constexpr auto ycoord() const -> const T2 &
Gets the y coordinate of this Point.
Definition point.hpp:78
constexpr auto overlaps(const Point< U1, U2 > &other_point) const -> bool
Definition point.hpp:255
Interval (range) template class with arithmetic and set operations.
Definition svg_utils.hpp:12
constexpr auto enlarge(const U1 &left, const U2 &right)
Enlarges an interval or scalar value by adding and subtracting a given value.
Definition interval.hpp:579
constexpr auto intersection(const U1 &lhs, const U2 &rhs)
Computes the intersection of two objects.
Definition generic.hpp:128
constexpr auto min_dist(const U1 &lhs, const U2 &rhs)
Calculates the minimum distance between two objects lhs and rhs.
Definition generic.hpp:166
2D Point template class supporting intervals, arithmetic, and geometric queries.