Go to the documentation of this file.
36 z[0] = x[1] * y[2] - y[1] * x[2];
37 z[1] = x[2] * y[0] - y[2] * x[0];
38 z[2] = x[0] * y[1] - y[0] * x[1];
55 return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
62 return p1[0] * (p2[1] - p3[1]) + p2[0] * (p3[1] - p1[1]) + p3[0] * (p1[1] - p2[1]) == 0;
73 return 0 ==
dot(
a, d);
83 return dot(n,
sub(p4, p1)) >= 0;
90 return sqrt(std::pow(
a[0] - b[0], 2) + std::pow(
a[1] - b[1], 2) + std::pow(
a[2] - b[2], 2));
96 return sqrt(std::pow(
a[0], 2) + std::pow(
a[1], 2) + std::pow(
a[2], 2));
104 double d1 =
norm(v1);
105 double d2 =
norm(v2);
106 double prod =
dot(v1, v2);
108 return std::max(0.0, acos(prod / (d1 * d2)));
114 template<
class Po
int>
120 double nom = pow(
norm(px), 2) * pow(
norm(xy), 2) - pow(
dot(px, xy), 2);
121 double d = nom / pow(
norm(xy), 2);
125 inline double clamp(
double x,
double a,
double b)
127 return (x <
a) ?
a : ((x > b) ? b : x);
133 template<
class Po
int>
141 double a =
dot(edge0, edge0);
142 double b =
dot(edge0, edge1);
143 double c =
dot(edge1, edge1);
144 double d =
dot(edge0, diff);
145 double e =
dot(edge1, diff);
146 double f =
dot(diff, diff);
148 double det =
a *
c - b * b;
149 double s = b * e -
c * d;
150 double t = b * d -
a * e;
166 t =
clamp(-e /
c, 0.0, 1.0);
172 t =
clamp(-e /
c, 0.0, 1.0);
182 float invDet = 1.0 / det;
196 float numer = tmp1 - tmp0;
197 float denom =
a - 2 * b +
c;
198 s =
clamp(numer / denom, 0.0, 1.0);
203 t =
clamp(-e /
c, 0.0, 1.0);
211 float numer =
c + e - b - d;
212 float denom =
a - 2 * b +
c;
213 s =
clamp(numer / denom, 0.0, 1.0);
224 float numer =
c + e - b - d;
225 float denom =
a - 2 * b +
c;
226 s =
clamp(numer / denom, 0.0, 1.0);
231 double q =
a *
s *
s + 2 * b *
s * t +
c * t * t + 2 * d *
s + 2 * e * t + f;
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
double distanceToLine(const Point &x, const Point &y, const Point &p)
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)
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)
bool coplanar(const Point &p1, const Point &p2, const Point &p3, const Point &p4)
double norm(const Point &a)