14 template <
class T> T abs(
const T &t) {
18 template <
class T> T max0(
const T &t1,
const T &t2) {
22 template <
class T> T min0(
const T &t1,
const T &t2) {
34 template <class T> class Vector2 {
37 static constexpr uint32 vdim = 2;
42 constexpr Vector2() : a_({initVal<T>(),initVal<T>()}) { }
47 constexpr Vector2(
const Vector2<T> &v) : a_(v.a_) { }
49 constexpr Vector2(
const T &x,
const T &y) : a_({x,y}) { }
51 explicit constexpr Vector2(
const T &t) : a_({t,t}) { }
52 constexpr
const Vector2<T> &operator=(
const Vector2<T> &in) { a_ = in.a_;
return *
this; }
58 constexpr
const T &x()
const {
return a_[0]; }
60 constexpr
const T &y()
const {
return a_[1]; }
62 constexpr
const T &dof(
unsigned u)
const {
return a_[u]; }
64 T &rx() {
return a_[0]; }
66 T &ry() {
return a_[1]; }
68 T &rdof(
unsigned u) {
return a_[u]; }
70 constexpr
const T &operator[](
unsigned u)
const {
return dof(u); }
71 T & operator[](
unsigned u) {
return rdof(u); }
72 template <std::
size_t N> constexpr decltype(
auto) get()
const {
73 static_assert(N<2,
"Index out of range");
79 constexpr T fsum()
const {
return (std::abs(x())+std::abs(y())); }
81 constexpr T sum()
const {
return x() + y(); }
83 constexpr T mag2()
const {
return (x()*x()+y()*y()); }
85 constexpr T mag()
const {
return to<T>(std::sqrt(to<double>(mag2()))); }
87 constexpr T area()
const {
return (x()*y()); }
89 constexpr T volume()
const {
return area(); }
91 constexpr T spread()
const {
return (y() -x()); }
93 constexpr Vector2<T> unit()
const { Vector2<T> v(*
this); T m(v.mag());
if (m) v/=m;
return v; }
95 constexpr Vector2<T> abs()
const { Vector2<T> v(std::abs(x()),std::abs(y()));
return v; }
97 constexpr
void fill(
const T &d) { rx()=d; ry()=d; }
99 constexpr T maxComp()
const {
return std::max(x(),y()); }
101 constexpr T minComp()
const {
return std::min(x(),y()); }
103 constexpr
unsigned maxCompIndex()
const {
return x() > y() ? 0 : 1; }
105 constexpr
unsigned minCompIndex()
const {
return x() < y() ? 0 : 1; }
107 constexpr
const Vector2<T> &safeDivE(
const Vector2<T> &v) { rx()=
::safeDiv(x(),v.x()); ry() =
::safeDiv(y(),v.y());
return *
this; }
109 constexpr
const Vector2<T>
safeDiv(
const Vector2<T> &v) { Vector2<T> ret(::
safeDiv(x(),v.x()),::
safeDiv(y(),v.y()));
return ret; }
112 constexpr
bool operator==(
const Vector2<T> &v)
const {
return ((x()==v.x())&&(y()==v.y())); }
114 constexpr
bool operator!=(
const Vector2<T> &v)
const {
return ((x()!=v.x())||(y()!=v.y())); }
116 constexpr
bool operator<(
const Vector2<T> &v)
const {
if (x()!=v.x())
return x()<v.x();
return y()<v.y(); }
118 constexpr
bool operator>(
const Vector2<T> &v)
const {
if (x()!=v.x())
return x()>v.x();
return y()>v.y(); }
122 constexpr
const Vector2<T> &operator+=(
const Vector2<T> &v) { rx()+=v.x(); ry()+=v.y();
return *
this; }
123 constexpr
const Vector2<T> &operator-=(
const Vector2<T> &v) { rx()-=v.x(); ry()-=v.y();
return *
this; }
124 constexpr
const Vector2<T> &operator*=(
const Vector2<T> &v) { rx()*=v.x(); ry()*=v.y();
return *
this; }
125 constexpr
const Vector2<T> &operator*=(
const T &t) { rx()*=t; ry()*=t;
return *
this; }
126 constexpr
const Vector2<T> &operator/=(
const Vector2<T> &v) { rx()/=v.x(); ry()/=v.y();
return *
this; }
127 constexpr
const Vector2<T> &operator/=(
const T &t) { rx()/=t; ry()/=t;
return *
this; }
131 constexpr Vector2<T> operator+(
const Vector2<T> &v)
const { Vector2<T> out(x()+v.x(),y()+v.y());
return out; }
132 constexpr Vector2<T> operator-(
const Vector2<T> &v)
const { Vector2<T> out(x()-v.x(),y()-v.y());
return out; }
133 constexpr Vector2<T>
operator*(
const Vector2<T> &v)
const { Vector2<T> out(x()*v.x(),y()*v.y());
return out; }
134 constexpr Vector2<T>
operator*(
const T &t)
const { Vector2<T> out(x()*t,y()*t);
return out; }
135 constexpr Vector2<T> operator/(
const Vector2<T> &v)
const { Vector2<T> out(x()/v.x(),y()/v.y());
return out; }
136 constexpr Vector2<T> operator/(
const T &t)
const { Vector2<T> out(x()/t,y()/t);
return out; }
139 constexpr T
operator|(
const Vector2<T> &v)
const {
return (x()*v.x()+y()*v.y()); }
143 constexpr
const Vector2<T> &expandToInclude(
const T &t) { rx() = std::min(x(),t); ry() = std::max(y(),t);
return *
this; }
145 constexpr
const Vector2<T> &expandToInclude(
const Vector2<T> &v) { rx() = std::min(x(),v.minComp()); ry() = std::max(y(),v.maxComp());
return *
this; }
147 constexpr Vector2<T> expandedToInclude(
const T &t)
const { Vector2<T> ret(*
this); ret.expandToInclude(t);
return ret; }
149 constexpr Vector2<T> expandedToInclude(
const Vector2<T> &v)
const { Vector2<T> ret(*
this); ret.expandToInclude(v);
return ret; }
151 constexpr
bool contains(
const T &t)
const {
if (t<x())
return false;
if (t>y())
return false;
return true; }
163 template <class T> class Vector3 {
166 static constexpr uint32 vdim = 3;
170 constexpr Vector3() : a_({initVal<T>(),initVal<T>(),initVal<T>()}) { }
175 constexpr Vector3(
const Vector3<T> &v) : a_(v.a_) { }
177 constexpr Vector3(
const T &x,
const T &y,
const T &z=0) : a_({x,y,z}) { }
179 explicit constexpr Vector3(
const T &t) : a_({t,t,t}) { }
180 constexpr
const Vector3<T> &operator=(
const Vector3<T> &in) { a_ = in.a_;
return *
this; }
184 constexpr
const T &x()
const {
return a_[0]; }
186 constexpr
const T &y()
const {
return a_[1]; }
188 constexpr
const T &z()
const {
return a_[2]; }
190 constexpr
const T &dof(
unsigned u)
const {
return a_[u]; }
192 T &rx() {
return a_[0]; }
194 T &ry() {
return a_[1]; }
196 T &rz() {
return a_[2]; }
198 T &rdof(
unsigned u) {
return a_[u]; }
200 constexpr
const T &operator[](
unsigned u)
const {
return dof(u); }
202 T &operator[](
unsigned u) {
return rdof(u); }
203 template <std::
size_t N> constexpr T get()
const {
204 static_assert(N<3,
"Index out of range");
210 constexpr T fsum()
const {
return (std::abs(x())+std::abs(y())+std::abs(z())); }
212 constexpr T sum()
const {
return x()+y()+z(); }
214 constexpr T mag2()
const {
return (x()*x()+y()*y()+z()*z()); }
216 constexpr T mag()
const {
return to<T>(std::sqrt(to<double>(mag2()))); }
218 constexpr T volume()
const {
return (x()*y()*z()); }
220 Vector3<T> unit()
const { Vector3<T> v(*
this); T m(v.mag());
if (m) v/=m;
return v; }
222 constexpr Vector3<T> abs()
const { Vector3<T> v(std::abs(x()),std::abs(y()),std::abs(z()));
return v; }
224 void fill(
const T &d) { rx()=d; ry()=d; rz()=d; }
226 constexpr T maxComp()
const {
return std::max(x(),std::max(y(),z())); }
228 constexpr T minComp()
const {
return std::min(x(),std::min(y(),z())); }
230 constexpr
unsigned maxCompIndex()
const {
return x() > y() ? (x() > z() ? 0 : 2) : (y() > z() ? 1 : 2); }
232 constexpr
unsigned minCompIndex()
const {
return x() < y() ? (x() < z() ? 0 : 2) : (y() < z() ? 1 : 2); }
234 constexpr
const Vector3<T> &safeDivE(
const Vector3<T> &v) { rx()=
::safeDiv(x(),v.x()); ry() =
::safeDiv(y(),v.y()); rz() =
::safeDiv(z(),v.z());
return *
this; }
236 constexpr
const Vector3<T>
safeDiv(
const Vector3<T> &v) { Vector3<T> ret(::
safeDiv(x(),v.x()),::
safeDiv(y(),v.y()),::
safeDiv(z(),v.z()));
return ret; }
239 constexpr
bool operator==(
const Vector3<T> &v)
const {
return ((x()==v.x())&&(y()==v.y())&&(z()==v.z())); }
241 constexpr
bool operator!=(
const Vector3<T> &v)
const {
return ((x()!=v.x())||(y()!=v.y())||(z()!=v.z())); }
243 constexpr
bool operator<(
const Vector3<T> &v)
const {
if (x()!=v.x())
return x()<v.x();
if (y()!=v.y())
return y()<v.y();
return z()<v.z(); }
245 constexpr
bool operator>(
const Vector3<T> &v)
const {
if (x()!=v.x())
return x()>v.x();
if (y()!=v.y())
return y()>v.y();
return z()>v.z(); }
249 constexpr
const Vector3<T> &operator+=(
const Vector3<T> &v) { rx()+=v.x(); ry()+=v.y(); rz()+=v.z();
return *
this; }
250 constexpr
const Vector3<T> &operator-=(
const Vector3<T> &v) { rx()-=v.x(); ry()-=v.y(); rz()-=v.z();
return *
this; }
251 constexpr
const Vector3<T> &operator*=(
const Vector3<T> &v) { rx()*=v.x(); ry()*=v.y(); rz()*=v.z();
return *
this; }
252 constexpr
const Vector3<T> &operator*=(
const T &t) { rx()*=t; ry()*=t; rz()*=t;
return *
this; }
253 constexpr
const Vector3<T> &operator/=(
const Vector3<T> &v) { rx()/=v.x(); ry()/=v.y(); rz()/=v.z();
return *
this; }
254 constexpr
const Vector3<T> &operator/=(
const T &t) { rx()/=t; ry()/=t; rz()/=t;
return *
this; }
258 constexpr Vector3<T> operator+(
const Vector3<T> &v)
const { Vector3<T> out(x()+v.x(),y()+v.y(),z()+v.z());
return out; }
259 constexpr Vector3<T> operator-(
const Vector3<T> &v)
const { Vector3<T> out(x()-v.x(),y()-v.y(),z()-v.z());
return out; }
260 constexpr Vector3<T>
operator*(
const Vector3<T> &v)
const { Vector3<T> out(x()*v.x(),y()*v.y(),z()*v.z());
return out; }
261 constexpr Vector3<T>
operator*(
const T &t)
const { Vector3<T> out(x()*t,y()*t,z()*t);
return out; }
262 constexpr Vector3<T> operator/(
const Vector3<T> &v)
const { Vector3<T> out(x()/v.x(),y()/v.y(),z()/v.z());
return out; }
263 constexpr Vector3<T> operator/(
const T &t)
const { Vector3<T> out(x()/t,y()/t,z()/t);
return out; }
265 constexpr Vector3<T>
operator&(
const Vector3<T> &v)
const {
266 Vector3<T> out((y()*v.z())-(z()*v.y()),(z()*v.x())-(x()*v.z()),(x()*v.y())-(y()*v.x()));
270 constexpr T
operator|(
const Vector3<T> &v)
const {
return (x()*v.x()+y()*v.y()+z()*v.z()); }
278 typedef Vector2<double> DVect2;
279 typedef Vector2<float> FVect2;
280 typedef Vector2<int32> IVect2;
281 typedef Vector2<uint32> UVect2;
282 typedef Vector2<int64> I64Vect2;
283 typedef Vector2<uint64> U64Vect2;
285 typedef Vector3<double> DVect3;
286 typedef Vector3<float> FVect3;
287 typedef Vector3<int32> IVect3;
288 typedef Vector3<uint32> UVect3;
289 typedef Vector3<int64> I64Vect3;
290 typedef Vector3<uint64> U64Vect3;
295 template <
class T>
inline constexpr DVect2
toDVect2(
const Vector2<T> &v) { DVect2 dv2(to<double>(v.x()),to<double>(v.y()));
return dv2; }
298 template <
class T>
inline constexpr FVect2
toFVect2(
const Vector2<T> &v) { FVect2 fv2(to<float>(v.x()),to<float>(v.y()));
return fv2; }
301 template <
class T>
inline constexpr IVect2
toIVect2(
const Vector2<T> &v) { IVect2 iv2(to<int32>(v.x()),to<int32>(v.y()));
return iv2; }
302 template <
class T>
inline constexpr I64Vect2 toI64Vect2(
const Vector2<T> &v) { I64Vect2 iv2(to<int64>(v.x()),to<int64>(v.y()));
return iv2; }
305 template <
class T>
inline constexpr UVect2
toUVect2(
const Vector2<T> &v) { UVect2 uv2(to<uint32>(v.x()),to<uint32>(v.y()));
return uv2; }
306 template <
class T>
inline constexpr U64Vect2 toU64Vect2(
const Vector2<T> &v) { U64Vect2 uv2(to<uint64>(v.x()),to<uint64>(v.y()));
return uv2; }
310 template <
class T>
inline constexpr DVect3
toDVect3(
const Vector3<T> &v) {
311 DVect3 dv3(to<double>(v.x()),to<double>(v.y()),to<double>(v.z()));
316 template <
class T>
inline constexpr FVect3
toFVect3(
const Vector3<T> &v) {
317 FVect3 fv3(to<float>(v.x()),to<float>(v.y()),to<float>(v.z()));
322 template <
class T>
inline constexpr IVect3
toIVect3(
const Vector3<T> &v) {
323 IVect3 iv3(to<int32>(v.x()),to<int32>(v.y()),to<int32>(v.z()));
326 template <
class T>
inline I64Vect3 toI64Vect3(
const Vector3<T> &v) {
327 I64Vect3 iv3(to<int64>(v.x()),to<int64>(v.y()),to<int64>(v.z()));
332 template <
class T>
inline constexpr U64Vect3
toU64Vect3(
const Vector3<T> &v) {
333 U64Vect3 uv3(to<uint64>(v.x()),to<uint64>(v.y()),to<uint64>(v.z()));
339 template <
class T>
inline constexpr
const Vector2<T> &
toVect2(
const Vector2<T> &v) {
return v; }
340 template <
class T>
inline constexpr Vector2<T>
toVect2(
const Vector3<T> &v) {
return Vector2<T>(v.x(),v.y()); }
341 template <
class T>
inline constexpr Vector3<T>
toVect3(
const Vector2<T> &v,
const T &t=0) {
return Vector3<T>(v.x(),v.y(),t); }
342 template <
class T>
inline constexpr
const Vector3<T> &
toVect3(
const Vector3<T> &v) {
return v; }
347 template <
class T>
inline constexpr Vector2<T>
vmax(
const Vector2<T> &v1,
const Vector2<T> &v2) {
348 Vector2<T> out(std::max<T>(v1.x(),v2.x()),std::max<T>(v1.y(),v2.y()));
353 template <
class T>
inline constexpr Vector2<T>
vmin(
const Vector2<T> &v1,
const Vector2<T> &v2) {
354 Vector2<T> out(std::min<T>(v1.x(),v2.x()),std::min<T>(v1.y(),v2.y()));
360 template <
class T>
inline constexpr Vector2<T>
vsign(
const Vector2<T> &v1,
const Vector2<T> &v2) {
361 Vector2<T> out(v2.x() < 0 ? -qAbs(v1.x()) : qAbs(v1.x()) ,v2.y() < 0 ? -qAbs(v1.y()) : qAbs(v1.y()));
367 template <
class T>
inline constexpr Vector3<T>
vmax(
const Vector3<T> &v1,
const Vector3<T> &v2) {
368 Vector3<T> out(std::max<T>(v1.x(),v2.x()),std::max<T>(v1.y(),v2.y()),std::max<T>(v1.z(),v2.z()));
373 template <
class T>
inline constexpr Vector3<T>
vmin(
const Vector3<T> &v1,
const Vector3<T> &v2) {
374 Vector3<T> out(std::min<T>(v1.x(),v2.x()),std::min<T>(v1.y(),v2.y()),std::min<T>(v1.z(),v2.z()));
380 template <
class T>
inline constexpr Vector3<T>
vsign(
const Vector3<T> &v1,
const Vector3<T> &v2) {
381 Vector3<T> out(v2.x() < 0 ? -qAbs(v1.x()) : qAbs(v1.x()), v2.y() < 0 ? -qAbs(v1.y()) : qAbs(v1.y()), v2.z() < 0 ? -qAbs(v1.z()) : qAbs(v1.z()));
387 template <
class T>
inline Vector2<T>
vceil(
const Vector2<T> &v) {
388 Vector2<T> out(ceil(v.x()),ceil(v.y()));
394 template <
class T>
inline Vector3<T>
vceil(
const Vector3<T> &v) {
395 Vector3<T> out(ceil(v.x()),ceil(v.y()),ceil(v.z()));
401 template <
class T>
inline Vector2<T>
vfloor(
const Vector2<T> &v) {
402 Vector2<T> out(floor(v.x()),floor(v.y()));
408 template <
class T>
inline Vector3<T>
vfloor(
const Vector3<T> &v) {
409 Vector3<T> out(floor(v.x()),floor(v.y()),floor(v.z()));
415 template <
class T> IVect2
vround(
const Vector2<T> &v) {
416 IVect2 out(qRound(v.x()),qRound(v.y()));
422 template <
class T> IVect3 constexpr
vround(
const Vector3<T> &v) {
423 IVect3 out(qRound(v.x()),qRound(v.y()),qRound(v.z()));
426 template <
class T> I64Vect3 constexpr v64round(
const Vector3<T> &v) {
427 I64Vect3 out(std::llround(v.x()),std::llround(v.y()),std::llround(v.z()));
433 template <
class T> constexpr Vector2<T>
max(
const Vector2<T> &v1,
const Vector2<T> &v2) {
return vmax(v1,v2); }
435 template <
class T> constexpr Vector2<T>
min(
const Vector2<T> &v1,
const Vector2<T> &v2) {
return vmin(v1,v2); }
437 template <
class T> constexpr Vector3<T>
max(
const Vector3<T> &v1,
const Vector3<T> &v2) {
return vmax(v1,v2); }
439 template <
class T> constexpr Vector3<T>
min(
const Vector3<T> &v1,
const Vector3<T> &v2) {
return vmin(v1,v2); }
442 template <
class T>
struct tuple_size<Vector2<T>> : std::integral_constant<std::size_t, 2> {};
443 template <
class T>
struct tuple_size<Vector3<T>> : std::integral_constant<std::size_t, 3> {};
444 template <std::
size_t N,
class T>
struct tuple_element<N, Vector2<T>> {
using type = T; };
445 template <std::
size_t N,
class T>
struct tuple_element<N, Vector3<T>> {
using type = T; };
451 namespace basehelper {
452 template <
typename T>
453 string tsVect(
const Vector2<T> &t,
int width,
char notation,
int precision,
char fill) {
454 if (abs(width) > 5) width = width < 0 ? -abs(abs(width) - 3) : abs(abs(width) - 3);
456 int w2 = std::abs(width)/2;
457 int w1 = std::abs(width) - w2;
458 if (width<0) { w1 *= -1; w2 *= -1; }
459 return "("+ts(t.x(), w1, notation, precision, fill)+
","
460 +ts(t.y(), w2, notation, precision, fill)+
")";
462 template <
typename T>
463 string tsVect(
const Vector3<T> &t,
int width,
char notation,
int precision,
char fill) {
464 if (abs(width) > 7) width = width < 0 ? -abs(abs(width) - 4) : abs(abs(width) - 4);
466 int w3 = std::abs(width)/3;
467 int w2 = (std::abs(width)-w3)/2;
468 int w1 = std::abs(width) - w2 - w3;
469 if (width<0) { w1 *= -1; w2 *= -1; w3 *= -1; }
470 return "("+ts(t.x(), w1, notation, precision, fill)+
","
471 +ts(t.y(), w2, notation, precision, fill)+
","
472 +ts(t.z(), w3, notation, precision, fill)+
")";
477 inline string ts(
const DVect2 &t,
int width,
char notation,
int precision,
char fill) {
478 return basehelper::tsVect(t, width, notation, precision, fill);
482 inline string ts(
const DVect3 &t,
int width,
char notation,
int precision,
char fill) {
483 return basehelper::tsVect(t, width, notation, precision, fill);
487 inline string ts(
const IVect2 &t,
int width,
char notation,
int precision,
char fill) {
488 return basehelper::tsVect(t, width, notation, precision, fill);
492 inline string ts(
const IVect3 &t,
int width,
char notation,
int precision,
char fill) {
493 return basehelper::tsVect(t, width, notation, precision, fill);
497 inline string ts(
const I64Vect2 &t,
int width,
char notation,
int precision,
char fill) {
498 return basehelper::tsVect(t, width, notation, precision, fill);
502 inline string ts(
const I64Vect3 &t,
int width,
char notation,
int precision,
char fill) {
503 return basehelper::tsVect(t, width, notation, precision, fill);
511 struct fmt::formatter<Vector2<T>> :
public fmt::formatter<double> {
512 template <
typename ParseContext>
513 constexpr
auto parse(ParseContext &ctx) {
return fmt::formatter<double>::parse(ctx); }
516 template <
typename FormatContext>
517 auto format(Vector2<T>
const &val, FormatContext &ctx) {
518 format_to(ctx.out(),
"(");
519 fmt::formatter<double>::format(val.x(),ctx);
520 format_to(ctx.out(),
",");
521 fmt::formatter<double>::format(val.y(),ctx);
522 return format_to(ctx.out(),
")");
530 struct fmt::formatter<Vector3<T>> :
public fmt::formatter<double> {
531 template <
typename ParseContext>
532 constexpr
auto parse(ParseContext &ctx) {
return fmt::formatter<double>::parse(ctx); }
535 template <
typename FormatContext>
536 auto format(Vector3<T>
const &val, FormatContext &ctx) {
537 format_to(ctx.out(),
"(");
538 fmt::formatter<double>::format(val.x(),ctx);
539 format_to(ctx.out(),
",");
540 fmt::formatter<double>::format(val.y(),ctx);
541 format_to(ctx.out(),
",");
542 fmt::formatter<double>::format(val.z(),ctx);
543 return format_to(ctx.out(),
")");
QString helper functions, plus some additions.
debug checked shorthand for std::numeric_limits<T>::
Definition: limit.h:25
Vector3< T > vceil(const Vector3< T > &v)
Definition: vect.h:394
constexpr U64Vect3 toU64Vect3(const Vector3< T > &v)
Definition: vect.h:332
AVector3< T > vsign(const AVector3< T > &v1, const AVector3< T > &v2)
Definition: avect.h:289
constexpr FVect3 toFVect3(const Vector3< T > &v)
Definition: vect.h:316
constexpr Vector3< T > vmax(const Vector3< T > &v1, const Vector3< T > &v2)
Definition: vect.h:367
IVect2 toIVect2(const QPoint &p)
Convert a QPoint to an IVect2.
Definition: basetoqt.h:263
UVect2 toUVect2(const QPoint &p)
Convert a QPoint to a UVect2.
Definition: basetoqt.h:274
AVector3< T > vceil(const AVector3< T > &v)
Definition: avect.h:296
Vector2< T > operator&(const Vector2< T > &v, const AVector2< T > &av)
Definition: avect.h:140
Vector3< T > vfloor(const Vector3< T > &v)
Definition: vect.h:408
constexpr Vector2< T > operator*(const Matrix< T, 2, 2 > &m, const Vector2< T > &v)
Definition: matrix.h:987
FVect2 toFVect2(const QPoint &p)
Convert a QPoint to an FVect2.
Definition: basetoqt.h:258
PUSHWARNING VSWARNING(4702) template< class T > class Vector2
2D vector utility class.
Definition: vect.h:33
constexpr Vector3< T > vmin(const Vector3< T > &v1, const Vector3< T > &v2)
Definition: vect.h:373
constexpr DVect3 toDVect3(const Vector3< T > &v)
Definition: vect.h:310
constexpr IVect3 toIVect3(const Vector3< T > &v)
Definition: vect.h:322
constexpr const T safeDiv(const T num, const T denom)
This function provids "safe" division operation, checks explicitly for zero.
Definition: to.h:117
Vector2< T > toVect2(const AVector2< T > &)
Definition: avect.h:247
AVector3< T > vmax(const AVector3< T > &v1, const AVector3< T > &v2)
Definition: avect.h:275
constexpr Vector3< T > vsign(const Vector3< T > &v1, const Vector3< T > &v2)
Definition: vect.h:380
Vector3< T > toVect3(const AVector2< T > &v)
Definition: avect.h:250
constexpr IVect3 vround(const Vector3< T > &v)
Definition: vect.h:422
AVector3< T > vmin(const AVector3< T > &v1, const AVector3< T > &v2)
Definition: avect.h:282
T operator|(const Vector2< T > &, const AVector2< T > &)
Definition: avect.h:161
DVect2 toDVect2(const QPoint &p)
Convert a QPoint to a DVect2.
Definition: basetoqt.h:248
A overflow checked shorthand for static_cast<T>().
constexpr Vector2< T > max(const Vector2< T > &v1, const Vector2< T > &v2)
Template specialization for max, min.
Definition: vect.h:433
constexpr Vector2< T > min(const Vector2< T > &v1, const Vector2< T > &v2)
Template specialization for max, min.
Definition: vect.h:435