Go to the documentation of this file.
33 template <
class Po
int>
38 z[0] =
x[1] * y[2] - y[1] *
x[2];
39 z[1] =
x[2] * y[0] - y[2] *
x[0];
40 z[2] =
x[0] * y[1] - y[0] *
x[1];
44 template <
class Po
int>
55 template <
class Po
int>
59 return x[0] * y[0] +
x[1] * y[1] +
x[2] * y[2];
62 template <
class Po
int>
67 return p1[0] * (p2[1] - p3[1]) + p2[0] * (p3[1] - p1[1]) + p3[0] * (p1[1] - p2[1]) == 0;
70 template <
class Po
int>
79 return 0 ==
dot(
a, d);
82 template <
class Po
int>
90 return dot(
n,
sub(p4, p1)) >= 0;
93 template <
class Po
int>
97 return sqrt(std::pow(
a[0] - b[0], 2) + std::pow(
a[1] - b[1], 2) + std::pow(
a[2] - b[2], 2));
100 template <
class Po
int>
104 return sqrt(std::pow(
a[0], 2) + std::pow(
a[1], 2) + std::pow(
a[2], 2));
107 template <
class Po
int>
113 double d1 =
norm(v1);
114 double d2 =
norm(v2);
115 double prod =
dot(v1, v2);
117 return std::max(0.0, acos(prod / (d1 * d2)));
123 template <
class Po
int>
130 double nom = pow(
norm(px), 2) * pow(
norm(xy), 2) - pow(
dot(px, xy), 2);
131 double d = nom / pow(
norm(xy), 2);
138 return (
x <
a) ?
a : ((
x > b) ? b :
x);
144 template <
class Po
int>
152 double a =
dot(edge0, edge0);
153 double b =
dot(edge0, edge1);
154 double c =
dot(edge1, edge1);
155 double d =
dot(edge0, diff);
156 double e =
dot(edge1, diff);
157 double f =
dot(diff, diff);
159 double det =
a *
c - b * b;
160 double s = b * e -
c * d;
161 double t = b * d -
a * e;
177 t =
clamp(-e /
c, 0.0, 1.0);
183 t =
clamp(-e /
c, 0.0, 1.0);
193 float invDet = 1.0 / det;
207 float numer = tmp1 - tmp0;
208 float denom =
a - 2 * b +
c;
209 s =
clamp(numer / denom, 0.0, 1.0);
214 t =
clamp(-e /
c, 0.0, 1.0);
222 float numer =
c + e - b - d;
223 float denom =
a - 2 * b +
c;
224 s =
clamp(numer / denom, 0.0, 1.0);
235 float numer =
c + e - b - d;
236 float denom =
a - 2 * b +
c;
237 s =
clamp(numer / denom, 0.0, 1.0);
242 double q =
a *
s *
s + 2 * b *
s * t +
c * t * t + 2 * d *
s + 2 * e * t + f;
double distanceToLine(const Point &x, const Point &y, const Point &p)
constexpr auto n() noexcept
double distanceToTriangle(const Point &x, const Point &y, const Point &z, const Point &p)
double clamp(double x, double a, double b)
double a(double t, double a0, double j)
bool inFront(const Point &p1, const Point &p2, const Point &p3, const Point &p4)
Point cross(const Point &x, const Point &y)
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
Point sub(const Point &x, const Point &y)
bool collinear(const Point &p1, const Point &p2, const Point &p3)
double dot(const Point &x, const Point &y)
double angle(const Point &a, const Point &b, const Point &c)
double distance(const Point &a, const Point &b)
double s(double t, double s0, double v0, double a0, double j)
This file offers overloads of toIce() and fromIce() functions for STL container types.
bool coplanar(const Point &p1, const Point &p2, const Point &p3, const Point &p4)
double norm(const Point &a)