11 #ifndef __UT_SYMMATRIX3_H_INCLUDED__
12 #define __UT_SYMMATRIX3_H_INCLUDED__
69 myV[i] = other.data()[i];
74 T q00,
T q10,
T q11,
T q20,
T q21,
T q22)
90 ::memset(&
myV[0], 0,
sizeof(
myV));
126 return myV[(j*(j + 1))/2 + i];
128 return myV[(i*(i + 1))/2 +
j];
135 return myV[(j*(j + 1))/2 + i];
137 return myV[(i*(i + 1))/2 +
j];
167 for (
int i = 0; i < 6; ++i)
240 template <
typename T>
248 x.q10 + y.q10, x.q11 + y.q11,
249 x.q20 + y.q20, x.q21 + y.q21, x.q22 + y.q22);
253 template <
typename T>
261 x.q10 - y.q10, x.q11 - y.q11,
262 x.q20 - y.q20, x.q21 - y.q21, x.q22 - y.q22);
266 template <
typename T>
280 template <
typename T>
293 v.
assign(m(0,2), m(1,2), 1);
294 sigma =
v(0)*
v(0) +
v(1)*
v(1);
304 const T diag = m(
N,
N);
305 T mu = SYSsqrt(diag*diag + sigma);
309 denom = -sigma / (diag + mu);
314 T beta = 2 * denom*denom / (sigma + denom*denom);
319 - beta*
v(0)*
v(1), 1 - beta*
v(1)*
v(1),
320 - beta*
v(0), - beta*
v(1), 1 - beta);
326 - beta*
v(0), 1 - beta,
334 template <
typename T>
345 template <
typename T>
349 outerproduct(v.
x(), v.
y(), v.
z());
352 template <
typename T>
356 myUpper.q00 = a *
a; myUpper.q01 = a *
b; myUpper.q02 = a *
c;
357 myUpper.q11 = b *
b; myUpper.q12 = b *
c;
361 template <
typename T>
368 template <
typename T>
372 myUpper.q00 += a *
a; myUpper.q01 += a *
b; myUpper.q02 += a *
c;
373 myUpper.q11 += b *
b; myUpper.q12 += b *
c;
374 myUpper.q22 += c *
c;
378 template <
typename T>
385 template <
typename T>
389 myUpper.q00 += coef * (a *
a); myUpper.q01 += coef * (a *
b);
390 myUpper.q02 += coef * (a *
c);
391 myUpper.q11 += coef * (b *
b); myUpper.q12 += coef * (b *
c);
392 myUpper.q22 += coef * (c *
c);
397 template <
typename T>
401 T a = v.
x(),
b = v.
y(),
c = v.
z();
403 return (a * (a * myUpper.q00 + 2 * (
b * myUpper.q01 +
c * myUpper.q02)) +
404 b * (
b * myUpper.q11 + 2 * (
c * myUpper.q12)) +
405 c * (
c * myUpper.q22 ));
413 #endif // __UT_SYMMATRIX3_H_INCLUDED__
UT_SymMatrix3T< float > UT_SymMatrix3F
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.
UT_API size_t format(char *buffer, size_t buffer_size, const UT_SymMatrix3T< T > &m)
#define SYS_STATIC_ASSERT(expr)
T vQv(const UT_Vector3T< T > &v) const
T & operator()(const int i, const int j)
Return reference to element (i,j)
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Add corresponding elements of m0 and m1 and return the result.
constexpr SYS_FORCE_INLINE T & z() noexcept
const LowerTri & lowerTri() const
Return reference to the lower triangular elements for symbolic access.
GLboolean GLboolean GLboolean GLboolean a
Generic symmetric 3x3 matrix.
UT_Matrix2T< T > SYSlerp(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S t)
void outerproduct(const UT_Vector3T< T > &v)
void outerproductUpdate(T b, const UT_Vector4T< S > &v1, const UT_Vector4T< S > &v2)
void zero()
Set this to the zero matrix.
void identity()
Set this to the identity matrix.
static UT_SymMatrix3T< T > householderZeroUpper(const UT_Matrix3T< T > &m)
UT_SymMatrix3T< fpreal > UT_SymMatrix3R
GA_API const UT_StringHolder scale
type & operator+=(const type &m)
void setScale(T sx, T sy, T sz)
Set this to a scale matrix.
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result.
UT_SymMatrix3T< double > UT_SymMatrix3D
void setScale(const UT_Vector3T< T > &s)
Set this to a scale matrix.
T operator()(const int i, const int j) const
Return element (i,j)
const UpperTri & upperTri() const
Return reference to the upper triangular elements for symbolic access.
GLboolean GLboolean GLboolean b
bool isIdentity() const
Return whether this is the identity matrix.
static constexpr int tuple_size
void lerp(const type &a, const type &b, T t)
Inner class to access the elements symbolically.
void assign(T xx=0.0f, T yy=0.0f, T zz=0.0f)
Set the values of the vector components.
GA_API const UT_StringHolder N
void outerproductUpdate(const UT_Vector3T< T > &v)
type & operator/=(T scalar)
type & operator*=(T scalar)
constexpr SYS_FORCE_INLINE T & y() noexcept
type & operator-=(const type &m)
constexpr SYS_FORCE_INLINE T & x() noexcept