Vuo 2.4.4
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
VuoTransform

Description

A 3D transformation (scale, rotation, translation).

Classes

struct  VuoTransform
 A 3D transformation (scale, rotation, translation). More...
 
struct  VuoTransform.rotationSource
 

Enumerations

enum  VuoTransformType { VuoTransformTypeEuler , VuoTransformTypeQuaternion , VuoTransformTypeTargeted }
 The type of rotation description used to construct this transform. More...
 

Functions

void VuoTransform_getMatrix (const VuoTransform value, float *matrix)
 Converts value into a column-major matrix of 16 values, composed as a rotation followed by a scale followed by a translation.
 
VuoPoint3d VuoTransform_getDirection (const VuoTransform transform)
 Start with an object pointing rightward (increasing X axis).
 
VuoTransform VuoTransform_makeIdentity (void)
 Creates a VuoTransform with no effect.
 
VuoTransform VuoTransform_makeEuler (VuoPoint3d translation, VuoPoint3d rotation, VuoPoint3d scale)
 Creates a VuoTransform from translation, rotation (Euler angles, in radians), and scale values.
 
VuoTransform VuoTransform_makeQuaternion (VuoPoint3d translation, VuoPoint4d rotation, VuoPoint3d scale)
 Creates a VuoTransform from translation, rotation (quaternion), and scale values.
 
VuoTransform VuoTransform_makeFromJson (json_object *js)
 Decodes the JSON object js to create a new value.
 
json_object * VuoTransform_getJson (const VuoTransform value)
 Encodes value as a JSON object.
 
char * VuoTransform_getSummary (const VuoTransform value)
 Produces a brief human-readable summary of value.
 
void VuoTransform_getBillboardMatrix (VuoInteger imageWidth, VuoInteger imageHeight, VuoReal imageScaleFactor, VuoBoolean preservePhysicalSize, VuoReal translationX, VuoReal translationY, VuoInteger viewportWidth, VuoInteger viewportHeight, VuoReal backingScaleFactor, VuoPoint2d mesh0, float *billboardMatrix) __attribute__((nonnull))
 Returns a column-major matrix of 16 values that transforms a 1x1 quad so that it renders the specified image at real (pixel-perfect) size.
 
VuoPoint3d VuoTransform_getEuler (const VuoTransform transform)
 Returns the transform's rotation, represented as euler angles in radians (see VuoTransform_makeEuler).
 
VuoPoint4d VuoTransform_getQuaternion (const VuoTransform transform)
 Returns the transform's rotation, represented as a quaternion (see VuoTransform_makeQuaternion).
 
void VuoTransform_rotationMatrixFromQuaternion (const VuoPoint4d quaternion, float *matrix) __attribute__((nonnull))
 Populate a 3x3 matrix with a normalized quaternion.
 
void VuoTransform_rotationMatrixFromEuler (const VuoPoint3d euler, float *matrix) __attribute__((nonnull))
 Populate a 3x3 matrix with an euler rotation.
 
VuoTransform VuoTransform_makeFrom2d (VuoTransform2d transform2d)
 Creates a 3D transform from a 2D transform.
 
VuoTransform2d VuoTransform_get2d (VuoTransform transform)
 Creates a 2D transform from a 3D transform.
 
VuoTransform VuoTransform_makeFromTarget (VuoPoint3d position, VuoPoint3d target, VuoPoint3d upDirection)
 Create a transform that translates to position and looks at target with roll determined by upDirection.
 
VuoTransform VuoTransform_makeFromMatrix4x4 (const float *matrix) __attribute__((nonnull))
 Creates a transform from the specified matrix (assumed to consist of affine rotation, scale, and translation).
 
VuoTransform VuoTransform_composite (const VuoTransform a, const VuoTransform b)
 Returns a composite transformation, consisting of a followed by b.
 
static VuoPoint4d VuoTransform_quaternionComposite (VuoPoint4d a, VuoPoint4d b) __attribute__((const))
 Returns the composite of quaternion a with quaternion b (i.e., the rotation described by a followed by the rotation described by b).
 
static VuoPoint4d VuoTransform_quaternionFromAxisAngle (VuoPoint3d axis, float angle) __attribute__((const))
 Returns the quaternion describing the rotation of angle radians about axis.
 
VuoPoint4d VuoTransform_quaternionFromBasis (VuoPoint3d basis[3])
 Returns a quaternion representing the rotation of the specified basis matrix.
 
static VuoPoint4d VuoTransform_quaternionFromVectors (VuoPoint3d from, VuoPoint3d to) __attribute__((const))
 Returns the quaternion describing the rotation from direction from to to.
 
static VuoPoint4d VuoTransform_quaternionFromMatrix (const float *rotation) __attribute__((nonnull))
 Create a unit quaternion from a rotation matrix (3x3).
 
static VuoPoint4d VuoTransform_quaternionFromEuler (const VuoPoint3d euler) __attribute__((const))
 Convert an euler angle (radians) to a quaternion.
 
static VuoPoint3d VuoTransform_eulerFromQuaternion (const VuoPoint4d quaternion) __attribute__((const))
 Convert a quaternion to an euler angle.
 
static VuoPoint3d VuoTransform_eulerFromMatrix (const float *matrix) __attribute__((nonnull))
 Convert a rotation matrix (3x3) to an euler angle.
 
static VuoPoint3d VuoTransform_rotateVectorWithQuaternion (const VuoPoint3d v, const VuoPoint4d q) __attribute__((const))
 Rotates 3D vector v by quaternion q.
 
static bool VuoTransform_isIdentity (const VuoTransform transform)
 Returns true if the transform is an identity (i.e., causes no change).
 
static void VuoTransform_multiplyMatrices4x4 (const float *a, const float *b, float *outputMatrix) __attribute__((nonnull))
 Multiplies the specified matrices.
 
static void VuoTransform_copyMatrix4x4 (const float *sourceMatrix, float *destMatrix) __attribute__((nonnull))
 Copies sourceMatrix to destMatrix.
 
static VuoPoint3d VuoTransform_getMatrix4x4Translation (const float *matrix) __attribute__((nonnull))
 Returns the translation specified in matrix.
 
static VuoPoint3d VuoTransform_getMatrix4x4Scale (const float *matrix) __attribute__((nonnull))
 Returns the scale specified in matrix.
 
static void VuoTransform_printMatrix4x4 (const float *matrix) __attribute__((nonnull))
 Prints the specified column-major matrix.
 
void VuoTransform_invertMatrix4x4 (const float *matrix, float *outputInvertedMatrix) __attribute__((nonnull))
 Outputs the inverse of matrix (which is assumed to consist of a rotation followed by a scale followed by a translation, like the output of VuoTransform_getMatrix), such that outputInvertedMatrix * matrix = identityMatrix.
 
static VuoPoint3d VuoTransform_transformPoint (const float *matrix, VuoPoint3d point) __attribute__((nonnull))
 Transforms point using matrix (a column-major matrix of 16 values), and returns the new point.
 
VuoPoint2d VuoTransform_transform_VuoPoint2d (VuoTransform transform, VuoPoint2d point)
 Applies transform to point, using input Z coordinate 0 and discarding the transformed Z coordinate.
 
VuoPoint3d VuoTransform_transform_VuoPoint3d (VuoTransform transform, VuoPoint3d point)
 Applies transform to point.
 
static VuoPoint3d VuoTransform_transformVector (const float *matrix, VuoPoint3d point) __attribute__((nonnull))
 Transforms vector using matrix (a column-major matrix of 16 values), and returns the new vector.
 
VuoRectangle VuoTransform_transformRectangle (const float *matrix, VuoRectangle rectangle) __attribute__((nonnull))
 Transforms rectangle using matrix (a column-major matrix of 16 values), and returns the new rectangle.
 
char * VuoTransform_getString (const VuoTransform value)
 Automatically generated function.
 
void VuoTransform_retain (VuoTransform value)
 Automatically generated function.
 
void VuoTransform_release (VuoTransform value)
 Automatically generated function.
 

Class Documentation

◆ VuoTransform

struct VuoTransform
Class Members
float rotation[9] Column-major 3x3 matrix.
struct VuoTransform.rotationSource rotationSource
VuoPoint3d scale
VuoPoint3d translation
enum VuoTransformType type

◆ VuoTransform.rotationSource

struct VuoTransform.rotationSource
Class Members
struct VuoTransform.rotationSource.__unnamed10__ __unnamed__
VuoPoint3d euler Radians.
VuoPoint4d quaternion

Enumeration Type Documentation

◆ VuoTransformType

The type of rotation description used to construct this transform.

Definition at line 37 of file VuoTransform.h.

Function Documentation

◆ VuoTransform_composite()

VuoTransform VuoTransform_composite ( const VuoTransform  a,
const VuoTransform  b 
)

Returns a composite transformation, consisting of a followed by b.

Definition at line 465 of file VuoTransform.c.

◆ VuoTransform_copyMatrix4x4()

static void VuoTransform_copyMatrix4x4 ( const float *  sourceMatrix,
float *  destMatrix 
)
inlinestatic

Copies sourceMatrix to destMatrix.

Definition at line 355 of file VuoTransform.h.

◆ VuoTransform_eulerFromMatrix()

static VuoPoint3d VuoTransform_eulerFromMatrix ( const float *  matrix)
inlinestatic

Convert a rotation matrix (3x3) to an euler angle.

Definition at line 257 of file VuoTransform.h.

◆ VuoTransform_eulerFromQuaternion()

static VuoPoint3d VuoTransform_eulerFromQuaternion ( const VuoPoint4d  quaternion) const
inlinestatic

Convert a quaternion to an euler angle.

https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

Definition at line 228 of file VuoTransform.h.

◆ VuoTransform_get2d()

VuoTransform2d VuoTransform_get2d ( VuoTransform  transform)

Creates a 2D transform from a 3D transform.

Definition at line 285 of file VuoTransform.c.

◆ VuoTransform_getBillboardMatrix()

void VuoTransform_getBillboardMatrix ( VuoInteger  imageWidth,
VuoInteger  imageHeight,
VuoReal  imageScaleFactor,
VuoBoolean  preservePhysicalSize,
VuoReal  translationX,
VuoReal  translationY,
VuoInteger  viewportWidth,
VuoInteger  viewportHeight,
VuoReal  backingScaleFactor,
VuoPoint2d  mesh0,
float *  billboardMatrix 
)

Returns a column-major matrix of 16 values that transforms a 1x1 quad so that it renders the specified image at real (pixel-perfect) size.

Changed in Vuo 2.0.0:
Changed meshX argument to mesh0.

Definition at line 414 of file VuoTransform.c.

◆ VuoTransform_getDirection()

VuoPoint3d VuoTransform_getDirection ( const VuoTransform  transform)

Start with an object pointing rightward (increasing X axis).

This function returns a unit vector representing the direction a rightward-pointing object (+x axis) would be pointing after being transformed by transform.

Definition at line 156 of file VuoTransform.c.

◆ VuoTransform_getEuler()

VuoPoint3d VuoTransform_getEuler ( const VuoTransform  transform)

Returns the transform's rotation, represented as euler angles in radians (see VuoTransform_makeEuler).

Definition at line 131 of file VuoTransform.c.

◆ VuoTransform_getJson()

struct json_object * VuoTransform_getJson ( const VuoTransform  value)

Encodes value as a JSON object.

Definition at line 596 of file VuoTransform.c.

◆ VuoTransform_getMatrix()

void VuoTransform_getMatrix ( const VuoTransform  value,
float *  matrix 
)

Converts value into a column-major matrix of 16 values, composed as a rotation followed by a scale followed by a translation.

Definition at line 38 of file VuoTransform.c.

◆ VuoTransform_getMatrix4x4Scale()

static VuoPoint3d VuoTransform_getMatrix4x4Scale ( const float *  matrix)
inlinestatic

Returns the scale specified in matrix.

Changed in Vuo 2.0.0:
New.

Definition at line 376 of file VuoTransform.h.

◆ VuoTransform_getMatrix4x4Translation()

static VuoPoint3d VuoTransform_getMatrix4x4Translation ( const float *  matrix)
inlinestatic

Returns the translation specified in matrix.

Changed in Vuo 2.0.0:
New.

Definition at line 366 of file VuoTransform.h.

◆ VuoTransform_getQuaternion()

VuoPoint4d VuoTransform_getQuaternion ( const VuoTransform  transform)

Returns the transform's rotation, represented as a quaternion (see VuoTransform_makeQuaternion).

Definition at line 142 of file VuoTransform.c.

◆ VuoTransform_getString()

char * VuoTransform_getString ( const VuoTransform  value)

Automatically generated function.

◆ VuoTransform_getSummary()

char * VuoTransform_getSummary ( const VuoTransform  value)

Produces a brief human-readable summary of value.

Definition at line 662 of file VuoTransform.c.

◆ VuoTransform_invertMatrix4x4()

void VuoTransform_invertMatrix4x4 ( const float *  matrix,
float *  outputInvertedMatrix 
)

Outputs the inverse of matrix (which is assumed to consist of a rotation followed by a scale followed by a translation, like the output of VuoTransform_getMatrix), such that outputInvertedMatrix * matrix = identityMatrix.

Definition at line 67 of file VuoTransform.c.

◆ VuoTransform_isIdentity()

static bool VuoTransform_isIdentity ( const VuoTransform  transform)
inlinestatic

Returns true if the transform is an identity (i.e., causes no change).

Definition at line 296 of file VuoTransform.h.

◆ VuoTransform_makeEuler()

VuoTransform VuoTransform_makeEuler ( VuoPoint3d  translation,
VuoPoint3d  rotation,
VuoPoint3d  scale 
)

Creates a VuoTransform from translation, rotation (Euler angles, in radians), and scale values.

Definition at line 202 of file VuoTransform.c.

◆ VuoTransform_makeFrom2d()

VuoTransform VuoTransform_makeFrom2d ( VuoTransform2d  transform2d)

Creates a 3D transform from a 2D transform.

Definition at line 274 of file VuoTransform.c.

◆ VuoTransform_makeFromJson()

VuoTransform VuoTransform_makeFromJson ( json_object *  js)

Decodes the JSON object js to create a new value.

Example:
"identity"
Example:
{
"quaternionRotation" = [0,0,0,1],
"translation" = [0,0,0],
"scale" = [1,1,1]
}
Example:
{
"eulerRotation" = [0,0,0],
"translation" = [0,0,0],
"scale" = [1,1,1]
}

Definition at line 513 of file VuoTransform.c.

◆ VuoTransform_makeFromMatrix4x4()

VuoTransform VuoTransform_makeFromMatrix4x4 ( const float *  matrix)

Creates a transform from the specified matrix (assumed to consist of affine rotation, scale, and translation).

Definition at line 331 of file VuoTransform.c.

◆ VuoTransform_makeFromTarget()

VuoTransform VuoTransform_makeFromTarget ( VuoPoint3d  position,
VuoPoint3d  target,
VuoPoint3d  upDirection 
)

Create a transform that translates to position and looks at target with roll determined by upDirection.

Similar to gluLookAt.

Definition at line 299 of file VuoTransform.c.

◆ VuoTransform_makeIdentity()

VuoTransform VuoTransform_makeIdentity ( void  )

Creates a VuoTransform with no effect.

Definition at line 174 of file VuoTransform.c.

◆ VuoTransform_makeQuaternion()

VuoTransform VuoTransform_makeQuaternion ( VuoPoint3d  translation,
VuoPoint4d  rotation,
VuoPoint3d  scale 
)

Creates a VuoTransform from translation, rotation (quaternion), and scale values.

VuoPoint4d_make(0,0,0,1) (w=1, x=y=z=0) is the rotational identity.

Definition at line 252 of file VuoTransform.c.

◆ VuoTransform_multiplyMatrices4x4()

static void VuoTransform_multiplyMatrices4x4 ( const float *  a,
const float *  b,
float *  outputMatrix 
)
inlinestatic

Multiplies the specified matrices.

Definition at line 331 of file VuoTransform.h.

◆ VuoTransform_printMatrix4x4()

static void VuoTransform_printMatrix4x4 ( const float *  matrix)
inlinestatic

Prints the specified column-major matrix.

Definition at line 389 of file VuoTransform.h.

◆ VuoTransform_quaternionComposite()

static VuoPoint4d VuoTransform_quaternionComposite ( VuoPoint4d  a,
VuoPoint4d  b 
) const
inlinestatic

Returns the composite of quaternion a with quaternion b (i.e., the rotation described by a followed by the rotation described by b).

Definition at line 92 of file VuoTransform.h.

◆ VuoTransform_quaternionFromAxisAngle()

static VuoPoint4d VuoTransform_quaternionFromAxisAngle ( VuoPoint3d  axis,
float  angle 
) const
inlinestatic

Returns the quaternion describing the rotation of angle radians about axis.

Definition at line 107 of file VuoTransform.h.

◆ VuoTransform_quaternionFromBasis()

VuoPoint4d VuoTransform_quaternionFromBasis ( VuoPoint3d  basis[3])

Returns a quaternion representing the rotation of the specified basis matrix.

Definition at line 482 of file VuoTransform.c.

◆ VuoTransform_quaternionFromEuler()

static VuoPoint4d VuoTransform_quaternionFromEuler ( const VuoPoint3d  euler) const
inlinestatic

Convert an euler angle (radians) to a quaternion.

https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

Definition at line 204 of file VuoTransform.h.

◆ VuoTransform_quaternionFromMatrix()

static VuoPoint4d VuoTransform_quaternionFromMatrix ( const float *  rotation)
inlinestatic

◆ VuoTransform_quaternionFromVectors()

static VuoPoint4d VuoTransform_quaternionFromVectors ( VuoPoint3d  from,
VuoPoint3d  to 
) const
inlinestatic

Returns the quaternion describing the rotation from direction from to to.

If either from or to has magnitude 0, then returns the identity quaternion (no rotation).

Definition at line 126 of file VuoTransform.h.

◆ VuoTransform_release()

void VuoTransform_release ( VuoTransform  value)

Automatically generated function.

◆ VuoTransform_retain()

void VuoTransform_retain ( VuoTransform  value)

Automatically generated function.

◆ VuoTransform_rotateVectorWithQuaternion()

static VuoPoint3d VuoTransform_rotateVectorWithQuaternion ( const VuoPoint3d  v,
const VuoPoint4d  q 
) const
inlinestatic

Rotates 3D vector v by quaternion q.

Definition at line 284 of file VuoTransform.h.

◆ VuoTransform_rotationMatrixFromEuler()

void VuoTransform_rotationMatrixFromEuler ( const VuoPoint3d  euler,
float *  matrix 
)

Populate a 3x3 matrix with an euler rotation.

Euler values are expressed in radians.

Definition at line 233 of file VuoTransform.c.

◆ VuoTransform_rotationMatrixFromQuaternion()

void VuoTransform_rotationMatrixFromQuaternion ( const VuoPoint4d  quaternion,
float *  matrix 
)

Populate a 3x3 matrix with a normalized quaternion.

Definition at line 217 of file VuoTransform.c.

◆ VuoTransform_transform_VuoPoint2d()

VuoPoint2d VuoTransform_transform_VuoPoint2d ( VuoTransform  transform,
VuoPoint2d  point 
)

Applies transform to point, using input Z coordinate 0 and discarding the transformed Z coordinate.

Definition at line 361 of file VuoTransform.c.

◆ VuoTransform_transform_VuoPoint3d()

VuoPoint3d VuoTransform_transform_VuoPoint3d ( VuoTransform  transform,
VuoPoint3d  point 
)

Applies transform to point.

Definition at line 369 of file VuoTransform.c.

◆ VuoTransform_transformPoint()

static VuoPoint3d VuoTransform_transformPoint ( const float *  matrix,
VuoPoint3d  point 
)
inlinestatic

Transforms point using matrix (a column-major matrix of 16 values), and returns the new point.

See also
VuoTransform_getMatrix

Definition at line 404 of file VuoTransform.h.

◆ VuoTransform_transformRectangle()

VuoRectangle VuoTransform_transformRectangle ( const float *  matrix,
VuoRectangle  rectangle 
)

Transforms rectangle using matrix (a column-major matrix of 16 values), and returns the new rectangle.

If the matrix specifies a rotation, this function returns an axis-aligned rectangle fully enclosing the source rectangle.

See also
VuoTransform_getMatrix

Definition at line 383 of file VuoTransform.c.

◆ VuoTransform_transformVector()

static VuoPoint3d VuoTransform_transformVector ( const float *  matrix,
VuoPoint3d  point 
)
inlinestatic

Transforms vector using matrix (a column-major matrix of 16 values), and returns the new vector.

Ignores the matrix's translation. Useful for adjusting normals.

See also
VuoTransform_getMatrix

Definition at line 425 of file VuoTransform.h.