Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::Matrix3 Class Reference

A 3x3 transformation matrix. More...

#include <Matrix3.h>

Public Member Functions

float * operator[] (int i)
 
const float * operator[] (int i) const
 
const float * array () const
 
 Matrix3 (float a, float b, float c, float d, float e, float f, float g, float h, float i)
 
void set (float a, float b, float c, float d, float e, float f, float g, float h, float i)
 
Matrix3 operator* (const Matrix3 &) const
 
Matrix3operator*= (const Matrix3 &)
 
Matrix3 operator+ (const Matrix3 &) const
 
Matrix3operator+= (const Matrix3 &)
 
Matrix3 operator- (const Matrix3 &) const
 
Matrix3operator-= (const Matrix3 &)
 
Matrix3 operator* (float) const
 
Matrix3operator*= (float)
 
Matrix3 operator/ (float d) const
 
Matrix3operator/= (float d)
 
Vector3 operator* (const Vector3 &v) const
 
Vector3 transform (const Vector3 &v) const
 
bool operator!= (const Matrix3 &b) const
 
bool operator== (const Matrix3 &b) const
 
float determinant () const
 
Matrix3 inverse (float det) const
 
Matrix3 inverse () const
 
void makeIdentity ()
 
void scaling (float)
 
void scaling (float, float, float)
 
void scaling (const Vector3 &v)
 
void rotationX (float)
 
void rotationY (float)
 
void rotationZ (float)
 
void rotation (float a)
 
void rotation (float a, float x, float y, float z)
 
void rotation (float a, const Vector3 &v)
 
void scale (float)
 
void scale (float, float, float=1)
 
void scale (const Vector3 &v)
 
void rotateX (float)
 
void rotateY (float)
 
void rotateZ (float)
 
void rotate (float a)
 
void rotate (float a, float x, float y, float z)
 
void rotate (float a, const Vector3 &v)
 
void skew (float a)
 
void append (Hash &) const
 

Static Public Member Functions

static const Matrix3identity ()
 

Public Attributes

float a00
 
float a10
 
float a20
 
float a01
 
float a11
 
float a21
 
float a02
 
float a12
 
float a22
 

Static Public Attributes

static const Matrix3 _identity
 

Friends

std::ostream & operator<< (std::ostream &o, const Matrix3 &matrix)
 

Detailed Description

A 3x3 transformation matrix.

You multiply a Vector3 by one of these to go from one 3D space to another. This cannot represent 3D translations or perspective, use a Matrix4 for that. This is also often used to transform color spaces.

The data is stored packed together in OpenGL order, which is transposed from the way used in most modern graphics literature. This affects how the array() and [] operator work, these are all equal:

  • matrix.a12
  • matrix[2][1]
  • matrix.array()[1+3*2]

Constructor & Destructor Documentation

◆ Matrix3()

DD::Image::Matrix3::Matrix3 ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
float  g,
float  h,
float  i 
)
inline

Initialize with a00=a, a01=b, a02=c, etc, ie the arguments are given as rows.

Member Function Documentation

◆ operator[]() [1/2]

float * DD::Image::Matrix3::operator[] ( int  i)
inline

Return a pointer to the column number i.

◆ operator[]() [2/2]

const float * DD::Image::Matrix3::operator[] ( int  i) const
inline

Return a pointer to the column number i.

◆ array()

const float * DD::Image::Matrix3::array ( ) const
inline

Return a pointer to a00. This array is in the correct order to send it to OpenGL.

◆ operator*() [1/3]

Matrix3 Matrix3::operator* ( const Matrix3 B) const

Does matrix multiplication.

◆ operator*=() [1/2]

Matrix3 & Matrix3::operator*= ( const Matrix3 B)

Does matrix multiplication.

◆ operator+()

Matrix3 Matrix3::operator+ ( const Matrix3 B) const

Add each matching locations.

◆ operator+=()

Matrix3 & Matrix3::operator+= ( const Matrix3 B)

Add each matching locations.

◆ operator-()

Matrix3 Matrix3::operator- ( const Matrix3 B) const

Subtract each matching locations.

◆ operator-=()

Matrix3 & Matrix3::operator-= ( const Matrix3 B)

Subtract each matching locations.

◆ operator*() [2/3]

Matrix3 Matrix3::operator* ( float  f) const

Multiplies every location by f.

◆ operator*=() [2/2]

Matrix3 & Matrix3::operator*= ( float  f)

Multiplies every location by f.

◆ operator*() [3/3]

Vector3 DD::Image::Matrix3::operator* ( const Vector3 v) const
inline

Returns the transformation of v by this matrix.

◆ transform()

Vector3 DD::Image::Matrix3::transform ( const Vector3 v) const
inline

Same as this*v

◆ operator!=()

bool DD::Image::Matrix3::operator!= ( const Matrix3 b) const
inline

Returns true if any of all 9 locations are different.

◆ operator==()

bool DD::Image::Matrix3::operator== ( const Matrix3 b) const
inline

Returns true if all 9 locations are equal.

◆ determinant()

float DD::Image::Matrix3::determinant ( void  ) const
inline

Return the determinant. Non-zero means the transformation can be inverted.

◆ inverse() [1/2]

Matrix3 Matrix3::inverse ( float  det) const

Returns the inverse of this matrix where det is the precomputed determinant. This is useful if you already computed the determinant in order to see if you can invert the matrix.

◆ inverse() [2/2]

Matrix3 DD::Image::Matrix3::inverse ( ) const
inline

Returns the inverse of this matrix. If determinant() is zero this will replace all the items with +/- infinity or zero.

References inverse().

Referenced by inverse().

◆ makeIdentity()

void DD::Image::Matrix3::makeIdentity ( )
inline

Replace the contents with the identity.

◆ scaling() [1/3]

void Matrix3::scaling ( float  x)

Replace the contents with a uniform scale by x.

◆ scaling() [2/3]

void Matrix3::scaling ( float  x,
float  y,
float  z 
)

Replace the contents with a scale by x,y,z.

◆ scaling() [3/3]

void DD::Image::Matrix3::scaling ( const Vector3 v)
inline

Replace the contents with a scale by the x,y,z of the vector.

References scaling().

Referenced by scaling().

◆ rotationX()

void Matrix3::rotationX ( float  angle)

Replace the contents with a rotation by angle (in radians) around the X axis.

Referenced by rotateX().

◆ rotationY()

void Matrix3::rotationY ( float  angle)

Replace the contents with a rotation by angle (in radians) around the Y axis.

Referenced by rotateY().

◆ rotationZ()

void Matrix3::rotationZ ( float  angle)

Replace the contents with a rotation by angle (in radians) around the Z axis.

Referenced by rotateZ().

◆ rotation() [1/3]

void DD::Image::Matrix3::rotation ( float  angle)
inline

Same as rotationZ(angle).

Referenced by rotate().

◆ rotation() [2/3]

void Matrix3::rotation ( float  a,
float  x,
float  y,
float  z 
)

Replace the contents with a rotation by angle (in radians) around the vector x,y,z.

◆ rotation() [3/3]

void DD::Image::Matrix3::rotation ( float  angle,
const Vector3 v 
)
inline

Replace the contents with a rotation by angle (in radians) around the vector.

References rotation().

Referenced by rotation().

◆ scale() [1/3]

void Matrix3::scale ( float  s)

Scale the transformation by s.

◆ scale() [2/3]

void Matrix3::scale ( float  x,
float  y,
float  z = 1 
)

Scale the transformation by x,y,z.

◆ scale() [3/3]

void DD::Image::Matrix3::scale ( const Vector3 v)
inline

Scale the transformation by the x,y,z of the vector.

References scale().

Referenced by scale().

◆ rotateX()

void Matrix3::rotateX ( float  a)

Rotate the transformation by a radians about the X axis.

References rotationX().

◆ rotateY()

void Matrix3::rotateY ( float  a)

Rotate the transformation by a radians about the Y axis.

References rotationY().

◆ rotateZ()

void Matrix3::rotateZ ( float  a)

Rotate the transformation by a radians about the Z axis.

References rotationZ().

◆ rotate() [1/3]

void DD::Image::Matrix3::rotate ( float  a)
inline

Same as rotateZ(a).

◆ rotate() [2/3]

void Matrix3::rotate ( float  a,
float  x,
float  y,
float  z 
)

Rotate the transformation by a radians about the vector x,y,z.

References rotation().

◆ rotate() [3/3]

void DD::Image::Matrix3::rotate ( float  a,
const Vector3 v 
)
inline

Rotate the transformation by a radians about the vector.

References rotate().

Referenced by rotate().

◆ skew()

void Matrix3::skew ( float  a)

Skew the transformation by a (X positions have a*Y added to them).

◆ append()

void Matrix3::append ( Hash hash) const

Add this to the Hash object.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  o,
const Matrix3 matrix 
)
friend

Writes it in nuke/tcl notation, with nested curly braces



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com