HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImathShear.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright Contributors to the OpenEXR Project.
4 //
5 
6 //
7 // A representation of a shear transformation
8 //
9 
10 #ifndef INCLUDED_IMATHSHEAR_H
11 #define INCLUDED_IMATHSHEAR_H
12 
13 #include "ImathExport.h"
14 #include "ImathNamespace.h"
15 
16 #include "ImathMath.h"
17 #include "ImathVec.h"
18 #include <iostream>
19 
20 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
21 
22 ///
23 /// Shear6 class template.
24 ///
25 /// A shear matrix is technically defined as having a single nonzero
26 /// off-diagonal element; more generally, a shear transformation is
27 /// defined by those off-diagonal elements, so in 3D, that means there
28 /// are 6 possible elements/coefficients:
29 ///
30 /// | X' | | 1 YX ZX 0 | | X |
31 /// | Y' | | XY 1 ZY 0 | | Y |
32 /// | Z' | = | XZ YZ 1 0 | = | Z |
33 /// | 1 | | 0 0 0 1 | | 1 |
34 ///
35 /// X' = X + YX * Y + ZX * Z
36 /// Y' = YX * X + Y + ZY * Z
37 /// Z` = XZ * X + YZ * Y + Z
38 ///
39 /// See
40 /// https://www.cs.drexel.edu/~david/Classes/CS430/Lectures/L-04_3DTransformations.6.pdf
41 ///
42 /// Those variable elements correspond to the 6 values in a Shear6.
43 /// So, looking at those equations, "Shear YX", for example, means
44 /// that for any point transformed by that matrix, its X values will
45 /// have some of their Y values added. If you're talking
46 /// about "Axis A has values from Axis B added to it", there are 6
47 /// permutations for A and B (XY, XZ, YX, YZ, ZX, ZY).
48 ///
49 /// Not that Maya has only three values, which represent the
50 /// lower/upper (depending on column/row major) triangle of the
51 /// matrix. Houdini is the same as Maya (see
52 /// https://www.sidefx.com/docs/houdini/props/obj.html) in this
53 /// respect.
54 ///
55 /// There's another way to look at it. A general affine transformation
56 /// in 3D has 12 degrees of freedom - 12 "available" elements in the
57 /// 4x4 matrix since a single row/column must be (0,0,0,1). If you
58 /// add up the degrees of freedom from Maya:
59 ///
60 /// - 3 translation
61 /// - 3 rotation
62 /// - 3 scale
63 /// - 3 shear
64 ///
65 /// You obviously get the full 12. So technically, the Shear6 option
66 /// of having all 6 shear options is overkill; Imath/Shear6 has 15
67 /// values for a 12-degree-of-freedom transformation. This means that
68 /// any nonzero values in those last 3 shear coefficients can be
69 /// represented in those standard 12 degrees of freedom. Here's a
70 /// python example of how to do that:
71 ///
72 ///
73 /// >>> import imath
74 /// >>> M = imath.M44f()
75 /// >>> s = imath.V3f()
76 /// >>> h = imath.V3f()
77 /// >>> r = imath.V3f()
78 /// >>> t = imath.V3f()
79 /// # Use Shear.YX (index 3), which is an "extra" shear value
80 /// >>> M.setShear((0,0,0,1,0,0))
81 /// M44f((1, 1, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))
82 /// >>> M.extractSHRT(s, h, r, t)
83 /// 1
84 /// >>> s
85 /// V3f(1.41421354, 0.707106769, 1)
86 /// >>> h
87 /// V3f(1, 0, 0)
88 /// >>> r
89 /// V3f(0, -0, 0.785398185)
90 /// >>> t
91 /// V3f(0, 0, 0)
92 ///
93 /// That shows how to decompose a transform matrix with one of those
94 /// "extra" shear coefficients into those standard 12 degrees of
95 /// freedom. But it's not necessarily intuitive; in this case, a
96 /// single non-zero shear coefficient resulted in a transform that has
97 /// non-uniform scale, a single "standard" shear value, and some
98 /// rotation.
99 ///
100 /// So, it would seem that any transform with those extra shear
101 /// values set could be translated into Maya to produce the exact same
102 /// transformation matrix; but doing this is probably pretty
103 /// undesirable, since the result would have some surprising values on
104 /// the other transformation attributes, despite being technically
105 /// correct.
106 ///
107 /// This usage of "degrees of freedom" is a bit hand-wavey here;
108 /// having a total of 12 inputs into the construction of a standard
109 /// transformation matrix doesn't necessarily mean that the matrix has
110 /// 12 true degrees of freedom, but the standard
111 /// translation/rotation/scale/shear matrices have the right
112 /// construction to ensure that.
113 ///
114 
115 template <class T> class IMATH_EXPORT_TEMPLATE_TYPE Shear6
116 {
117 public:
118  /// @{
119  /// @name Direct access to members
120 
121  T xy, xz, yz, yx, zx, zy;
122 
123  /// @}
124 
125  /// Element access
126  ///
127  /// NB: This method of access uses dynamic array accesses which
128  /// can prevent compiler optimizations and force temporaries to be
129  /// stored to the stack and other missed vectorization
130  /// opportunities. Use of direct access to xy, xz, etc when
131  /// possible should be preferred.
132  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& operator[] (int i);
133 
134  /// Element access
135  ///
136  /// NB: This method of access uses dynamic array accesses which
137  /// can prevent compiler optimizations and force temporaries to be
138  /// stored to the stack and other missed vectorization
139  /// opportunities. Use of direct access to xy, xz, etc when
140  /// possible should be preferred.
141  IMATH_HOSTDEVICE constexpr const T& operator[] (int i) const;
142 
143  /// @{
144  /// @name Constructors and Assignment
145 
146  /// Initialize to 0
147  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 ();
148 
149  /// Initialize to the given XY, XZ, YZ values
150  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (T XY, T XZ, T YZ);
151 
152  /// Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z)
153  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Vec3<T>& v);
154 
155  /// Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z)
156  template <class S>
157  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Vec3<S>& v);
158 
159  /// Initialize to the given (XY XZ YZ YX ZX ZY) values
160  IMATH_HOSTDEVICE IMATH_CONSTEXPR14
161  Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY);
162 
163  /// Copy constructor
164  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6& h);
165 
166  /// Construct from a Shear6 object of another base type
167  template <class S>
168  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6<S>& h);
169 
170  /// Assignment
171  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
172  operator= (const Shear6& h);
173 
174  /// Assignment from vector
175  template <class S>
176  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
177  operator= (const Vec3<S>& v);
178 
179  /// Destructor
180  ~Shear6() = default;
181 
182  /// @}
183 
184  /// @{
185  /// @name Compatibility with Sb
186 
187  /// Set the value
188  template <class S>
189  IMATH_HOSTDEVICE void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY);
190 
191  /// Set the value
192  template <class S> IMATH_HOSTDEVICE void setValue (const Shear6<S>& h);
193 
194  /// Return the values
195  template <class S>
196  IMATH_HOSTDEVICE void
197  getValue (S& XY, S& XZ, S& YZ, S& YX, S& ZX, S& ZY) const;
198 
199  /// Return the value in `h`
200  template <class S> IMATH_HOSTDEVICE void getValue (Shear6<S>& h) const;
201 
202  /// Return a raw pointer to the array of values
204 
205  /// Return a raw pointer to the array of values
206  IMATH_HOSTDEVICE const T* getValue () const;
207 
208  /// @}
209 
210  /// @{
211  /// @name Arithmetic and Comparison
212 
213  /// Equality
214  template <class S>
215  IMATH_HOSTDEVICE constexpr bool operator== (const Shear6<S>& h) const;
216 
217  /// Inequality
218  template <class S>
219  IMATH_HOSTDEVICE constexpr bool operator!= (const Shear6<S>& h) const;
220 
221  /// Compare two shears and test if they are "approximately equal":
222  /// @return True if the coefficients of this and h are the same with
223  /// an absolute error of no more than e, i.e., for all i
224  /// abs (this[i] - h[i]) <= e
225  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool
226  equalWithAbsError (const Shear6<T>& h, T e) const;
227 
228  /// Compare two shears and test if they are "approximately equal":
229  /// @return True if the coefficients of this and h are the same with
230  /// a relative error of no more than e, i.e., for all i
231  /// abs (this[i] - h[i]) <= e * abs (this[i])
232  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool
233  equalWithRelError (const Shear6<T>& h, T e) const;
234 
235  /// Component-wise addition
236  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
237  operator+= (const Shear6& h);
238 
239  /// Component-wise addition
240  IMATH_HOSTDEVICE constexpr Shear6 operator+ (const Shear6& h) const;
241 
242  /// Component-wise subtraction
243  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
244  operator-= (const Shear6& h);
245 
246  /// Component-wise subtraction
247  IMATH_HOSTDEVICE constexpr Shear6 operator- (const Shear6& h) const;
248 
249  /// Component-wise multiplication by -1
250  IMATH_HOSTDEVICE constexpr Shear6 operator- () const;
251 
252  /// Component-wise multiplication by -1
253  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& negate ();
254 
255  /// Component-wise multiplication
256  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
257  operator*= (const Shear6& h);
258  /// Scalar multiplication
259  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator*= (T a);
260 
261  /// Component-wise multiplication
262  IMATH_HOSTDEVICE constexpr Shear6 operator* (const Shear6& h) const;
263 
264  /// Scalar multiplication
265  IMATH_HOSTDEVICE constexpr Shear6 operator* (T a) const;
266 
267  /// Component-wise division
268  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6&
269  operator/= (const Shear6& h);
270 
271  /// Scalar division
272  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator/= (T a);
273 
274  /// Component-wise division
275  IMATH_HOSTDEVICE constexpr Shear6 operator/ (const Shear6& h) const;
276 
277  /// Scalar division
278  IMATH_HOSTDEVICE constexpr Shear6 operator/ (T a) const;
279 
280  /// @}
281 
282  /// @{
283  /// @name Numerical Limits
284 
285  /// Largest possible negative value
287  {
288  return std::numeric_limits<T>::lowest ();
289  }
290 
291  /// Largest possible positive value
293  {
294  return std::numeric_limits<T>::max ();
295  }
296 
297  /// Smallest possible positive value
299  {
300  return std::numeric_limits<T>::min ();
301  }
302 
303  /// Smallest possible e for which 1+e != 1
305  {
306  return std::numeric_limits<T>::epsilon ();
307  }
308 
309  /// @}
310 
311  /// Return the number of dimensions, i.e. 6
312  IMATH_HOSTDEVICE constexpr static unsigned int dimensions () { return 6; }
313 
314  /// The base type: In templates that accept a parameter `V` (could
315  /// be a Color4), you can refer to `T` as `V::BaseType`
316  typedef T BaseType;
317 };
318 
319 /// Stream output, as "(xy xz yz yx zx zy)"
320 template <class T>
321 std::ostream& operator<< (std::ostream& s, const Shear6<T>& h);
322 
323 /// Reverse multiplication: scalar * Shear6<T>
324 template <class S, class T>
325 IMATH_HOSTDEVICE constexpr Shear6<T> operator* (S a, const Shear6<T>& h);
326 
327 /// 3D shear of type float
329 
330 /// 3D shear of type double
332 
333 /// Shear6 of type float
335 
336 /// Shear6 of type double
338 
339 //-----------------------
340 // Implementation of Shear6
341 //-----------------------
342 
343 template <class T>
344 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T&
346 {
347  return reinterpret_cast<T*> (this)[i];
348 }
349 
350 template <class T>
351 IMATH_HOSTDEVICE constexpr inline const T&
353 {
354  return reinterpret_cast<const T*> (this)[i];
355 }
356 
357 template <class T>
358 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 ()
359 {
360  xy = xz = yz = yx = zx = zy = 0;
361 }
362 
363 template <class T>
364 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (T XY, T XZ, T YZ)
365 {
366  xy = XY;
367  xz = XZ;
368  yz = YZ;
369  yx = 0;
370  zx = 0;
371  zy = 0;
372 }
373 
374 template <class T>
375 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (const Vec3<T>& v)
376 {
377  xy = v.x;
378  xz = v.y;
379  yz = v.z;
380  yx = 0;
381  zx = 0;
382  zy = 0;
383 }
384 
385 template <class T>
386 template <class S>
387 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (const Vec3<S>& v)
388 {
389  xy = T (v.x);
390  xz = T (v.y);
391  yz = T (v.z);
392  yx = 0;
393  zx = 0;
394  zy = 0;
395 }
396 
397 template <class T>
398 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (
399  T XY, T XZ, T YZ, T YX, T ZX, T ZY)
400 {
401  xy = XY;
402  xz = XZ;
403  yz = YZ;
404  yx = YX;
405  zx = ZX;
406  zy = ZY;
407 }
408 
409 template <class T>
410 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (const Shear6& h)
411 {
412  xy = h.xy;
413  xz = h.xz;
414  yz = h.yz;
415  yx = h.yx;
416  zx = h.zx;
417  zy = h.zy;
418 }
419 
420 template <class T>
421 template <class S>
422 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6<T>::Shear6 (const Shear6<S>& h)
423 {
424  xy = T (h.xy);
425  xz = T (h.xz);
426  yz = T (h.yz);
427  yx = T (h.yx);
428  zx = T (h.zx);
429  zy = T (h.zy);
430 }
431 
432 template <class T>
433 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
435 {
436  xy = h.xy;
437  xz = h.xz;
438  yz = h.yz;
439  yx = h.yx;
440  zx = h.zx;
441  zy = h.zy;
442  return *this;
443 }
444 
445 template <class T>
446 template <class S>
447 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
449 {
450  xy = T (v.x);
451  xz = T (v.y);
452  yz = T (v.z);
453  yx = 0;
454  zx = 0;
455  zy = 0;
456  return *this;
457 }
458 
459 template <class T>
460 template <class S>
461 IMATH_HOSTDEVICE inline void
462 Shear6<T>::setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY)
463 {
464  xy = T (XY);
465  xz = T (XZ);
466  yz = T (YZ);
467  yx = T (YX);
468  zx = T (ZX);
469  zy = T (ZY);
470 }
471 
472 template <class T>
473 template <class S>
474 IMATH_HOSTDEVICE inline void
476 {
477  xy = T (h.xy);
478  xz = T (h.xz);
479  yz = T (h.yz);
480  yx = T (h.yx);
481  zx = T (h.zx);
482  zy = T (h.zy);
483 }
484 
485 template <class T>
486 template <class S>
487 IMATH_HOSTDEVICE inline void
488 Shear6<T>::getValue (S& XY, S& XZ, S& YZ, S& YX, S& ZX, S& ZY) const
489 {
490  XY = S (xy);
491  XZ = S (xz);
492  YZ = S (yz);
493  YX = S (yx);
494  ZX = S (zx);
495  ZY = S (zy);
496 }
497 
498 template <class T>
499 template <class S>
500 IMATH_HOSTDEVICE inline void
502 {
503  h.xy = S (xy);
504  h.xz = S (xz);
505  h.yz = S (yz);
506  h.yx = S (yx);
507  h.zx = S (zx);
508  h.zy = S (zy);
509 }
510 
511 template <class T>
512 IMATH_HOSTDEVICE inline T*
514 {
515  return (T*) &xy;
516 }
517 
518 template <class T>
519 IMATH_HOSTDEVICE inline const T*
521 {
522  return (const T*) &xy;
523 }
524 
525 template <class T>
526 template <class S>
527 IMATH_HOSTDEVICE constexpr inline bool
529 {
530  return xy == h.xy && xz == h.xz && yz == h.yz && yx == h.yx && zx == h.zx &&
531  zy == h.zy;
532 }
533 
534 template <class T>
535 template <class S>
536 IMATH_HOSTDEVICE constexpr inline bool
538 {
539  return xy != h.xy || xz != h.xz || yz != h.yz || yx != h.yx || zx != h.zx ||
540  zy != h.zy;
541 }
542 
543 template <class T>
544 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool
546 {
547  for (int i = 0; i < 6; i++)
548  if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ((*this)[i], h[i], e))
549  return false;
550 
551  return true;
552 }
553 
554 template <class T>
555 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool
557 {
558  for (int i = 0; i < 6; i++)
559  if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ((*this)[i], h[i], e))
560  return false;
561 
562  return true;
563 }
564 
565 template <class T>
566 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
568 {
569  xy += h.xy;
570  xz += h.xz;
571  yz += h.yz;
572  yx += h.yx;
573  zx += h.zx;
574  zy += h.zy;
575  return *this;
576 }
577 
578 template <class T>
579 IMATH_HOSTDEVICE constexpr inline Shear6<T>
581 {
582  return Shear6 (
583  xy + h.xy, xz + h.xz, yz + h.yz, yx + h.yx, zx + h.zx, zy + h.zy);
584 }
585 
586 template <class T>
587 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
589 {
590  xy -= h.xy;
591  xz -= h.xz;
592  yz -= h.yz;
593  yx -= h.yx;
594  zx -= h.zx;
595  zy -= h.zy;
596  return *this;
597 }
598 
599 template <class T>
600 IMATH_HOSTDEVICE constexpr inline Shear6<T>
602 {
603  return Shear6 (
604  xy - h.xy, xz - h.xz, yz - h.yz, yx - h.yx, zx - h.zx, zy - h.zy);
605 }
606 
607 template <class T>
608 IMATH_HOSTDEVICE constexpr inline Shear6<T>
610 {
611  return Shear6 (-xy, -xz, -yz, -yx, -zx, -zy);
612 }
613 
614 template <class T>
615 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
617 {
618  xy = -xy;
619  xz = -xz;
620  yz = -yz;
621  yx = -yx;
622  zx = -zx;
623  zy = -zy;
624  return *this;
625 }
626 
627 template <class T>
628 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
630 {
631  xy *= h.xy;
632  xz *= h.xz;
633  yz *= h.yz;
634  yx *= h.yx;
635  zx *= h.zx;
636  zy *= h.zy;
637  return *this;
638 }
639 
640 template <class T>
641 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
643 {
644  xy *= a;
645  xz *= a;
646  yz *= a;
647  yx *= a;
648  zx *= a;
649  zy *= a;
650  return *this;
651 }
652 
653 template <class T>
654 IMATH_HOSTDEVICE constexpr inline Shear6<T>
656 {
657  return Shear6 (
658  xy * h.xy, xz * h.xz, yz * h.yz, yx * h.yx, zx * h.zx, zy * h.zy);
659 }
660 
661 template <class T>
662 IMATH_HOSTDEVICE constexpr inline Shear6<T>
664 {
665  return Shear6 (xy * a, xz * a, yz * a, yx * a, zx * a, zy * a);
666 }
667 
668 template <class T>
669 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
671 {
672  xy /= h.xy;
673  xz /= h.xz;
674  yz /= h.yz;
675  yx /= h.yx;
676  zx /= h.zx;
677  zy /= h.zy;
678  return *this;
679 }
680 
681 template <class T>
682 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6<T>&
684 {
685  xy /= a;
686  xz /= a;
687  yz /= a;
688  yx /= a;
689  zx /= a;
690  zy /= a;
691  return *this;
692 }
693 
694 template <class T>
695 IMATH_HOSTDEVICE constexpr inline Shear6<T>
697 {
698  return Shear6 (
699  xy / h.xy, xz / h.xz, yz / h.yz, yx / h.yx, zx / h.zx, zy / h.zy);
700 }
701 
702 template <class T>
703 IMATH_HOSTDEVICE constexpr inline Shear6<T>
705 {
706  return Shear6 (xy / a, xz / a, yz / a, yx / a, zx / a, zy / a);
707 }
708 
709 //-----------------------------
710 // Stream output implementation
711 //-----------------------------
712 
713 template <class T>
714 std::ostream&
715 operator<< (std::ostream& s, const Shear6<T>& h)
716 {
717  return s << '(' << h.xy << ' ' << h.xz << ' ' << h.yz << h.yx << ' ' << h.zx
718  << ' ' << h.zy << ')';
719 }
720 
721 //-----------------------------------------
722 // Implementation of reverse multiplication
723 //-----------------------------------------
724 
725 template <class S, class T>
726 IMATH_HOSTDEVICE constexpr inline Shear6<T>
728 {
729  return Shear6<T> (
730  a * h.xy, a * h.xz, a * h.yz, a * h.yx, a * h.zx, a * h.zy);
731 }
732 
733 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
734 
735 #endif // INCLUDED_IMATHSHEAR_H
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6()
Initialize to 0.
Definition: ImathShear.h:358
IMATH_HOSTDEVICE static constexpr unsigned int dimensions()
Return the number of dimensions, i.e. 6.
Definition: ImathShear.h:312
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(T x1, T x2, T e) IMATH_NOEXCEPT
Definition: ImathMath.h:151
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
Definition: Mat3.h:561
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & operator/=(const Shear6 &h)
Component-wise division.
Definition: ImathShear.h:670
T z
Definition: ImathVec.h:368
#define IMATH_NOEXCEPT
Definition: ImathConfig.h:78
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & operator-=(const Shear6 &h)
Component-wise subtraction.
Definition: ImathShear.h:588
Definition: ImathVec.h:40
const GLdouble * v
Definition: glcorearb.h:837
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(T x1, T x2, T e) IMATH_NOEXCEPT
Definition: ImathMath.h:164
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Shear6< T > &h, T e) const
Definition: ImathShear.h:545
IMATH_HOSTDEVICE constexpr Plane3< T > operator-(const Plane3< T > &plane) IMATH_NOEXCEPT
Reflect the pla.
Definition: ImathPlane.h:266
IMATH_HOSTDEVICE constexpr Shear6 operator-() const
Component-wise multiplication by -1.
Definition: ImathShear.h:609
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
GLdouble s
Definition: glad.h:3009
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & operator=(const Shear6 &h)
Assignment.
Definition: ImathShear.h:434
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
Definition: ImathShear.h:304
#define IMATH_HOSTDEVICE
Definition: ImathConfig.h:108
IMATH_HOSTDEVICE constexpr Shear6 operator+(const Shear6 &h) const
Component-wise addition.
Definition: ImathShear.h:580
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:5578
Vec3< float > Shear3f
3D shear of type float
Definition: ImathShear.h:328
IMATH_HOSTDEVICE static constexpr T baseTypeLowest() IMATH_NOEXCEPT
Largest possible negative value.
Definition: ImathShear.h:286
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
IMATH_HOSTDEVICE constexpr Shear6 operator/(const Shear6 &h) const
Component-wise division.
Definition: ImathShear.h:696
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & operator*=(const Shear6 &h)
Component-wise multiplication.
Definition: ImathShear.h:629
Shear6< float > Shear6f
Shear6 of type float.
Definition: ImathShear.h:334
IMATH_HOSTDEVICE constexpr Shear6< T > operator*(S a, const Shear6< T > &h)
Reverse multiplication: scalar * Shear6<T>
Definition: ImathShear.h:727
T x
Definition: ImathVec.h:368
IMATH_HOSTDEVICE constexpr Shear6 operator*(const Shear6 &h) const
Component-wise multiplication.
Definition: ImathShear.h:655
IMATH_HOSTDEVICE T * getValue()
Return a raw pointer to the array of values.
Definition: ImathShear.h:513
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
Definition: ImathShear.h:298
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
Definition: ImathShear.h:292
IMATH_HOSTDEVICE constexpr Quat< T > operator+(const Quat< T > &q1, const Quat< T > &q2) IMATH_NOEXCEPT
Quaterion addition.
Definition: ImathQuat.h:968
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m.
Definition: ImathMatrix.h:5082
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Shear6< T > &h, T e) const
Definition: ImathShear.h:556
IMATH_HOSTDEVICE constexpr bool operator!=(const Shear6< S > &h) const
Inequality.
Definition: ImathShear.h:537
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
Vec3< double > Shear3d
3D shear of type double
Definition: ImathShear.h:331
IMATH_HOSTDEVICE void setValue(S XY, S XZ, S YZ, S YX, S ZX, S ZY)
Set the value.
Definition: ImathShear.h:462
T BaseType
Definition: ImathShear.h:316
LeafData & operator=(const LeafData &)=delete
Shear6< double > Shear6d
Shear6 of type double.
Definition: ImathShear.h:337
#define IMATH_EXPORT_TEMPLATE_TYPE
Definition: ImathExport.h:61
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & operator+=(const Shear6 &h)
Component-wise addition.
Definition: ImathShear.h:567
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
T y
Definition: ImathVec.h:368
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
IMATH_HOSTDEVICE constexpr Quat< T > operator/(const Quat< T > &q1, const Quat< T > &q2) IMATH_NOEXCEPT
Quaterion division.
Definition: ImathQuat.h:934
IMATH_HOSTDEVICE constexpr bool operator==(const Shear6< S > &h) const
Equality.
Definition: ImathShear.h:528
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & operator[](int i)
Definition: ImathShear.h:345
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6 & negate()
Component-wise multiplication by -1.
Definition: ImathShear.h:616