Blender  V3.3
numeric.h
Go to the documentation of this file.
1 // Copyright (c) 2007, 2008_WIN32 libmv authors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 // IN THE SOFTWARE.
20 //
21 // Matrix and vector classes, based on Eigen2.
22 //
23 // Avoid using Eigen2 classes directly; instead typedef them here.
24 
25 #ifndef LIBMV_NUMERIC_NUMERIC_H
26 #define LIBMV_NUMERIC_NUMERIC_H
27 
28 #include <Eigen/Cholesky>
29 #include <Eigen/Core>
30 #include <Eigen/Eigenvalues>
31 #include <Eigen/Geometry>
32 #include <Eigen/LU>
33 #include <Eigen/QR>
34 #include <Eigen/SVD>
35 
36 #if !defined(__MINGW64__)
37 # if defined(_WIN32) || defined(__APPLE__) || defined(__NetBSD__) || \
38  defined(__HAIKU__)
39 inline void sincos(double x, double* sinx, double* cosx) {
40  *sinx = sin(x);
41  *cosx = cos(x);
42 }
43 # endif
44 #endif // !__MINGW64__
45 
46 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
47 inline long lround(double d) {
48  return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
49 }
50 # if _MSC_VER < 1800
51 inline int round(double d) {
52  return (d > 0) ? int(d + 0.5) : int(d - 0.5);
53 }
54 # endif // _MSC_VER < 1800
55 typedef unsigned int uint;
56 #endif // _WIN32
57 
58 namespace libmv {
59 
60 typedef Eigen::MatrixXd Mat;
61 typedef Eigen::VectorXd Vec;
62 
63 typedef Eigen::MatrixXf Matf;
64 typedef Eigen::VectorXf Vecf;
65 
66 typedef Eigen::Matrix<unsigned int, Eigen::Dynamic, Eigen::Dynamic> Matu;
67 typedef Eigen::Matrix<unsigned int, Eigen::Dynamic, 1> Vecu;
68 typedef Eigen::Matrix<unsigned int, 2, 1> Vec2u;
69 
70 typedef Eigen::Matrix<double, 2, 2> Mat2;
71 typedef Eigen::Matrix<double, 2, 3> Mat23;
72 typedef Eigen::Matrix<double, 3, 3> Mat3;
73 typedef Eigen::Matrix<double, 3, 4> Mat34;
74 typedef Eigen::Matrix<double, 3, 5> Mat35;
75 typedef Eigen::Matrix<double, 4, 1> Mat41;
76 typedef Eigen::Matrix<double, 4, 3> Mat43;
77 typedef Eigen::Matrix<double, 4, 4> Mat4;
78 typedef Eigen::Matrix<double, 4, 6> Mat46;
79 typedef Eigen::Matrix<float, 2, 2> Mat2f;
80 typedef Eigen::Matrix<float, 2, 3> Mat23f;
81 typedef Eigen::Matrix<float, 3, 3> Mat3f;
82 typedef Eigen::Matrix<float, 3, 4> Mat34f;
83 typedef Eigen::Matrix<float, 3, 5> Mat35f;
84 typedef Eigen::Matrix<float, 4, 3> Mat43f;
85 typedef Eigen::Matrix<float, 4, 4> Mat4f;
86 typedef Eigen::Matrix<float, 4, 6> Mat46f;
87 
88 typedef Eigen::Matrix<double, 3, 3, Eigen::RowMajor> RMat3;
89 typedef Eigen::Matrix<double, 4, 4, Eigen::RowMajor> RMat4;
90 
91 typedef Eigen::Matrix<double, 2, Eigen::Dynamic> Mat2X;
92 typedef Eigen::Matrix<double, 3, Eigen::Dynamic> Mat3X;
93 typedef Eigen::Matrix<double, 4, Eigen::Dynamic> Mat4X;
94 typedef Eigen::Matrix<double, Eigen::Dynamic, 2> MatX2;
95 typedef Eigen::Matrix<double, Eigen::Dynamic, 3> MatX3;
96 typedef Eigen::Matrix<double, Eigen::Dynamic, 4> MatX4;
97 typedef Eigen::Matrix<double, Eigen::Dynamic, 5> MatX5;
98 typedef Eigen::Matrix<double, Eigen::Dynamic, 6> MatX6;
99 typedef Eigen::Matrix<double, Eigen::Dynamic, 7> MatX7;
100 typedef Eigen::Matrix<double, Eigen::Dynamic, 8> MatX8;
101 typedef Eigen::Matrix<double, Eigen::Dynamic, 9> MatX9;
102 typedef Eigen::Matrix<double, Eigen::Dynamic, 15> MatX15;
103 typedef Eigen::Matrix<double, Eigen::Dynamic, 16> MatX16;
104 
105 typedef Eigen::Vector2d Vec2;
106 typedef Eigen::Vector3d Vec3;
107 typedef Eigen::Vector4d Vec4;
108 typedef Eigen::Matrix<double, 5, 1> Vec5;
109 typedef Eigen::Matrix<double, 6, 1> Vec6;
110 typedef Eigen::Matrix<double, 7, 1> Vec7;
111 typedef Eigen::Matrix<double, 8, 1> Vec8;
112 typedef Eigen::Matrix<double, 9, 1> Vec9;
113 typedef Eigen::Matrix<double, 10, 1> Vec10;
114 typedef Eigen::Matrix<double, 11, 1> Vec11;
115 typedef Eigen::Matrix<double, 12, 1> Vec12;
116 typedef Eigen::Matrix<double, 13, 1> Vec13;
117 typedef Eigen::Matrix<double, 14, 1> Vec14;
118 typedef Eigen::Matrix<double, 15, 1> Vec15;
119 typedef Eigen::Matrix<double, 16, 1> Vec16;
120 typedef Eigen::Matrix<double, 17, 1> Vec17;
121 typedef Eigen::Matrix<double, 18, 1> Vec18;
122 typedef Eigen::Matrix<double, 19, 1> Vec19;
123 typedef Eigen::Matrix<double, 20, 1> Vec20;
124 
125 typedef Eigen::Vector2f Vec2f;
126 typedef Eigen::Vector3f Vec3f;
127 typedef Eigen::Vector4f Vec4f;
128 
129 typedef Eigen::VectorXi VecXi;
130 
131 typedef Eigen::Vector2i Vec2i;
132 typedef Eigen::Vector3i Vec3i;
133 typedef Eigen::Vector4i Vec4i;
134 
135 typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
137 
138 typedef Eigen::NumTraits<double> EigenDouble;
139 
140 using Eigen::Dynamic;
141 using Eigen::Map;
142 using Eigen::Matrix;
143 
144 // Find U, s, and VT such that
145 //
146 // A = U * diag(s) * VT
147 //
148 template <typename TMat, typename TVec>
149 inline void SVD(TMat* /*A*/, Vec* /*s*/, Mat* /*U*/, Mat* /*VT*/) {
150  assert(0);
151 }
152 
153 // Solve the linear system Ax = 0 via SVD. Store the solution in x, such that
154 // ||x|| = 1.0. Return the singluar value corresponding to the solution.
155 // Destroys A and resizes x if necessary.
156 // TODO(maclean): Take the SVD of the transpose instead of this zero padding.
157 template <typename TMat, typename TVec>
158 double Nullspace(TMat* A, TVec* nullspace) {
159  Eigen::JacobiSVD<TMat> svd(*A, Eigen::ComputeFullV);
160  (*nullspace) = svd.matrixV().col(A->cols() - 1);
161  if (A->rows() >= A->cols())
162  return svd.singularValues()(A->cols() - 1);
163  else
164  return 0.0;
165 }
166 
167 // Solve the linear system Ax = 0 via SVD. Finds two solutions, x1 and x2, such
168 // that x1 is the best solution and x2 is the next best solution (in the L2
169 // norm sense). Store the solution in x1 and x2, such that ||x|| = 1.0. Return
170 // the singluar value corresponding to the solution x1. Destroys A and resizes
171 // x if necessary.
172 template <typename TMat, typename TVec1, typename TVec2>
173 double Nullspace2(TMat* A, TVec1* x1, TVec2* x2) {
174  Eigen::JacobiSVD<TMat> svd(*A, Eigen::ComputeFullV);
175  *x1 = svd.matrixV().col(A->cols() - 1);
176  *x2 = svd.matrixV().col(A->cols() - 2);
177  if (A->rows() >= A->cols())
178  return svd.singularValues()(A->cols() - 1);
179  else
180  return 0.0;
181 }
182 
183 // In place transpose for square matrices.
184 template <class TA>
185 inline void TransposeInPlace(TA* A) {
186  *A = A->transpose().eval();
187 }
188 
189 template <typename TVec>
190 inline double NormL1(const TVec& x) {
191  return x.array().abs().sum();
192 }
193 
194 template <typename TVec>
195 inline double NormL2(const TVec& x) {
196  return x.norm();
197 }
198 
199 template <typename TVec>
200 inline double NormLInfinity(const TVec& x) {
201  return x.array().abs().maxCoeff();
202 }
203 
204 template <typename TVec>
205 inline double DistanceL1(const TVec& x, const TVec& y) {
206  return (x - y).array().abs().sum();
207 }
208 
209 template <typename TVec>
210 inline double DistanceL2(const TVec& x, const TVec& y) {
211  return (x - y).norm();
212 }
213 template <typename TVec>
214 inline double DistanceLInfinity(const TVec& x, const TVec& y) {
215  return (x - y).array().abs().maxCoeff();
216 }
217 
218 // Normalize a vector with the L1 norm, and return the norm before it was
219 // normalized.
220 template <typename TVec>
221 inline double NormalizeL1(TVec* x) {
222  double norm = NormL1(*x);
223  *x /= norm;
224  return norm;
225 }
226 
227 // Normalize a vector with the L2 norm, and return the norm before it was
228 // normalized.
229 template <typename TVec>
230 inline double NormalizeL2(TVec* x) {
231  double norm = NormL2(*x);
232  *x /= norm;
233  return norm;
234 }
235 
236 // Normalize a vector with the L^Infinity norm, and return the norm before it
237 // was normalized.
238 template <typename TVec>
239 inline double NormalizeLInfinity(TVec* x) {
240  double norm = NormLInfinity(*x);
241  *x /= norm;
242  return norm;
243 }
244 
245 // Return the square of a number.
246 template <typename T>
247 inline T Square(T x) {
248  return x * x;
249 }
250 
251 Mat3 RotationAroundX(double angle);
252 Mat3 RotationAroundY(double angle);
253 Mat3 RotationAroundZ(double angle);
254 
255 // Returns the rotation matrix of a rotation of angle |axis| around axis.
256 // This is computed using the Rodrigues formula, see:
257 // http://mathworld.wolfram.com/RodriguesRotationFormula.html
258 Mat3 RotationRodrigues(const Vec3& axis);
259 
260 // Make a rotation matrix such that center becomes the direction of the
261 // positive z-axis, and y is oriented close to up.
263 
264 // Return a diagonal matrix from a vector containing the diagonal values.
265 template <typename TVec>
266 inline Mat Diag(const TVec& x) {
267  return x.asDiagonal();
268 }
269 
270 template <typename TMat>
271 inline double FrobeniusNorm(const TMat& A) {
272  return sqrt(A.array().abs2().sum());
273 }
274 
275 template <typename TMat>
276 inline double FrobeniusDistance(const TMat& A, const TMat& B) {
277  return FrobeniusNorm(A - B);
278 }
279 
280 inline Vec3 CrossProduct(const Vec3& x, const Vec3& y) {
281  return x.cross(y);
282 }
283 
284 Mat3 CrossProductMatrix(const Vec3& x);
285 
286 void MeanAndVarianceAlongRows(const Mat& A,
287  Vec* mean_pointer,
288  Vec* variance_pointer);
289 
290 #if defined(_WIN32)
291 // TODO(bomboze): un-#if this for both platforms once tested under Windows
292 /* This solution was extensively discussed here
293  http://forum.kde.org/viewtopic.php?f=74&t=61940 */
294 # define SUM_OR_DYNAMIC(x, y) \
295  (x == Eigen::Dynamic || y == Eigen::Dynamic) ? Eigen::Dynamic : (x + y)
296 
297 template <typename Derived1, typename Derived2>
298 struct hstack_return {
299  typedef typename Derived1::Scalar Scalar;
300  enum {
301  RowsAtCompileTime = Derived1::RowsAtCompileTime,
302  ColsAtCompileTime = SUM_OR_DYNAMIC(Derived1::ColsAtCompileTime,
303  Derived2::ColsAtCompileTime),
304  Options = Derived1::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : 0,
305  MaxRowsAtCompileTime = Derived1::MaxRowsAtCompileTime,
306  MaxColsAtCompileTime = SUM_OR_DYNAMIC(Derived1::MaxColsAtCompileTime,
307  Derived2::MaxColsAtCompileTime)
308  };
309  typedef Eigen::Matrix<Scalar,
310  RowsAtCompileTime,
311  ColsAtCompileTime,
312  Options,
313  MaxRowsAtCompileTime,
314  MaxColsAtCompileTime>
315  type;
316 };
317 
318 template <typename Derived1, typename Derived2>
320  const Eigen::MatrixBase<Derived1>& lhs,
321  const Eigen::MatrixBase<Derived2>& rhs) {
323  res.resize(lhs.rows(), lhs.cols() + rhs.cols());
324  res << lhs, rhs;
325  return res;
326 };
327 
328 template <typename Derived1, typename Derived2>
329 struct vstack_return {
330  typedef typename Derived1::Scalar Scalar;
331  enum {
332  RowsAtCompileTime = SUM_OR_DYNAMIC(Derived1::RowsAtCompileTime,
333  Derived2::RowsAtCompileTime),
334  ColsAtCompileTime = Derived1::ColsAtCompileTime,
335  Options = Derived1::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : 0,
336  MaxRowsAtCompileTime = SUM_OR_DYNAMIC(Derived1::MaxRowsAtCompileTime,
337  Derived2::MaxRowsAtCompileTime),
338  MaxColsAtCompileTime = Derived1::MaxColsAtCompileTime
339  };
340  typedef Eigen::Matrix<Scalar,
341  RowsAtCompileTime,
342  ColsAtCompileTime,
343  Options,
344  MaxRowsAtCompileTime,
345  MaxColsAtCompileTime>
346  type;
347 };
348 
349 template <typename Derived1, typename Derived2>
351  const Eigen::MatrixBase<Derived1>& lhs,
352  const Eigen::MatrixBase<Derived2>& rhs) {
354  res.resize(lhs.rows() + rhs.rows(), lhs.cols());
355  res << lhs, rhs;
356  return res;
357 };
358 
359 #else // _WIN32
360 
361 // Since it is not possible to typedef privately here, use a macro.
362 // Always take dynamic columns if either side is dynamic.
363 # define COLS \
364  ((ColsLeft == Eigen::Dynamic || ColsRight == Eigen::Dynamic) \
365  ? Eigen::Dynamic \
366  : (ColsLeft + ColsRight))
367 
368 // Same as above, except that prefer fixed size if either is fixed.
369 # define ROWS \
370  ((RowsLeft == Eigen::Dynamic && RowsRight == Eigen::Dynamic) \
371  ? Eigen::Dynamic \
372  : ((RowsLeft == Eigen::Dynamic) ? RowsRight : RowsLeft))
373 
374 // TODO(keir): Add a static assert if both rows are at compiletime.
375 template <typename T, int RowsLeft, int RowsRight, int ColsLeft, int ColsRight>
376 Eigen::Matrix<T, ROWS, COLS> HStack(
377  const Eigen::Matrix<T, RowsLeft, ColsLeft>& left,
378  const Eigen::Matrix<T, RowsRight, ColsRight>& right) {
379  assert(left.rows() == right.rows());
380  int n = left.rows();
381  int m1 = left.cols();
382  int m2 = right.cols();
383 
384  Eigen::Matrix<T, ROWS, COLS> stacked(n, m1 + m2);
385  stacked.block(0, 0, n, m1) = left;
386  stacked.block(0, m1, n, m2) = right;
387  return stacked;
388 }
389 
390 // Reuse the above macros by swapping the order of Rows and Cols. Nasty, but
391 // the duplication is worse.
392 // TODO(keir): Add a static assert if both rows are at compiletime.
393 // TODO(keir): Mail eigen list about making this work for general expressions
394 // rather than only matrix types.
395 template <typename T, int RowsLeft, int RowsRight, int ColsLeft, int ColsRight>
396 Eigen::Matrix<T, COLS, ROWS> VStack(
397  const Eigen::Matrix<T, ColsLeft, RowsLeft>& top,
398  const Eigen::Matrix<T, ColsRight, RowsRight>& bottom) {
399  assert(top.cols() == bottom.cols());
400  int n1 = top.rows();
401  int n2 = bottom.rows();
402  int m = top.cols();
403 
404  Eigen::Matrix<T, COLS, ROWS> stacked(n1 + n2, m);
405  stacked.block(0, 0, n1, m) = top;
406  stacked.block(n1, 0, n2, m) = bottom;
407  return stacked;
408 }
409 # undef COLS
410 # undef ROWS
411 #endif // _WIN32
412 
413 void HorizontalStack(const Mat& left, const Mat& right, Mat* stacked);
414 
415 template <typename TTop, typename TBot, typename TStacked>
416 void VerticalStack(const TTop& top, const TBot& bottom, TStacked* stacked) {
417  assert(top.cols() == bottom.cols());
418  int n1 = top.rows();
419  int n2 = bottom.rows();
420  int m = top.cols();
421 
422  stacked->resize(n1 + n2, m);
423  stacked->block(0, 0, n1, m) = top;
424  stacked->block(n1, 0, n2, m) = bottom;
425 }
426 
427 void MatrixColumn(const Mat& A, int i, Vec2* v);
428 void MatrixColumn(const Mat& A, int i, Vec3* v);
429 void MatrixColumn(const Mat& A, int i, Vec4* v);
430 
431 template <typename TMat, typename TCols>
432 TMat ExtractColumns(const TMat& A, const TCols& columns) {
433  TMat compressed(A.rows(), columns.size());
434  for (int i = 0; i < columns.size(); ++i) {
435  compressed.col(i) = A.col(columns[i]);
436  }
437  return compressed;
438 }
439 
440 template <typename TMat, typename TDest>
441 void reshape(const TMat& a, int rows, int cols, TDest* b) {
442  assert(a.rows() * a.cols() == rows * cols);
443  b->resize(rows, cols);
444  for (int i = 0; i < rows; i++) {
445  for (int j = 0; j < cols; j++) {
446  (*b)(i, j) = a[cols * i + j];
447  }
448  }
449 }
450 
451 inline bool isnan(double i) {
452 #ifdef WIN32
453  return _isnan(i) > 0;
454 #else
455  return std::isnan(i);
456 #endif
457 }
458 
461 template <typename FloatType>
462 FloatType ceil0(const FloatType& value) {
463  FloatType result = std::ceil(std::fabs(value));
464  return (value < 0.0) ? -result : result;
465 }
466 
468 inline Mat3 SkewMat(const Vec3& x) {
469  Mat3 skew;
470  skew << 0, -x(2), x(1), x(2), 0, -x(0), -x(1), x(0), 0;
471  return skew;
472 }
475 inline Mat23 SkewMatMinimal(const Vec2& x) {
476  Mat23 skew;
477  skew << 0, -1, x(1), 1, 0, -x(0);
478  return skew;
479 }
480 
482 inline Mat3 RotationFromEulerVector(Vec3 euler_vector) {
483  double theta = euler_vector.norm();
484  if (theta == 0.0) {
485  return Mat3::Identity();
486  }
487  Vec3 w = euler_vector / theta;
488  Mat3 w_hat = CrossProductMatrix(w);
489  return Mat3::Identity() + w_hat * sin(theta) +
490  w_hat * w_hat * (1 - cos(theta));
491 }
492 } // namespace libmv
493 
494 #endif // LIBMV_NUMERIC_NUMERIC_H
sqrt(x)+1/max(0
unsigned int uint
Definition: BLI_sys_types.h:67
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble bottom
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Map
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define A
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
Definition: btVector3.h:263
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
float Scalar
Definition: eigen_utils.h:26
float[3][3] Mat3
Definition: gpu_matrix.cc:27
ccl_device_inline float2 fabs(const float2 &a)
Definition: math_float2.h:222
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
static int left
#define T
#define B
static unsigned a[3]
Definition: RandGen.cpp:78
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:311
double DistanceLInfinity(const TVec &x, const TVec &y)
Definition: numeric.h:214
Eigen::Matrix< double, 19, 1 > Vec19
Definition: numeric.h:122
T Square(T x)
Definition: numeric.h:247
Eigen::Matrix< float, 3, 5 > Mat35f
Definition: numeric.h:83
Mat Diag(const TVec &x)
Definition: numeric.h:266
Eigen::VectorXd Vec
Definition: numeric.h:61
bool isnan(double i)
Definition: numeric.h:451
Eigen::Matrix< double, 11, 1 > Vec11
Definition: numeric.h:114
Eigen::Vector4i Vec4i
Definition: numeric.h:133
double Nullspace(TMat *A, TVec *nullspace)
Definition: numeric.h:158
Eigen::Vector4d Vec4
Definition: numeric.h:107
Eigen::Matrix< double, 6, 1 > Vec6
Definition: numeric.h:109
double NormL2(const TVec &x)
Definition: numeric.h:195
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > RMat3
Definition: numeric.h:88
Eigen::Matrix< double, 13, 1 > Vec13
Definition: numeric.h:116
Mat3 CrossProductMatrix(const Vec3 &x)
Definition: numeric.cc:80
double DistanceL1(const TVec &x, const TVec &y)
Definition: numeric.h:205
Eigen::Matrix< double, 10, 1 > Vec10
Definition: numeric.h:113
Mat3 RotationFromEulerVector(Vec3 euler_vector)
Returns the rotaiton matrix built from given vector of euler angles.
Definition: numeric.h:482
void TransposeInPlace(TA *A)
Definition: numeric.h:185
Eigen::Matrix< double, Eigen::Dynamic, 2 > MatX2
Definition: numeric.h:94
Eigen::Vector3i Vec3i
Definition: numeric.h:132
Eigen::Matrix< double, 4, 4 > Mat4
Definition: numeric.h:77
void VerticalStack(const TTop &top, const TBot &bottom, TStacked *stacked)
Definition: numeric.h:416
Eigen::Matrix< double, 4, 1 > Mat41
Definition: numeric.h:75
Eigen::Matrix< double, Eigen::Dynamic, 3 > MatX3
Definition: numeric.h:95
Eigen::Matrix< double, Eigen::Dynamic, 15 > MatX15
Definition: numeric.h:102
double DistanceL2(const TVec &x, const TVec &y)
Definition: numeric.h:210
Eigen::Matrix< double, 3, 3 > Mat3
Definition: numeric.h:72
void SVD(TMat *, Vec *, Mat *, Mat *)
Definition: numeric.h:149
Eigen::Matrix< double, Eigen::Dynamic, 4 > MatX4
Definition: numeric.h:96
Eigen::Vector2d Vec2
Definition: numeric.h:105
Eigen::Matrix< double, Eigen::Dynamic, 5 > MatX5
Definition: numeric.h:97
double NormalizeL1(TVec *x)
Definition: numeric.h:221
Mat3 RotationAroundX(double angle)
Definition: numeric.cc:25
Eigen::Matrix< T, ROWS, COLS > HStack(const Eigen::Matrix< T, RowsLeft, ColsLeft > &left, const Eigen::Matrix< T, RowsRight, ColsRight > &right)
Definition: numeric.h:376
Eigen::Matrix< float, 2, 2 > Mat2f
Definition: numeric.h:79
double NormLInfinity(const TVec &x)
Definition: numeric.h:200
Eigen::Matrix< float, 4, 3 > Mat43f
Definition: numeric.h:84
double FrobeniusDistance(const TMat &A, const TMat &B)
Definition: numeric.h:276
Eigen::Matrix< double, 4, 4, Eigen::RowMajor > RMat4
Definition: numeric.h:89
Eigen::VectorXf Vecf
Definition: numeric.h:64
Eigen::Matrix< double, 14, 1 > Vec14
Definition: numeric.h:117
Eigen::Matrix< double, 4, 6 > Mat46
Definition: numeric.h:78
Eigen::MatrixXd Mat
Definition: numeric.h:60
void MatrixColumn(const Mat &A, int i, Vec2 *v)
Definition: numeric.cc:127
void MeanAndVarianceAlongRows(const Mat &A, Vec *mean_pointer, Vec *variance_pointer)
Definition: numeric.cc:90
Mat23 SkewMatMinimal(const Vec2 &x)
Definition: numeric.h:475
Eigen::Matrix< double, 7, 1 > Vec7
Definition: numeric.h:110
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > RMatf
Definition: numeric.h:136
Eigen::Vector4f Vec4f
Definition: numeric.h:127
Eigen::Matrix< double, Eigen::Dynamic, 9 > MatX9
Definition: numeric.h:101
double NormalizeLInfinity(TVec *x)
Definition: numeric.h:239
Eigen::Matrix< double, Eigen::Dynamic, 8 > MatX8
Definition: numeric.h:100
Eigen::NumTraits< double > EigenDouble
Definition: numeric.h:138
Eigen::MatrixXf Matf
Definition: numeric.h:63
Eigen::Matrix< float, 3, 3 > Mat3f
Definition: numeric.h:81
Mat3 RotationRodrigues(const Vec3 &axis)
Definition: numeric.cc:61
Eigen::Matrix< double, 2, 3 > Mat23
Definition: numeric.h:71
Eigen::Matrix< double, 3, 4 > Mat34
Definition: numeric.h:73
Eigen::Matrix< double, Eigen::Dynamic, 7 > MatX7
Definition: numeric.h:99
Eigen::Matrix< double, 8, 1 > Vec8
Definition: numeric.h:111
Eigen::Matrix< unsigned int, Eigen::Dynamic, 1 > Vecu
Definition: numeric.h:67
Mat3 SkewMat(const Vec3 &x)
Returns the skew anti-symmetric matrix of a vector.
Definition: numeric.h:468
Eigen::Vector3f Vec3f
Definition: numeric.h:126
Eigen::Matrix< double, 18, 1 > Vec18
Definition: numeric.h:121
Eigen::VectorXi VecXi
Definition: numeric.h:129
Eigen::Matrix< double, Eigen::Dynamic, 16 > MatX16
Definition: numeric.h:103
Eigen::Matrix< double, 5, 1 > Vec5
Definition: numeric.h:108
Eigen::Matrix< double, 15, 1 > Vec15
Definition: numeric.h:118
FloatType ceil0(const FloatType &value)
Definition: numeric.h:462
Eigen::Vector3d Vec3
Definition: numeric.h:106
Eigen::Matrix< double, 4, Eigen::Dynamic > Mat4X
Definition: numeric.h:93
Eigen::Matrix< double, 3, Eigen::Dynamic > Mat3X
Definition: numeric.h:92
Eigen::Matrix< float, 2, 3 > Mat23f
Definition: numeric.h:80
Eigen::Matrix< float, 3, 4 > Mat34f
Definition: numeric.h:82
Eigen::Matrix< double, 3, 5 > Mat35
Definition: numeric.h:74
Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > Matu
Definition: numeric.h:66
double FrobeniusNorm(const TMat &A)
Definition: numeric.h:271
Eigen::Matrix< double, 12, 1 > Vec12
Definition: numeric.h:115
Eigen::Matrix< double, 16, 1 > Vec16
Definition: numeric.h:119
Eigen::Vector2f Vec2f
Definition: numeric.h:125
Eigen::Vector2i Vec2i
Definition: numeric.h:131
Eigen::Matrix< double, 20, 1 > Vec20
Definition: numeric.h:123
Eigen::Matrix< T, COLS, ROWS > VStack(const Eigen::Matrix< T, ColsLeft, RowsLeft > &top, const Eigen::Matrix< T, ColsRight, RowsRight > &bottom)
Definition: numeric.h:396
void HorizontalStack(const Mat &left, const Mat &right, Mat *stacked)
Definition: numeric.cc:116
Mat3 RotationAroundZ(double angle)
Definition: numeric.cc:49
void reshape(const TMat &a, int rows, int cols, TDest *b)
Definition: numeric.h:441
Eigen::Matrix< double, 9, 1 > Vec9
Definition: numeric.h:112
Eigen::Matrix< double, 2, Eigen::Dynamic > Mat2X
Definition: numeric.h:91
Mat3 RotationAroundY(double angle)
Definition: numeric.cc:37
Eigen::Matrix< float, 4, 6 > Mat46f
Definition: numeric.h:86
double NormalizeL2(TVec *x)
Definition: numeric.h:230
double Nullspace2(TMat *A, TVec1 *x1, TVec2 *x2)
Definition: numeric.h:173
Eigen::Matrix< double, 17, 1 > Vec17
Definition: numeric.h:120
Eigen::Matrix< double, 2, 2 > Mat2
Definition: numeric.h:70
TMat ExtractColumns(const TMat &A, const TCols &columns)
Definition: numeric.h:432
Eigen::Matrix< float, 4, 4 > Mat4f
Definition: numeric.h:85
Mat3 LookAt(Vec3 center)
Definition: numeric.cc:69
Eigen::Matrix< unsigned int, 2, 1 > Vec2u
Definition: numeric.h:68
Vec3 CrossProduct(const Vec3 &x, const Vec3 &y)
Definition: numeric.h:280
double NormL1(const TVec &x)
Definition: numeric.h:190
Eigen::Matrix< double, Eigen::Dynamic, 6 > MatX6
Definition: numeric.h:98
Eigen::Matrix< double, 4, 3 > Mat43
Definition: numeric.h:76
static const pxr::TfToken b("b", pxr::TfToken::Immortal)