23 template <
typename T>
constexpr auto my_abs(
const T& value) -> T {
24 return value < 0 ? -value : value;
53 template <
typename U1,
typename U2>
54 constexpr auto overlap(
const U1& lhs,
const U2& rhs) ->
bool {
55 if constexpr (
requires { lhs.overlaps(rhs); }) {
56 return lhs.overlaps(rhs);
57 }
else if constexpr (
requires { rhs.overlaps(lhs); }) {
58 return rhs.overlaps(lhs);
89 template <
typename U1,
typename U2>
90 constexpr auto contain(
const U1& lhs,
const U2& rhs) ->
bool {
91 if constexpr (
requires { lhs.contains(rhs); }) {
92 return lhs.contains(rhs);
93 }
else if constexpr (
requires { rhs.contains(lhs); }) {
127 template <
typename U1,
typename U2>
129 if constexpr (
requires { lhs.intersect_with(rhs); }) {
130 return lhs.intersect_with(rhs);
131 }
else if constexpr (
requires { rhs.intersect_with(lhs); }) {
132 return rhs.intersect_with(lhs);
165 template <
typename U1,
typename U2>
166 constexpr auto min_dist(
const U1& lhs,
const U2& rhs) {
167 if constexpr (
requires { lhs.min_dist_with(rhs); }) {
168 return lhs.min_dist_with(rhs);
169 }
else if constexpr (
requires { rhs.min_dist_with(lhs); }) {
170 return rhs.min_dist_with(lhs);
194 template <
typename U1,
typename U2>
196 if constexpr (
requires { lhs.min_dist_change_with(rhs); }) {
197 return lhs.min_dist_change_with(rhs);
198 }
else if constexpr (
requires { rhs.min_dist_change_with(lhs); }) {
199 return rhs.min_dist_change_with(lhs);
227 template <
typename U1,
typename U2>
constexpr auto nearest(
const U1& lhs,
const U2& rhs) {
228 if constexpr (
requires { lhs.nearest_to(rhs); }) {
229 return lhs.nearest_to(rhs);
245 template <
typename U>
constexpr auto measure_of(
const U& obj) {
246 if constexpr (
requires { obj.measure(); }) {
247 return obj.measure();
263 template <
typename U>
constexpr auto center(
const U& obj) {
264 if constexpr (
requires { obj.get_center(); }) {
265 return obj.get_center();
281 template <
typename U>
constexpr auto lower(
const U& obj) {
282 if constexpr (
requires { obj.lower_corner(); }) {
283 return obj.lower_corner();
299 template <
typename U>
constexpr auto upper(
const U& obj) {
300 if constexpr (
requires { obj.upper_corner(); }) {
301 return obj.upper_corner();
Definition svg_utils.hpp:12
constexpr auto contain(const U1 &lhs, const U2 &rhs) -> bool
Check if one object contains another object.
Definition generic.hpp:90
constexpr auto nearest(const U1 &lhs, const U2 &rhs)
Returns the nearest point on lhs to rhs.
Definition generic.hpp:227
constexpr auto intersection(const U1 &lhs, const U2 &rhs)
Computes the intersection of two objects.
Definition generic.hpp:128
constexpr auto min_dist_change(U1 &lhs, U2 &rhs)
Calculates the minimum distance between two objects lhs and rhs, with the ability to handle a change ...
Definition generic.hpp:195
constexpr auto min_dist(const U1 &lhs, const U2 &rhs)
Calculates the minimum distance between two objects lhs and rhs.
Definition generic.hpp:166
constexpr auto lower(const U &obj)
Calculates the lower corner of an object.
Definition generic.hpp:281
constexpr auto my_abs(const T &value) -> T
Compute the absolute value of a number.
Definition generic.hpp:23
constexpr auto overlap(const U1 &lhs, const U2 &rhs) -> bool
Checks if two objects overlap.
Definition generic.hpp:54
constexpr auto measure_of(const U &obj)
Calculates the measure (length, area, etc.) of an object.
Definition generic.hpp:245
constexpr auto upper(const U &obj)
Calculates the upper corner of an object.
Definition generic.hpp:299
constexpr auto center(const U &obj)
Calculates the center of an object.
Definition generic.hpp:263