HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Shear6< T > Class Template Reference

#include <ImathShear.h>

Public Types

typedef T BaseType
 

Public Member Functions

IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 T
operator[] (int i)
 
IMATH_HOSTDEVICE constexpr
const T
operator[] (int i) const
 
template<class S >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
< T > & 
operator= (const Vec3< S > &v)
 
Constructors and Assignment
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 ()
 Initialize to 0. More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (T XY, T XZ, T YZ)
 Initialize to the given XY, XZ, YZ values. More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Vec3< T > &v)
 Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z) More...
 
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Vec3< S > &v)
 Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z) More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY)
 Initialize to the given (XY XZ YZ YX ZX ZY) values. More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6 &h)
 Copy constructor. More...
 
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6< S > &h)
 Construct from a Shear6 object of another base type. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator= (const Shear6 &h)
 Assignment. More...
 
template<class S >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator= (const Vec3< S > &v)
 Assignment from vector. More...
 
 ~Shear6 ()=default
 Destructor. More...
 
Compatibility with Sb
template<class S >
IMATH_HOSTDEVICE void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY)
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void setValue (const Shear6< S > &h)
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (S &XY, S &XZ, S &YZ, S &YX, S &ZX, S &ZY) const
 Return the values. More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (Shear6< S > &h) const
 Return the value in h More...
 
IMATH_HOSTDEVICE TgetValue ()
 Return a raw pointer to the array of values. More...
 
IMATH_HOSTDEVICE const TgetValue () const
 Return a raw pointer to the array of values. More...
 
Arithmetic and Comparison
template<class S >
IMATH_HOSTDEVICE constexpr bool operator== (const Shear6< S > &h) const
 Equality. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator!= (const Shear6< S > &h) const
 Inequality. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
equalWithAbsError (const Shear6< T > &h, T e) const
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
equalWithRelError (const Shear6< T > &h, T e) const
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator+= (const Shear6 &h)
 Component-wise addition. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator+ (const Shear6 &h) const
 Component-wise addition. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator-= (const Shear6 &h)
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator- (const Shear6 &h) const
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator- () const
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
negate ()
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator*= (const Shear6 &h)
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator*= (T a)
 Scalar multiplication. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator* (const Shear6 &h) const
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator* (T a) const
 Scalar multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator/= (const Shear6 &h)
 Component-wise division. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Shear6
operator/= (T a)
 Scalar division. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator/ (const Shear6 &h) const
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Shear6 operator/ (T a) const
 Scalar division. More...
 

Static Public Member Functions

IMATH_HOSTDEVICE static
constexpr unsigned int 
dimensions ()
 Return the number of dimensions, i.e. 6. More...
 
Numerical Limits
IMATH_HOSTDEVICE static constexpr T baseTypeLowest () IMATH_NOEXCEPT
 Largest possible negative value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeMax () IMATH_NOEXCEPT
 Largest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest () IMATH_NOEXCEPT
 Smallest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon () IMATH_NOEXCEPT
 Smallest possible e for which 1+e != 1. More...
 

Public Attributes

Direct access to members
T xy
 
T xz
 
T yz
 
T yx
 
T zx
 
T zy
 

Detailed Description

template<class T>
class Shear6< T >

Shear6 class template.

A shear matrix is technically defined as having a single nonzero off-diagonal element; more generally, a shear transformation is defined by those off-diagonal elements, so in 3D, that means there are 6 possible elements/coefficients:

| X' |   |  1  YX  ZX  0 |   | X |
| Y' |   | XY   1  ZY  0 |   | Y |
| Z' | = | XZ  YZ   1  0 | = | Z |
| 1  |   |  0   0   0  1 |   | 1 |

X' =      X + YX * Y + ZX * Z
Y' = YX * X +      Y + ZY * Z
Z` = XZ * X + YZ * Y +      Z

See https://www.cs.drexel.edu/~david/Classes/CS430/Lectures/L-04_3DTransformations.6.pdf

Those variable elements correspond to the 6 values in a Shear6. So, looking at those equations, "Shear YX", for example, means that for any point transformed by that matrix, its X values will have some of their Y values added. If you're talking about "Axis A has values from Axis B added to it", there are 6 permutations for A and B (XY, XZ, YX, YZ, ZX, ZY).

Not that Maya has only three values, which represent the lower/upper (depending on column/row major) triangle of the matrix. Houdini is the same as Maya (see https://www.sidefx.com/docs/houdini/props/obj.html) in this respect.

There's another way to look at it. A general affine transformation in 3D has 12 degrees of freedom - 12 "available" elements in the 4x4 matrix since a single row/column must be (0,0,0,1). If you add up the degrees of freedom from Maya:

  • 3 translation
  • 3 rotation
  • 3 scale
  • 3 shear

You obviously get the full 12. So technically, the Shear6 option of having all 6 shear options is overkill; Imath/Shear6 has 15 values for a 12-degree-of-freedom transformation. This means that any nonzero values in those last 3 shear coefficients can be represented in those standard 12 degrees of freedom. Here's a python example of how to do that:

>>> import imath
>>> M = imath.M44f()
>>> s = imath.V3f()
>>> h = imath.V3f()
>>> r = imath.V3f()
>>> t = imath.V3f()
# Use Shear.YX (index 3), which is an "extra" shear value
>>> M.setShear((0,0,0,1,0,0))
M44f((1, 1, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))
>>> M.extractSHRT(s, h, r, t)
1
>>> s
V3f(1.41421354, 0.707106769, 1)
>>> h
V3f(1, 0, 0)
>>> r
V3f(0, -0, 0.785398185)
>>> t
V3f(0, 0, 0)

That shows how to decompose a transform matrix with one of those "extra" shear coefficients into those standard 12 degrees of freedom. But it's not necessarily intuitive; in this case, a single non-zero shear coefficient resulted in a transform that has non-uniform scale, a single "standard" shear value, and some rotation.

So, it would seem that any transform with those extra shear values set could be translated into Maya to produce the exact same transformation matrix; but doing this is probably pretty undesirable, since the result would have some surprising values on the other transformation attributes, despite being technically correct.

This usage of "degrees of freedom" is a bit hand-wavey here; having a total of 12 inputs into the construction of a standard transformation matrix doesn't necessarily mean that the matrix has 12 true degrees of freedom, but the standard translation/rotation/scale/shear matrices have the right construction to ensure that.

Definition at line 115 of file ImathShear.h.

Member Typedef Documentation

template<class T>
typedef T Shear6< T >::BaseType

The base type: In templates that accept a parameter V (could be a Color4), you can refer to T as V::BaseType

Definition at line 316 of file ImathShear.h.

Constructor & Destructor Documentation

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( )
inline

Initialize to 0.

Definition at line 358 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( T  XY,
T  XZ,
T  YZ 
)
inline

Initialize to the given XY, XZ, YZ values.

Definition at line 364 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( const Vec3< T > &  v)
inline

Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z)

Definition at line 375 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( const Vec3< S > &  v)
inline

Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z)

Definition at line 387 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( T  XY,
T  XZ,
T  YZ,
T  YX,
T  ZX,
T  ZY 
)
inline

Initialize to the given (XY XZ YZ YX ZX ZY) values.

Definition at line 398 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( const Shear6< T > &  h)
inline

Copy constructor.

Definition at line 410 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6< T >::Shear6 ( const Shear6< S > &  h)
inline

Construct from a Shear6 object of another base type.

Definition at line 422 of file ImathShear.h.

template<class T>
Shear6< T >::~Shear6 ( )
default

Destructor.

Member Function Documentation

template<class T>
IMATH_HOSTDEVICE static constexpr T Shear6< T >::baseTypeEpsilon ( )
inlinestatic

Smallest possible e for which 1+e != 1.

Definition at line 304 of file ImathShear.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Shear6< T >::baseTypeLowest ( )
inlinestatic

Largest possible negative value.

Definition at line 286 of file ImathShear.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Shear6< T >::baseTypeMax ( )
inlinestatic

Largest possible positive value.

Definition at line 292 of file ImathShear.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Shear6< T >::baseTypeSmallest ( )
inlinestatic

Smallest possible positive value.

Definition at line 298 of file ImathShear.h.

template<class T>
IMATH_HOSTDEVICE static constexpr unsigned int Shear6< T >::dimensions ( )
inlinestatic

Return the number of dimensions, i.e. 6.

Definition at line 312 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Shear6< T >::equalWithAbsError ( const Shear6< T > &  h,
T  e 
) const
inline

Compare two shears and test if they are "approximately equal":

Returns
True if the coefficients of this and h are the same with an absolute error of no more than e, i.e., for all i abs (this[i] - h[i]) <= e

Definition at line 545 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Shear6< T >::equalWithRelError ( const Shear6< T > &  h,
T  e 
) const
inline

Compare two shears and test if they are "approximately equal":

Returns
True if the coefficients of this and h are the same with a relative error of no more than e, i.e., for all i abs (this[i] - h[i]) <= e * abs (this[i])

Definition at line 556 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Shear6< T >::getValue ( S XY,
S XZ,
S YZ,
S YX,
S ZX,
S ZY 
) const
inline

Return the values.

Definition at line 488 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Shear6< T >::getValue ( Shear6< S > &  h) const
inline

Return the value in h

Definition at line 501 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE T * Shear6< T >::getValue ( )
inline

Return a raw pointer to the array of values.

Definition at line 513 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE const T * Shear6< T >::getValue ( ) const
inline

Return a raw pointer to the array of values.

Definition at line 520 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::negate ( )
inline

Component-wise multiplication by -1.

Definition at line 616 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Shear6< T >::operator!= ( const Shear6< S > &  h) const
inline

Inequality.

Definition at line 537 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator* ( const Shear6< T > &  h) const
inline

Component-wise multiplication.

Definition at line 655 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator* ( T  a) const
inline

Scalar multiplication.

Definition at line 663 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator*= ( const Shear6< T > &  h)
inline

Component-wise multiplication.

Definition at line 629 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator*= ( T  a)
inline

Scalar multiplication.

Definition at line 642 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator+ ( const Shear6< T > &  h) const
inline

Component-wise addition.

Definition at line 580 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator+= ( const Shear6< T > &  h)
inline

Component-wise addition.

Definition at line 567 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator- ( const Shear6< T > &  h) const
inline

Component-wise subtraction.

Definition at line 601 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator- ( ) const
inline

Component-wise multiplication by -1.

Definition at line 609 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator-= ( const Shear6< T > &  h)
inline

Component-wise subtraction.

Definition at line 588 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator/ ( const Shear6< T > &  h) const
inline

Component-wise division.

Definition at line 696 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr Shear6< T > Shear6< T >::operator/ ( T  a) const
inline

Scalar division.

Definition at line 704 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator/= ( const Shear6< T > &  h)
inline

Component-wise division.

Definition at line 670 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator/= ( T  a)
inline

Scalar division.

Definition at line 683 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6< T > & Shear6< T >::operator= ( const Shear6< T > &  h)
inline

Assignment.

Definition at line 434 of file ImathShear.h.

template<class T>
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& Shear6< T >::operator= ( const Vec3< S > &  v)

Assignment from vector.

template<class T>
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6<T>& Shear6< T >::operator= ( const Vec3< S > &  v)
inline

Definition at line 448 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Shear6< T >::operator== ( const Shear6< S > &  h) const
inline

Equality.

Definition at line 528 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & Shear6< T >::operator[] ( int  i)
inline

Element access

NB: This method of access uses dynamic array accesses which can prevent compiler optimizations and force temporaries to be stored to the stack and other missed vectorization opportunities. Use of direct access to xy, xz, etc when possible should be preferred.

Definition at line 345 of file ImathShear.h.

template<class T >
IMATH_HOSTDEVICE constexpr const T & Shear6< T >::operator[] ( int  i) const
inline

Element access

NB: This method of access uses dynamic array accesses which can prevent compiler optimizations and force temporaries to be stored to the stack and other missed vectorization opportunities. Use of direct access to xy, xz, etc when possible should be preferred.

Definition at line 352 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Shear6< T >::setValue ( S  XY,
S  XZ,
S  YZ,
S  YX,
S  ZX,
S  ZY 
)
inline

Set the value.

Definition at line 462 of file ImathShear.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Shear6< T >::setValue ( const Shear6< S > &  h)
inline

Set the value.

Definition at line 475 of file ImathShear.h.

Member Data Documentation

template<class T>
T Shear6< T >::xy

Definition at line 121 of file ImathShear.h.

template<class T>
T Shear6< T >::xz

Definition at line 121 of file ImathShear.h.

template<class T>
T Shear6< T >::yx

Definition at line 121 of file ImathShear.h.

template<class T>
T Shear6< T >::yz

Definition at line 121 of file ImathShear.h.

template<class T>
T Shear6< T >::zx

Definition at line 121 of file ImathShear.h.

template<class T>
T Shear6< T >::zy

Definition at line 121 of file ImathShear.h.


The documentation for this class was generated from the following file: