Go to the documentation of this file.
145 #define Point3(T) Vector<3, T>
156 if(p.x() > 0 and step.x() > 0)
157 r.
x() =
uint(ceil(p.x() / step.x()));
158 if(p.y() > 0 and step.y() > 0)
159 r.
y() =
uint(ceil(p.y() / step.y()));
160 if(p.z() > 0 and step.z() > 0)
161 r.
z() =
uint(ceil(p.z() / step.z()));
171 Vector<3, T> res(t.x() / t.t(), t.y() / t.t(), t.z() / t.t());
179 T t =
trim(s, (T)0.0, (T)1.0);
180 return ((1.0 - t) * a + t * b);
188 T phi = (t2.x() * t3.y() - t3.x() * t2.y() + (t2.y() - t3.y()) * p.x() + (t3.x() - t2.x()) * p.y())/area *
c1
189 + (t3.x() * t1.y() - t1.x() * t3.y() + (t3.y() - t1.y()) * p.x() + (t1.x() - t3.x()) * p.y())/area *
c2
190 + (t1.x() * t2.y() - t2.x() * t1.y() + (t1.y() - t2.y()) * p.x() + (t2.x() - t1.x()) * p.y())/area *
c3;
227 s =
n * (p - u1) / t;
242 return (
nrml ^ (
c3 * (p2 - p1) +
c1 * (p3 - p2) +
c2 * (p1 - p3)))/
area2;
265 intersect =
Point3(T)(0,0,0);
270 Point3(T) qps = (q1-p1) % r2;
271 Point3(T) qpr = (q1-p1) % r;
274 if(abs(rxs.x())>abs(rxs.y()) and abs(rxs.x())>abs(rxs.z())){
277 }
else if(abs(rxs.y())>abs(rxs.z())){
284 intersect = p1 + s*r;
294 return ((a - b).cross(a - c).
norm() / 2.0);
301 return ((-c.x() * b.y() * a.z() + b.x() * c.y() * a.z() + c.x() * a.y() * b.z() - a.x() * c.y() * b.z()
302 - b.x() * a.y() * c.z() + a.x() * b.y() * c.z()) / 6.0f);
314 if(z.cross(
n).norm() != 0) {
339 if(
n.x() == 0 &&
n.y() == 0 &&
n.z() == 0)
362 T uu, uv, vv, wu, wv, d;
369 d = uv * uv - uu * vv;
373 s = (uv * wv - vv * wu) / d;
374 if(s < 0.0f || s > 1.0f)
376 t = (uv * wu - uu * wv) / d;
377 if(t < 0.0f || (s + t) > 1.0f)
387 Point3(T) v2 = _v2, p = _p;
397 Point3(T) q = vn * (p * vn);
398 T dist =
norm(p - q);
404 if(qn >= 0 and qn <=
n)
420 return multiply(
Point3f(img) +
Point3f(.5f, .5f, .5f), step) + shift;
433 return ((
size_t(z) * ysz + y) * xsz + x);
439 return ((
size_t(z) * size.
y() + y) * size.
x() + x);
445 return offset(x, y, z, size.
x(), size.
y());
450 return ((
size_t(p.
z()) * size.
y() + p.
y()) * size.
x() + p.
x());
454 return P - ((P - Q) * N) * N;
CU_HOST_DEVICE Point3i worldToImage(const Point3f &wrld, const Point3f &step, const Point3f &shift)
Matrix< 3, 4, double > Matrix3x4d
Matrix< 4, 6, double > Matrix4x6d
Matrix< 4, 3, double > Matrix4x3d
Matrix< 9, 9, double > Matrix9d
Vector< 3, size_t > Point3s
Matrix< 3, 18, double > Matrix3x18d
Vector< 2, uint > Point2u
CU_HOST_DEVICE bool lineLineIntersect(Point3(T) p1, Point3(T) p2, Point3(T) q1, Point3(T) q2, T &s, T &u, Point3(T) &intersect)
Line-Line Intersection returns whether two line segments intersect or not saves the location on where...
Matrix< 9, 18, double > Matrix9x18d
Vector< 5, double > Point5d
Matrix< 3, 12, double > Matrix3x12d
Matrix< 2, 2, double > Matrix2d
Point3d projectPointOnPlane(const Point3d &P, const Point3d &Q, const Point3d &N)
Vector< 4, float > Point4f
CU_HOST_DEVICE T signedTetraVolume(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
Vector< 2, size_t > Point2s
Matrix< 6, 3, uint > Matrix6x3u
Matrix< 6, 12, double > Matrix6x12d
Matrix< 4, 3, uint > Matrix4x3u
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
CU_HOST_DEVICE T triangleArea(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
CU_HOST_DEVICE Point3(T) triangleGradient(const Point3(T) &p1
CU_HOST_DEVICE int rayTriangleIntersect(const Point3(T) &r0, const Point3(T) &r1, const Point3(T) &t0, const Point3(T) &t1, const Point3(T) &t2, Point3(T) &intp)
Matrix< 3, 3, double > Matrix3d
unsigned short ushort
Simpler names for the various containers and iterators.
Matrix< 2, 2, float > Matrix2f
CU_HOST_DEVICE Point3u toVoxelsCeil(const Point3(T) &p, const Point3(T) &step)
Vector< 18, double > Point18d
Vector< 4, uint > Point4u
CU_HOST_DEVICE const const T T c2
Vector< 1, double > Point1d
Matrix< 3, 3, uint > Matrix3u
Vector< 6, uint > Point6u
CU_HOST_DEVICE size_t getOffset(const int x, const int y, const int z, const Point3i &size)
Distributed matrix library.
Matrix< 5, 3, double > Matrix5x3d
Vector< 5, uint > Point5u
Matrix< 4, 4, double > Matrix4d
Vector< 5, size_t > Point5s
Vector< 6, float > Point6f
Matrix< 6, 3, double > Matrix6x3d
Vector< 1, uint > Point1u
Vector< 8, double > Point8d
T CU_HOST_DEVICE interpolate(const T &a, const T &b, const T &s)
Interpolate between values.
CU_HOST_DEVICE Point3f imageToWorld(const Point3i &img, const Point3f &step, const Point3f &shift)
BoundingBox< 3, int > BoundingBox3i
CU_HOST_DEVICE T distLinePoint(const Point3(T) &v1, const Point3(T) &_v2, const Point3(T) &_p, bool segment)
BoundingBox< 3, float > BoundingBox3f
Matrix< 4, 2, double > Matrix4x2d
Vector< 3, float > Point3f
CU_HOST_DEVICE T trim(const T x, const T minx, const T maxx)
Matrix< 4, 4, float > Matrix4f
Matrix< 12, 3, double > Matrix12x3d
Vector< 6, double > Point6d
Vector< 3, double > Point3d
Matrix< 3, 6, double > Matrix3x6d
CU_HOST_DEVICE void y(const T &v)
Short access to the second element.
Vector< 12, float > Point12f
SymmetricTensor SymmetricTensor
CU_HOST_DEVICE void getBasisFromPlane(const Point3(T) &nrml, Point3(T)&x, Point3(T) &y, Point3(T) &z)
Matrix< 6, 6, double > Matrix6d
CU_HOST_DEVICE const const T c1
unsigned char ubyte
This filee contains different useful geometry algorithms, like intersections, areas,...
CU_HOST_DEVICE Vector< 3, T > multMatrix4Point3(const Matrix< 4, 4, T > &m, const Vector< 3, T > &p)
Multiply openGL 4D matrix by 3D point and return 3D point.
Vector< 12, double > Point12d
Vector< 4, double > Point4d
Vector< 12, uint > Point12u
Vector< 5, float > Point5f
Matrix< 2, 2, uint > Matrix2u
Vector< 2, double > Point2d
Matrix< 2, 3, double > Matrix2x3d
Vector< 2, float > Point2f
Matrix< 2, 6, double > Matrix2x6d
Vector< 30, uint > Point30u
Matrix< 6, 18, double > Matrix6x18d
ScalarT norm(DVector< DistNhbdT, MatrixT, VectorT, ScalarT > &v)
Vector< 3, uint > Point3u
Vector< 3, uchar > Point3uc
Vector< 6, size_t > Point6s
Matrix< 12, 12, double > Matrix12d
Vector< 9, double > Point9d
BoundingBox< 3, uint > BoundingBox3u
Vector< 4, size_t > Point4s
CU_HOST_DEVICE const const T T T c3
Matrix< 9, 3, double > Matrix9x3d
Matrix< 3, 2, double > Matrix3x2d
Vector< 3, ulong > Point3ul
Vector< 16, double > Point16d
Matrix< 18, 18, double > Matrix18d
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
Matrix< 1, 1, double > Matrix1d
CU_HOST_DEVICE size_t offset(uint x, uint y, uint z, uint xsz, uint ysz)
CU_HOST_DEVICE bool isNan(float s)
CU_HOST_DEVICE bool planeLineIntersect(const Point3(T) &p, const Point3(T) &nrml, const Point3(T) &u1, const Point3(T) &u2, T &s, Point3(T) &u)
Plane-Line Intersection.
Matrix< 3, 3, float > Matrix3f
Matrix< 4, 4, uint > Matrix4u
Vector< 3, ushort > Point3us