VRay SDK for C++
Loading...
Searching...
No Matches
VRay::Transform Struct Reference

A math object used to define object position, rotation and scale in 3D space. More...

#include <vraysdk.hpp>

Public Member Functions

 Transform () noexcept=default
 Default constructor - zero initializes all components.
 
 Transform (const Matrix &matrix, const Vector &offset) noexcept
 
 Transform (const Transform &) noexcept=default
 
 Transform (int i) noexcept
 
 Transform (Transform &&) noexcept=default
 
void makeIdentity (void) noexcept
 Make the transformation the identity transformation.
 
void makeInverse (void) noexcept
 Make the transformation the inverse of its current value.
 
void makeZero (void) noexcept
 Make the transformation the zero transformation.
 
void operator*= (float x) noexcept
 Multiply the transformation by a number.
 
void operator+= (const Transform &tm) noexcept
 Add another transformation to this one.
 
void operator-= (const Transform &tm) noexcept
 Subtract another tranformation from this one.
 
Transform & operator= (const Transform &) noexcept=default
 
Transform & operator= (Transform &&) noexcept=default
 
void rotate (const Vector &axis) noexcept
 Apply a rotation after the current transformation.
 
void scale (const Vector &scale) noexcept
 Apply a scale operation after the current transformation.
 
std::string toString () const
 
Vector transformVec (const Vector &a) const noexcept
 
void translate (const Vector &offsetParameter) noexcept
 Apply a translation to the current offset.
 

Public Attributes

Matrix matrix
 
Vector offset
 

Related Functions

(Note that these are not member functions.)

Vector inverseTransform (const Vector &a, const Transform &tm) noexcept
 
bool operator!= (const Transform &a, const Transform &b) noexcept
 
Transform operator* (const Transform &a, const Transform &b) noexcept
 
Vector operator* (const Transform &tm, const Vector &a) noexcept
 
Transform operator* (const Transform &tm, float x) noexcept
 
Transform operator* (float x, const Transform &tm) noexcept
 
Transform operator+ (const Transform &a, const Transform &b) noexcept
 
Transform operator- (const Transform &a, const Transform &b) noexcept
 
Transform operator- (const Transform &tm) noexcept
 
Transform operator/ (const Transform &tm, float x) noexcept
 
bool operator== (const Transform &a, const Transform &b) noexcept
 

Detailed Description

A math object used to define object position, rotation and scale in 3D space.

Constructor & Destructor Documentation

◆ Transform() [1/2]

VRay::Transform::Transform ( const Matrix &  matrix,
const Vector &  offset 
)
inlinenoexcept

Constructor from a matrix and a vector.

Parameters
matrixThe matrix (rotation+scale) portion.
offsetThe offset (translation) portion.

◆ Transform() [2/2]

VRay::Transform::Transform ( int  i)
inlinenoexcept

Constructor to either the zero or the identity transformation.

Parameters
iIf this is 0, the transformation is initialized to the zero transformation; if this is 1, the transformation is initialized to the identity transformation.

Member Function Documentation

◆ transformVec()

Vector VRay::Transform::transformVec ( const Vector &  a) const
inlinenoexcept

Transform a vector by the transformation (ignores the translation part). This is different from the operator * with a vector, which adds in the translation part as well.

Friends And Related Function Documentation

◆ inverseTransform()

Vector inverseTransform ( const Vector &  a,
const Transform &  tm 
)
related

Inverse-transform a point with a transform. The transform must have an orthonormal matrix (no scaling).

◆ operator!=()

bool operator!= ( const Transform &  a,
const Transform &  b 
)
related

Checks two transforms for inequality.

◆ operator*() [1/4]

Transform operator* ( const Transform &  a,
const Transform &  b 
)
related

Mutiply two transformations, so that if p is a Vector, (a*b)*p == a*(b*p).

◆ operator*() [2/4]

Vector operator* ( const Transform &  tm,
const Vector &  a 
)
related

Transform a point with a transform.

◆ operator*() [3/4]

Transform operator* ( const Transform &  tm,
float  x 
)
related

Mutiply all components of a transformation by a number.

◆ operator*() [4/4]

Transform operator* ( float  x,
const Transform &  tm 
)
related

Mutiply all components of a transformation by a number.

◆ operator+()

Transform operator+ ( const Transform &  a,
const Transform &  b 
)
related

Add two transformations, so that if p is a Vector, (a+b)*p == (a*p)+(b*p).

◆ operator-() [1/2]

Transform operator- ( const Transform &  a,
const Transform &  b 
)
related

Subtract two transformations, so that if p is a Vector, (a-b)*p == (a*p)-(b*p).

◆ operator-() [2/2]

Transform operator- ( const Transform &  tm)
related

Reverses the sign of the transformation.

◆ operator/()

Transform operator/ ( const Transform &  tm,
float  x 
)
related

Divide all components of a transformation by a number. Does not check if the number is zero.

◆ operator==()

bool operator== ( const Transform &  a,
const Transform &  b 
)
related

Checks two transforms for exact equality. NOTE: You may want to perform your own approximate comparison, element by element


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