MorphoGraphX  2.0-1-227
Geometry.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef GEOMETRY_HPP
12 #define GEOMETRY_HPP
13 
20 #include <Config.hpp>
21 
22 #include <Util.hpp>
23 #include <Vector.hpp>
24 #include <Matrix.hpp>
25 #include <SymmetricTensor.hpp>
26 #include <BoundingBox.hpp>
27 
28 #include <cmath>
29 #include <cuda/CudaGlobal.hpp>
30 #include <float.h>
31 #include <math.h>
32 
33 namespace mgx
34 {
39  typedef unsigned char ubyte;
40  typedef unsigned char uchar;
41  typedef unsigned int uint;
42  typedef unsigned short ushort;
43  typedef unsigned long ulong;
44 
46 
47  typedef Vector<2, float> Point2f;
48  typedef Vector<3, float> Point3f;
49  typedef Vector<4, float> Point4f;
53 
60  typedef Vector<6, double> Point6d;
66 
67  typedef Vector<2, int> Point2i;
72 
81 
83 
85 
91 
94 
98 
104 
109 
116 
121 
123 
124 
129 
134 
137 
139 
143 
144  // Replace with C++11 using later
145  #define Point3(T) Vector<3, T>
146 
147  // Define
148  CU_HOST_DEVICE bool isNan(float s) { return !(s == s); }
149  CU_HOST_DEVICE bool isNan(double s) { return !(s == s); }
150 
151  // convert to voxels and round up
152  template<typename T> CU_HOST_DEVICE
153  Point3u toVoxelsCeil(const Point3(T) &p, const Point3(T) &step)
154  {
155  Point3u r(0, 0, 0);
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()));
162  return r;
163  }
164 
166  template<typename T> CU_HOST_DEVICE
168  {
169  Vector<4, T> t(p.x(), p.y(), p.z(), T(1.0));
170  t = m * t;
171  Vector<3, T> res(t.x() / t.t(), t.y() / t.t(), t.z() / t.t());
172  return res;
173  }
174 
176  template<typename T>
177  T CU_HOST_DEVICE interpolate(const T &a, const T &b, const T &s)
178  {
179  T t = trim(s, (T)0.0, (T)1.0);
180  return ((1.0 - t) * a + t * b);
181  }
182 
184  template<typename T>
185  T CU_HOST_DEVICE interpolate(const Point3(T) &t1, const Point3(T) &t2, const Point3(T) &t3, T c1, T c2, T c3, const Point3(T) &p)
186  {
187  T area = triangleArea(t1, t2, t3);
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;
191  return phi;
192  }
193 
194  // CU_HOST_DEVICE
195  // Point3f getEulerAngles(Matrix4d &m)
196  //{
197  // Point3f r(0,0,0);
198  // if(fabs(m(1,0)) > .1)
199  // r.x() = atan2(m(0,2), m(2,2)) / M_PI * 180;
200  // else
201  // r.x() = atan2(-m(2,0), m(0,0)) / M_PI * 180;
202  // r.y() = atan2(-m(1,2), m(2,2)) / M_PI * 180;
203  // r.z() = asin(m(1,0)) / M_PI * 180;
204  // return(r);
205  //}
206 
216  template<typename T> CU_HOST_DEVICE
217  bool planeLineIntersect(const Point3(T) &p, const Point3(T) &nrml,
218  const Point3(T) &u1, const Point3(T) &u2, T &s, Point3(T) &u)
219  {
220  Point3(T) n = nrml;
221  n.normalize();
222  Point3(T) u1u2 = u2 - u1;
223  T t = n * u1u2;
224  // Check if parallel
225  if(t == 0)
226  return (false);
227  s = n * (p - u1) / t;
228  u = u1 + s * u1u2;
229  return (true);
230  }
231 
232  // Calculate the gradient of a signal on a triangle
233  template<typename T> CU_HOST_DEVICE
234  Point3(T) triangleGradient(const Point3(T) &p1, const Point3(T) &p2, const Point3(T) &p3, T c1, T c2, T c3)
235  {
236  Point3(T) nrml = (p2-p1)^(p3-p1);
238  if(area2 == 0)
239  return Point3(T)();
241 
242  return (nrml ^ (c3 * (p2 - p1) + c1 * (p3 - p2) + c2 * (p1 - p3)))/area2;
243  }
244 
261  template<typename T> CU_HOST_DEVICE
262  bool lineLineIntersect(Point3(T) p1, Point3(T) p2, Point3(T) q1, Point3(T) q2, T &s, T &u, Point3(T) &intersect)
263  {
264  T eps = 0.0001;
265  intersect = Point3(T)(0,0,0);
266  Point3(T) r = p2 - p1;
267  Point3(T) r2 = q2 - q1;
268 
269  Point3(T) rxs = r % r2;
270  Point3(T) qps = (q1-p1) % r2;
271  Point3(T) qpr = (q1-p1) % r;
272 
273  if(norm(rxs) > eps){
274  if(abs(rxs.x())>abs(rxs.y()) and abs(rxs.x())>abs(rxs.z())){
275  s = qps.x()/rxs.x();
276  u = qpr.x()/rxs.x();
277  } else if(abs(rxs.y())>abs(rxs.z())){
278  s = qps.y()/rxs.y();
279  u = qpr.y()/rxs.y();
280  } else {
281  s = qps.z()/rxs.z();
282  u = qpr.z()/rxs.z();
283  }
284  intersect = p1 + s*r;
285  return true;
286  }
287 
288  return false;
289  }
290 
291  // Triangle area
292  template<typename T> CU_HOST_DEVICE
293  T triangleArea(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c) {
294  return ((a - b).cross(a - c).norm() / 2.0);
295  }
296 
297  // Signed volume of a tetrahedron
298  template<typename T> CU_HOST_DEVICE
299  T signedTetraVolume(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
300  {
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);
303  }
304 
305  // Get (a set of) basis vectors from a plane
306  template<typename T> CU_HOST_DEVICE
307  void getBasisFromPlane(const Point3(T) &nrml, Point3(T)&x, Point3(T) &y, Point3(T) &z)
308  {
309  Point3(T) n(nrml);
310  n.normalize();
311  x = Point3(T)(1, 0, 0);
312  y = Point3(T)(0, 1, 0);
313  z = Point3(T)(0, 0, 1);
314  if(z.cross(n).norm() != 0) {
315  y = z.cross(n);
316  y.normalize();
317  x = y.cross(n);
318  x.normalize();
319  } else
320  x = n * z * x;
321  z = n;
322  }
323 
324  // Intersect a ray with a 3D triangle
325  // Input: ray r1,r2 triangle t0,t1,t2
326  // Output: intp = intersection point (when it exists)
327  // Return: -1 = triangle is degenerate (a segment or point)
328  // 0 = disjoint (no intersect)
329  // 1 = intersect in unique point I1
330  // 2 = are in the same plane
331  template<typename T> CU_HOST_DEVICE
332  int rayTriangleIntersect(const Point3(T) &r0, const Point3(T) &r1, const Point3(T) &t0,
333  const Point3(T) &t1, const Point3(T) &t2, Point3(T) &intp)
334  {
335  // get triangle edge vectors and plane normal
336  Point3(T) u(t1 - t0);
337  Point3(T) v(t2 - t0);
338  Point3(T) n(u.cross(v));
339  if(n.x() == 0 && n.y() == 0 && n.z() == 0) // triangle is degenerate
340  return -1;
341 
342  Point3(T) dir = r1 - r0; // ray direction vector
343  Point3(T) w0 = r0 - t0;
344  T a = -n * w0;
345  T b = n * dir;
346  if(b == 0) { // ray is parallel to triangle plane
347  if(a == 0) // ray lies in triangle plane
348  return 2;
349  else
350  return 0; // ray disjoint from plane
351  }
352 
353  // get intersect point of ray with triangle plane
354  T r = a / b;
355  if(r < 0.0f) // ray goes away from triangle
356  return 0; // => no intersect
357  // for a segment, also test if (r > 1.0) => no intersect
358 
359  intp = r0 + r * dir; // intersect point of ray and plane
360 
361  // is intersect point inside the triangle?
362  T uu, uv, vv, wu, wv, d;
363  uu = u * u;
364  uv = u * v;
365  vv = v * v;
366  Point3(T) w = intp - t0;
367  wu = w * u;
368  wv = w * v;
369  d = uv * uv - uu * vv;
370 
371  // get and test parametric coords
372  T s, t;
373  s = (uv * wv - vv * wu) / d;
374  if(s < 0.0f || s > 1.0f) // outside
375  return 0;
376  t = (uv * wu - uu * wv) / d;
377  if(t < 0.0f || (s + t) > 1.0f) // outside
378  return 0;
379 
380  return 1; // in
381  }
382 
383  // Return distance from a point to a line (or segment)
384  template<typename T> CU_HOST_DEVICE
385  T distLinePoint(const Point3(T) &v1, const Point3(T) &_v2, const Point3(T) &_p, bool segment)
386  {
387  Point3(T) v2 = _v2, p = _p;
388 
389  v2 -= v1;
390  T n = norm(v2);
391  // Points are the same
392  if(n == 0)
393  return norm(p - v1);
394 
395  Point3(T) vn = v2 / n;
396  p -= v1;
397  Point3(T) q = vn * (p * vn);
398  T dist = norm(p - q);
399  if(!segment)
400  return dist;
401 
402  // Projected point on line segment
403  T qn = p * vn;
404  if(qn >= 0 and qn <= n)
405  return dist;
406 
407  // Otherwise pick closest endpoint
408  dist = norm(p);
409  T d = norm(p - v2);
410  if(d < dist)
411  dist = d;
412 
413  return dist;
414  }
415 
416  // Go from image coordinates to world coordinates (centers of voxels)
418  Point3f imageToWorld(const Point3i& img, const Point3f& step, const Point3f& shift)
419  {
420  return multiply(Point3f(img) + Point3f(.5f, .5f, .5f), step) + shift;
421  }
422 
423  // Go from world coordinates to image coordinates
425  Point3i worldToImage(const Point3f& wrld, const Point3f& step, const Point3f& shift)
426  {
427  return Point3i((wrld - shift) / step - Point3f(.5f, .5f, .5f));
428  }
429 
430  // Compute offset in stack
431  CU_HOST_DEVICE size_t offset(uint x, uint y, uint z, uint xsz, uint ysz)
432  {
433  return ((size_t(z) * ysz + y) * xsz + x);
434  }
435 
437  size_t getOffset(const int x, const int y, const int z, const Point3i& size)
438  {
439  return ((size_t(z) * size.y() + y) * size.x() + x);
440  }
441 
443  size_t getOffset(const uint x, const uint y, const uint z, const Point3u& size)
444  {
445  return offset(x, y, z, size.x(), size.y());
446  }
447 
448  CU_HOST_DEVICE size_t getOffset(const Point3i p, const Point3i& size)
449  {
450  return ((size_t(p.z()) * size.y() + p.y()) * size.x() + p.x());
451  }
452 
453  inline Point3d projectPointOnPlane(const Point3d& P, const Point3d& Q, const Point3d& N) {
454  return P - ((P - Q) * N) * N;
455  }
456 }
457 #endif
mgx::worldToImage
CU_HOST_DEVICE Point3i worldToImage(const Point3f &wrld, const Point3f &step, const Point3f &shift)
Definition: Geometry.hpp:425
mgx::Matrix3x4d
Matrix< 3, 4, double > Matrix3x4d
Definition: Geometry.hpp:112
mgx::Matrix4x6d
Matrix< 4, 6, double > Matrix4x6d
Definition: Geometry.hpp:120
mgx::Matrix4x3d
Matrix< 4, 3, double > Matrix4x3d
Definition: Geometry.hpp:118
mgx::Matrix9d
Matrix< 9, 9, double > Matrix9d
Definition: Geometry.hpp:132
mgx::uint
unsigned int uint
Definition: Geometry.hpp:41
Vector.hpp
mgx::Point3s
Vector< 3, size_t > Point3s
Definition: Geometry.hpp:87
mgx::Matrix3x18d
Matrix< 3, 18, double > Matrix3x18d
Definition: Geometry.hpp:115
mgx::Point2u
Vector< 2, uint > Point2u
Definition: Geometry.hpp:74
mgx::lineLineIntersect
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...
Definition: Geometry.hpp:262
mgx::Matrix9x18d
Matrix< 9, 18, double > Matrix9x18d
Definition: Geometry.hpp:133
mgx::Point5d
Vector< 5, double > Point5d
Definition: Geometry.hpp:58
mgx::Matrix3x12d
Matrix< 3, 12, double > Matrix3x12d
Definition: Geometry.hpp:114
mgx::Matrix2d
Matrix< 2, 2, double > Matrix2d
Definition: Geometry.hpp:106
mgx::projectPointOnPlane
Point3d projectPointOnPlane(const Point3d &P, const Point3d &Q, const Point3d &N)
Definition: Geometry.hpp:453
mgx::Point4f
Vector< 4, float > Point4f
Definition: ColorMap.hpp:20
mgx::Point2i
Vector< 2, int > Point2i
Definition: CuttingSurface.hpp:22
mgx::signedTetraVolume
CU_HOST_DEVICE T signedTetraVolume(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
Definition: Geometry.hpp:299
mgx::SymmetricTensor
Definition: SymmetricTensor.hpp:59
mgx::Point2s
Vector< 2, size_t > Point2s
Definition: Geometry.hpp:86
mgx::Matrix6x3u
Matrix< 6, 3, uint > Matrix6x3u
Definition: Geometry.hpp:103
mgx::Matrix6x12d
Matrix< 6, 12, double > Matrix6x12d
Definition: Geometry.hpp:127
mgx::Matrix4x3u
Matrix< 4, 3, uint > Matrix4x3u
Definition: Geometry.hpp:102
n
#define n
Definition: Eigenvalues.hpp:36
mgx::Vector::z
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
Definition: Vector.hpp:739
mgx::triangleArea
CU_HOST_DEVICE T triangleArea(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
Definition: Geometry.hpp:293
mgx::Point3
CU_HOST_DEVICE Point3(T) triangleGradient(const Point3(T) &p1
mgx::rayTriangleIntersect
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)
Definition: Geometry.hpp:332
mgx::Matrix3d
Matrix< 3, 3, double > Matrix3d
Definition: Geometry.hpp:111
mgx::ushort
unsigned short ushort
Simpler names for the various containers and iterators.
Definition: Geometry.hpp:42
mgx::Matrix2f
Matrix< 2, 2, float > Matrix2f
Definition: Geometry.hpp:95
mgx::toVoxelsCeil
CU_HOST_DEVICE Point3u toVoxelsCeil(const Point3(T) &p, const Point3(T) &step)
Definition: Geometry.hpp:153
mgx::Point18d
Vector< 18, double > Point18d
Definition: Geometry.hpp:65
mgx::Point4u
Vector< 4, uint > Point4u
Definition: Geometry.hpp:76
mgx::c2
CU_HOST_DEVICE const const T T c2
Definition: Geometry.hpp:234
mgx::Point1d
Vector< 1, double > Point1d
Definition: Geometry.hpp:54
mgx::Matrix3u
Matrix< 3, 3, uint > Matrix3u
Definition: Geometry.hpp:100
mgx::Point6u
Vector< 6, uint > Point6u
Definition: Geometry.hpp:78
mgx::area2
T area2
Definition: Geometry.hpp:237
mgx::getOffset
CU_HOST_DEVICE size_t getOffset(const int x, const int y, const int z, const Point3i &size)
Definition: Geometry.hpp:437
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::Matrix5x3d
Matrix< 5, 3, double > Matrix5x3d
Definition: Geometry.hpp:122
mgx::Point5u
Vector< 5, uint > Point5u
Definition: Geometry.hpp:77
mgx::Matrix4d
Matrix< 4, 4, double > Matrix4d
Definition: Geometry.hpp:119
mgx::Point5s
Vector< 5, size_t > Point5s
Definition: Geometry.hpp:89
mgx::Point6f
Vector< 6, float > Point6f
Definition: Geometry.hpp:51
mgx::Matrix6x3d
Matrix< 6, 3, double > Matrix6x3d
Definition: Geometry.hpp:126
mgx::Point1u
Vector< 1, uint > Point1u
Definition: Geometry.hpp:73
mgx::Point8d
Vector< 8, double > Point8d
Definition: Geometry.hpp:61
mgx::interpolate
T CU_HOST_DEVICE interpolate(const T &a, const T &b, const T &s)
Interpolate between values.
Definition: Geometry.hpp:177
mgx::imageToWorld
CU_HOST_DEVICE Point3f imageToWorld(const Point3i &img, const Point3f &step, const Point3f &shift)
Definition: Geometry.hpp:418
mgx::BoundingBox3i
BoundingBox< 3, int > BoundingBox3i
Definition: Geometry.hpp:141
mgx::distLinePoint
CU_HOST_DEVICE T distLinePoint(const Point3(T) &v1, const Point3(T) &_v2, const Point3(T) &_p, bool segment)
Definition: Geometry.hpp:385
mgx::BoundingBox3f
BoundingBox< 3, float > BoundingBox3f
Definition: Geometry.hpp:142
mgx::Matrix4x2d
Matrix< 4, 2, double > Matrix4x2d
Definition: Geometry.hpp:117
mgx::nrml
nrml
Definition: Geometry.hpp:240
mgx::Point3f
Vector< 3, float > Point3f
Definition: CuttingSurface.hpp:25
mgx::trim
CU_HOST_DEVICE T trim(const T x, const T minx, const T maxx)
Definition: Util.hpp:42
mgx::Matrix4f
Matrix< 4, 4, float > Matrix4f
Definition: Geometry.hpp:97
mgx::Matrix12x3d
Matrix< 12, 3, double > Matrix12x3d
Definition: Geometry.hpp:135
mgx::Point6d
Vector< 6, double > Point6d
Definition: Geometry.hpp:59
mgx::Point3d
Vector< 3, double > Point3d
Definition: Geometry.hpp:56
mgx::Matrix3x6d
Matrix< 3, 6, double > Matrix3x6d
Definition: Geometry.hpp:113
mgx::Vector::y
CU_HOST_DEVICE void y(const T &v)
Short access to the second element.
Definition: Vector.hpp:730
mgx::Point12f
Vector< 12, float > Point12f
Definition: Geometry.hpp:52
mgx::SymmetricTensor
SymmetricTensor SymmetricTensor
Definition: Geometry.hpp:45
Util.hpp
mgx::getBasisFromPlane
CU_HOST_DEVICE void getBasisFromPlane(const Point3(T) &nrml, Point3(T)&x, Point3(T) &y, Point3(T) &z)
Definition: Geometry.hpp:307
mgx::Matrix6d
Matrix< 6, 6, double > Matrix6d
Definition: Geometry.hpp:125
mgx::Point4i
Vector< 4, int > Point4i
Definition: Geometry.hpp:69
mgx::c1
CU_HOST_DEVICE const const T c1
Definition: Geometry.hpp:234
mgx::ubyte
unsigned char ubyte
This filee contains different useful geometry algorithms, like intersections, areas,...
Definition: Geometry.hpp:39
CudaGlobal.hpp
mgx::multMatrix4Point3
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.
Definition: Geometry.hpp:167
mgx::Point12d
Vector< 12, double > Point12d
Definition: Geometry.hpp:63
mgx::Point4d
Vector< 4, double > Point4d
Definition: Geometry.hpp:57
mgx::Point12u
Vector< 12, uint > Point12u
Definition: Geometry.hpp:79
mgx::Point5f
Vector< 5, float > Point5f
Definition: Geometry.hpp:50
mgx::Matrix2u
Matrix< 2, 2, uint > Matrix2u
Definition: Geometry.hpp:99
mgx::Point2d
Vector< 2, double > Point2d
Definition: Geometry.hpp:55
mgx::Matrix2x3d
Matrix< 2, 3, double > Matrix2x3d
Definition: Geometry.hpp:107
mgx::Point2f
Vector< 2, float > Point2f
Definition: ColorMap.hpp:19
mgx::uchar
unsigned char uchar
Definition: Geometry.hpp:40
mgx::Matrix2x6d
Matrix< 2, 6, double > Matrix2x6d
Definition: Geometry.hpp:108
mgx::Point30u
Vector< 30, uint > Point30u
Definition: Geometry.hpp:80
mgx::Vector< 2, float >
mgx::Matrix6x18d
Matrix< 6, 18, double > Matrix6x18d
Definition: Geometry.hpp:128
mgx::norm
ScalarT norm(DVector< DistNhbdT, MatrixT, VectorT, ScalarT > &v)
Definition: DistMatrix.hpp:540
mgx::Point3u
Vector< 3, uint > Point3u
Definition: Geometry.hpp:75
Matrix.hpp
mgx::Point3uc
Vector< 3, uchar > Point3uc
Definition: Geometry.hpp:92
mgx::Point6s
Vector< 6, size_t > Point6s
Definition: Geometry.hpp:90
mgx::Matrix12d
Matrix< 12, 12, double > Matrix12d
Definition: Geometry.hpp:136
mgx::Point9d
Vector< 9, double > Point9d
Definition: Geometry.hpp:62
CU_HOST_DEVICE
#define CU_HOST_DEVICE
Definition: CudaGlobal.hpp:22
mgx::BoundingBox3u
BoundingBox< 3, uint > BoundingBox3u
Definition: Geometry.hpp:140
SymmetricTensor.hpp
mgx::Point3i
Vector< 3, int > Point3i
Definition: Geometry.hpp:68
mgx::Point4s
Vector< 4, size_t > Point4s
Definition: Geometry.hpp:88
mgx::c3
CU_HOST_DEVICE const const T T T c3
Definition: Geometry.hpp:235
mgx::Matrix9x3d
Matrix< 9, 3, double > Matrix9x3d
Definition: Geometry.hpp:130
mgx::Matrix3x2d
Matrix< 3, 2, double > Matrix3x2d
Definition: Geometry.hpp:110
mgx::Point3ul
Vector< 3, ulong > Point3ul
Definition: Geometry.hpp:84
mgx::Point16d
Vector< 16, double > Point16d
Definition: Geometry.hpp:64
mgx::Matrix18d
Matrix< 18, 18, double > Matrix18d
Definition: Geometry.hpp:138
BoundingBox.hpp
mgx::Point5i
Vector< 5, int > Point5i
Definition: Geometry.hpp:70
mgx::Vector::x
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
Definition: Vector.hpp:721
mgx::Matrix1d
Matrix< 1, 1, double > Matrix1d
Definition: Geometry.hpp:105
mgx::Matrix
Definition: Matrix.hpp:39
mgx::offset
CU_HOST_DEVICE size_t offset(uint x, uint y, uint z, uint xsz, uint ysz)
Definition: Geometry.hpp:431
mgx::ulong
unsigned long ulong
Definition: Geometry.hpp:43
mgx::isNan
CU_HOST_DEVICE bool isNan(float s)
Definition: Geometry.hpp:148
mgx::planeLineIntersect
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.
Definition: Geometry.hpp:217
mgx::BoundingBox
Definition: BoundingBox.hpp:23
mgx::Matrix3f
Matrix< 3, 3, float > Matrix3f
Definition: Geometry.hpp:96
mgx::Point6i
Vector< 6, int > Point6i
Definition: Geometry.hpp:71
mgx::Matrix4u
Matrix< 4, 4, uint > Matrix4u
Definition: Geometry.hpp:101
mgx::Point3us
Vector< 3, ushort > Point3us
Definition: Geometry.hpp:82