40#ifndef GEOGRAM_BASIC_VECHG
41#define GEOGRAM_BASIC_VECHG
67 vec2Hg(
const T& x_in,
const T& y_in,
const T& w_in) :
73 vec2Hg(
double x_in,
double y_in,
double w_in) :
79 vec2Hg(T&& x_in, T&& y_in, T&& w_in) :
85 vec2Hg(
const vec2Hg& rhs) =
default;
87 vec2Hg(vec2Hg&& rhs) =
default;
89 template <
class T2>
explicit vec2Hg(
const vecng<2,T2>& rhs) :
95 template <
class T2>
explicit vec2Hg(
const vec2Hg<T2>& rhs) :
101 vec2Hg& operator=(
const vec2Hg& rhs) =
default;
102 vec2Hg& operator=(vec2Hg&& rhs) =
default;
108 const T* data()
const {
135 template <
class T>
inline vec2Hg<T>
operator-(
136 const vec2Hg<T>& p1,
const vec2Hg<T>& p2
146 det2x2(p1.x,p1.w,p2.x,p2.w),
147 det2x2(p1.y,p1.w,p2.y,p2.w),
192 vec3Hg(
const T& x_in,
const T& y_in,
const T& z_in,
const T& w_in) :
199 vec3Hg(T&& x_in, T&& y_in, T&& z_in, T&& w_in) :
206 vec3Hg(
double x_in,
double y_in,
double z_in,
double w_in) :
213 vec3Hg(
const vec3Hg& rhs) =
default;
215 vec3Hg(vec3Hg&& rhs) =
default;
217 template <
class T2>
explicit vec3Hg(
const vecng<3,T2>& rhs) :
224 template <
class T2>
explicit vec3Hg(
const vec3Hg<T2>& rhs) :
231 vec3Hg& operator=(
const vec3Hg& rhs) =
default;
232 vec3Hg& operator=(vec3Hg&& rhs) =
default;
238 const T* data()
const {
267 template <
class T>
inline vec3Hg<T>
operator-(
268 const vec3Hg<T>& p1,
const vec3Hg<T>& p2
279 det2x2(p1.x,p1.w,p2.x,p2.w),
280 det2x2(p1.y,p1.w,p2.y,p2.w),
281 det2x2(p1.z,p1.w,p2.z,p2.w),
325 template <
class T>
inline vec2Hg<T> mix(
326 const rationalg<T>& t,
327 const vecng<2,double>& p1,
const vecng<2,double>& p2
329 const T& st_d = t.denom();
330 const T& t_n = t.num();
333 s_n * T(p1.x) + t_n * T(p2.x),
334 s_n * T(p1.y) + t_n * T(p2.y),
339 template <
class T>
inline vec3Hg<T> mix(
340 const rationalg<T>& t,
341 const vecng<3,double>& p1,
const vecng<3,double>& p2
343 const T& st_d = t.denom();
344 const T& t_n = t.num();
347 s_n * T(p1.x) + t_n * T(p2.x),
348 s_n * T(p1.y) + t_n * T(p2.y),
349 s_n * T(p1.z) + t_n * T(p2.z),
355 template <
class T>
inline vec2Hg<T> mix(
356 const rationalg<T>& t,
const vec2Hg<T>& p1,
const vec2Hg<T>& p2
359 T sn = t.denom() - t.num();
362 sn * p1.x + tn * p2.x,
363 sn * p1.y + tn * p2.y,
367 T sn = p2.w*(t.denom() - t.num());
370 sn * p1.x + tn * p2.x,
371 sn * p1.y + tn * p2.y,
372 t.denom() * p1.w * p2.w
377 template <
class T>
inline vec3Hg<T> mix(
378 const rationalg<T>& t,
const vec3Hg<T>& p1,
const vec3Hg<T>& p2
381 T sn = t.denom() - t.num();
384 sn * p1.x + tn * p2.x,
385 sn * p1.y + tn * p2.y,
386 sn * p1.z + tn * p2.z,
390 T sn = p2.w*(t.denom() - t.num());
393 sn * p1.x + tn * p2.x,
394 sn * p1.y + tn * p2.y,
395 sn * p1.z + tn * p2.z,
396 t.denom() * p1.w * p2.w
#define geo_debug_assert(x)
Verifies that a condition is met.
Common include file, providing basic definitions. Should be included before anything else by all head...
Comparator class for vec2Hg \detail Used to create maps indexed by vec2Hg or SOS symbolic perturbatio...
bool operator()(const vec2Hg< T > &v1, const vec2Hg< T > &v2) const
Compares two vec2Hg.
2d vector with homogeneous coordinates
T value_type
The type of the vector coordinates.
Comparator class for vec3Hg \detail Used to create maps indexed by vec3Hg or SOS symbolic perturbatio...
bool operator()(const vec3Hg< T > &v1, const vec3Hg< T > &v2) const
Compares two vec3Hg.
3d vector with homogeneous coordinates
T value_type
The type of the vector coordinates.
Sign ratio_compare(const T &a_num, const T &a_denom, const T &b_num, const T &b_denom)
Compares two rational numbers given as separate numerators and denominators.
void optimize_number_representation(T &x)
place holder for optimizing internal number representation
Global Vorpaline namespace.
Quaternion operator-(const Quaternion &a, const Quaternion &b)
Computes the difference between two Quaternion.
Sign
Integer constants that represent the sign of a value.
T det2x2(const T &a11, const T &a12, const T &a21, const T &a22)
Computes a two-by-two determinant.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.
Generic implementation of rational type.
Generic implementation of geometric vectors.