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

A transformation in 3D (3x3 linear transformation matrix + translation vector). More...

Inherits IEquatable< Transform >, and IComparable< Transform >.

Public Member Functions

 Transform (float d)
 Constructor to either the zero or the identity transformation. More...
 
 Transform (Matrix matrix, Vector offset)
 A constructor that requires a matrix and a vector offset. More...
 
int CompareTo (Transform transform)
 Compares the transforms. More...
 
override bool Equals (object obj)
 Returns true if the elements of the two matrices and translations are exactly equal (unlike operator== which uses epsilon).
 
bool Equals (Transform transform)
 Returns true if the elements of the two matrices and translations are exactly equal (unlike operator== which uses epsilon).
 
override int GetHashCode ()
 
Transform Inverse ()
 Inverts the matrix and transforms the translation vector accordingly.
 
Transform ReplaceMatrix (Matrix matrix)
 Returns a new Transform with its Matrix replaced with the given one. More...
 
Transform ReplaceOffset (Vector offset)
 Returns a new Transform with its Offset replaced with the given one. More...
 
Transform Rotate (Vector axis)
 Returns a new Transform with a rotation applied after the current transformation More...
 
Transform Scale (Vector scale)
 Returns a new Transform with a scale applied after the current transformation More...
 
override string ToString ()
 
Vector TransformVector (Vector v)
 Transform a vector by the transformation, ignoring translation. This is different from operator*, which adds in the translation.
 
Transform Translate (Vector offset)
 Returns a new Transform with the offset translated by the given Vector More...
 

Static Public Member Functions

static Transform FromString (string transform)
 Parses a transform string value and returns a transform instance. More...
 
static Vector inverseTransform (Vector v, Transform tm)
 Inverse-transform a point with a transform. The transform must have an orthonormal matrix (no scaling).
 
static bool operator!= (Transform t0, Transform t1)
 
static Transform operator* (float factor, Transform tm)
 
static Transform operator* (Transform left, Transform right)
 
static Transform operator* (Transform tm, float factor)
 
static Vector operator* (Transform tm, Vector v)
 
static Transform operator+ (Transform left, Transform right)
 
static Transform operator- (Transform left, Transform right)
 
static Transform operator- (Transform tm)
 
static Transform operator/ (Transform tm, float divisor)
 
static bool operator== (Transform t0, Transform t1)
 

Static Public Attributes

static readonly Transform Identity = new Transform(Matrix.Identity, default(Vector))
 
static readonly Transform Zero = new Transform(Matrix.Zero, default(Vector))
 

Properties

Matrix Matrix [get]
 Returns the matrix component (rotation + scale).
 
Vector Offset [get]
 Returns the offset (translation).
 

Detailed Description

A transformation in 3D (3x3 linear transformation matrix + translation vector).

Constructor & Destructor Documentation

◆ Transform() [1/2]

VRay.Transform.Transform ( Matrix  matrix,
Vector  offset 
)

A constructor that requires a matrix and a vector offset.

Parameters
matrixThe matrix transform.
offsetThe vector offset.

◆ Transform() [2/2]

VRay.Transform.Transform ( float  d)

Constructor to either the zero or the identity transformation.

Parameters
dConstructs the transformation with the specified value for the main matrix diagonal. If 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

◆ CompareTo()

int VRay.Transform.CompareTo ( Transform  transform)

Compares the transforms.

Parameters
transformThe transform to compare to
Returns
-1 if this transform is less than the passed one, 0 if they are equal, +1 if greater.

◆ FromString()

static Transform VRay.Transform.FromString ( string  transform)
static

Parses a transform string value and returns a transform instance.

Parameters
transformThe string representation of the transform.
Returns
The transform instance.

◆ ReplaceMatrix()

Transform VRay.Transform.ReplaceMatrix ( Matrix  matrix)

Returns a new Transform with its Matrix replaced with the given one.

Parameters
matrixThe new Matrix to replace the old one.
Returns
A new Transform with replaced Matrix.

◆ ReplaceOffset()

Transform VRay.Transform.ReplaceOffset ( Vector  offset)

Returns a new Transform with its Offset replaced with the given one.

Parameters
offsetThe new Offset to replace the old one.
Returns
A new Transform with replaced Offset.

◆ Rotate()

Transform VRay.Transform.Rotate ( Vector  axis)

Returns a new Transform with a rotation applied after the current transformation

Parameters
axisThe axis to rotate around. The length of the axis is the tangent of the angle of rotation.
Returns
The new Transform

◆ Scale()

Transform VRay.Transform.Scale ( Vector  scale)

Returns a new Transform with a scale applied after the current transformation

Parameters
scaleThe axes to scale by
Returns
The new Transform

◆ Translate()

Transform VRay.Transform.Translate ( Vector  offset)

Returns a new Transform with the offset translated by the given Vector

Parameters
offsetThe Vector to translate by
Returns
The new Transform

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