AffineTransform

Description

struct Tinman.Terrain.Util.AffineTransform

Represents an affine transformation matrix that is decomposable into translation, rotation / reflection, and uniform scaling.

Public / Constants

Identity


public static readonly attribute Identity → (AffineTransform)

The identity transform.

Public / Constructors

Affine​Transform

7 overloads


public constructor AffineTransform1 → (1)

translation in : Vec3D

The translation component of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform2 → (1)

rotation in : Mat3D

The affine matrix that represents the rotation component of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform3 → (1)

scaling in : float64

The uniform scale factor of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform4 → (2)

translation in : Vec3D

The translation component of the affine transform.

rotation in : Mat3D

The matrix that represents the rotation / reflection component of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform5 → (2)

translation in : Vec3D

The translation component of the affine transform.

scaling in : float64

The uniform scale factor of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform6 → (2)

rotation in : Mat3D

The matrix that represents the rotation / reflection component of the affine transform.

scaling in : float64

The uniform scale factor of the affine transform.

Creates a new instance of AffineTransform.


public constructor AffineTransform7 → (3)

translation in : Vec3D

The translation component of the affine transform.

rotation in : Mat3D

The matrix that represents the rotation / reflection component of the affine transform.

scaling in : float64

The uniform scale factor of the affine transform.

Creates a new instance of AffineTransform.

From​Matrix

3 overloads


[Pure]
public static method FromMatrix1 → (2)

matrix in : Mat3D

The matrix for which to create an affine transform.

translation opt : Vec3D = default(Vec3D)

The translation component of the affine transform.

returns → AffineTransform

The affine transform.

Creates a new instance of AffineTransform.

The non-uniform scaling part of matrix in will be dropped.


[Pure]
public static method FromMatrix2 → (1)

matrix in : Mat4D

The matrix for which to create an affine transform.

returns → AffineTransform

The affine transform.

Creates a new instance of AffineTransform.

The non-uniform scaling and homogeneous parts of matrix in will be dropped.


[Pure]
public static method FromMatrix3 → (2)

matrix in : Mat4D

The matrix for which to create an affine transform.

remainder out : Mat4D

The non-affine transformation part that remains (will be written to after reading from matrix in):

M = A x R

where M is matrix in, A is the returned affine transformation and R is remainder out.

returns → AffineTransform

The affine transform.

Creates a new instance of AffineTransform.

The non-uniform scaling and homogeneous parts of matrix in will be stored into remainder out.

Public / Methods

Append


[Pure]
public method Append → (1)

transform in : AffineTransform

The affine transform to append.

returns → AffineTransform

The resulting affine transform, which applies this affine transform first and the given transform in afterwards. This is opposite to matrix multiplication:

FromMatrix(transform.ToMatrix().Mul(this.ToMatrix()))

Appends the given affine transform to this one.

Append​Inv


[Pure]
public method AppendInv → (1)

transform in : AffineTransform

The affine transform which inverse to append.

returns → AffineTransform

The resulting affine transform, which applies this affine transform first and the inverse of the given transform in afterwards. This is opposite to matrix multiplication:

FromMatrix(transform.ToMatrixInv().Mul(this.ToMatrix()))

Appends the inverse of the given affine transform to this one.

Equals​Almost


[Pure]
public method EqualsAlmost → (1)

other in : AffineTransform

The other transform.

returns → bool

true if both transforms are similar, false if they are not.

Checks if this transform and the given one are similar but necessarily equal.

See also

Maths.Similar2

Rotate


[Pure]
public method Rotate → (1)

matrix in : Mat3D

The rotation matrix to apply.

returns → AffineTransform

The resulting affine transform.

Applies the given rotation matrix in to this affine transform.

Using this method is equivalent to calling Append on this affine transform, passing a rotation-only transform created from matrix in.

Rotate​Keep​Translation


[Pure]
public method RotateKeepTranslation → (1)

matrix in : Mat3D

The rotation matrix to apply.

returns → AffineTransform

The resulting affine transform.

Applies the given rotation matrix in to this affine transform.

Using this method is not (!) equivalent to calling Append on this affine transform, passing a rotation-only transform created from matrix in, because Translation is not modified.

Scale


[Pure]
public method Scale → (1)

factor in : float64

The scale factor to apply.

returns → AffineTransform

The resulting affine transform.

Applies the given scale factor in to this affine transform.

Using this method is equivalent to calling Append on this affine transform, passing a scaling-only transform created from factor in.

Scale​Keep​Translation


[Pure]
public method ScaleKeepTranslation → (1)

factor in : float64

The scale factor to apply.

returns → AffineTransform

The resulting affine transform.

Applies the given scale factor in to this affine transform.

Using this method is not (!) equivalent to calling Append on this affine transform, passing a scaling-only transform created from factor in, because Translation is not modified.

To​Matrix


[Pure]
public method ToMatrix → ()

returns → Mat4D

The matrix.

Converts this affine transform into a matrix.

To​Matrix​Inv


[Pure]
public method ToMatrixInv → ()

returns → Mat4D

The matrix.

Converts the inverse of this affine transform into a matrix.

Transform​Box


[Pure]
public method TransformBox → (1)

box in : Box3D

The axis-aligned bounding box.

returns → Box3D

The transformed axis-aligned bounding box.

Transforms the given axis-aligned bounding box with this affine transformation.

Transform​Box​Inv


[Pure]
public method TransformBoxInv → (1)

box in : Box3D

The axis-aligned bounding box.

returns → Box3D

The transformed axis-aligned bounding box.

Transforms the given axis-aligned bounding box with the inverse of this affine transformation.

Transform​Point

2 overloads


[Pure]
public method TransformPoint1 → (1)

point in : Vec3D

The point.

returns → Vec3D

The transformed point.

Transforms the given point with this affine transformation.


[Pure]
public method TransformPoint2 → (3)

in : float64

X-coordinate of the point.

in : float64

Y-coordinate of the point.

in : float64

Z-coordinate of the point.

returns → Vec3D

The transformed point.

Transforms the given point with this affine transformation.

Transform​Point​Inv

2 overloads


[Pure]
public method TransformPointInv1 → (3)

in : float64

X-coordinate of the point.

in : float64

Y-coordinate of the point.

in : float64

Z-coordinate of the point.

returns → Vec3D

The transformed point.

Transforms the given point with the inverse of this affine transformation.


[Pure]
public method TransformPointInv2 → (1)

point in : Vec3D

The point.

returns → Vec3D

The transformed point.

Transforms the given point with the inverse of this affine transformation.

Transform​Range


[Pure]
public method TransformRange → (1)

range in : RangeD

The range.

returns → RangeD

The transformed range.

Transforms the given range with this affine transformation.

Transform​Range​Inv


[Pure]
public method TransformRangeInv → (1)

range in : RangeD

The range.

returns → RangeD

The transformed range.

Transforms the given range with the inverse of this affine transformation.

Transform​Ray


[Pure]
public method TransformRay → (1)

ray in : Ray

The ray.

returns → Ray

The transformed ray.

Transforms the given ray.

Transform​Ray​Inv


[Pure]
public method TransformRayInv → (1)

ray in : Ray

The ray.

returns → Ray

The transformed ray.

Transforms the given ray with the inverse of this affine transformation.

Transform​Scalar


[Pure]
public method TransformScalar → (1)

in : float64

The scalar value.

returns → float64

The transformed scalar.

Transforms the given scalar with this affine transformation.

Transform​Scalar​Inv


[Pure]
public method TransformScalarInv → (1)

in : float64

The scalar value.

returns → float64

The transformed scalar.

Transforms the given scalar with the inverse of this affine transformation.

Transform​Sphere


[Pure]
public method TransformSphere → (1)

sphere in : Sphere

The bounding sphere.

returns → Sphere

The transformed bounding sphere box.

Transforms the given bounding sphere with this affine transformation.

Transform​Sphere​Inv


[Pure]
public method TransformSphereInv → (1)

sphere in : Sphere

The bounding sphere.

returns → Sphere

The transformed bounding sphere box.

Transforms the given bounding sphere with the inverse of this affine transformation.

Transform​Vector

2 overloads


[Pure]
public method TransformVector1 → (1)

vector in : Vec3D

The vector.

returns → Vec3D

The transformed vector.

Transforms the given vector with this affine transformation.


[Pure]
public method TransformVector2 → (3)

in : float64

X-component of the vector.

in : float64

Y-component of the vector.

in : float64

Z-component of the vector.

returns → Vec3D

The transformed vector.

Transforms the given vector with this affine transformation.

Transform​Vector​Inv

2 overloads


[Pure]
public method TransformVectorInv1 → (1)

vector in : Vec3D

The vector.

returns → Vec3D

The transformed vector.

Transforms the given vector with the inverse of this affine transformation.


[Pure]
public method TransformVectorInv2 → (3)

in : float64

X-component of the vector.

in : float64

Y-component of the vector.

in : float64

Z-component of the vector.

returns → Vec3D

The transformed vector.

Transforms the given vector with the inverse of this affine transformation.

Translate


[Pure]
public method Translate → (1)

amount in : Vec3D

The translation amount to apply

returns → AffineTransform

The resulting affine transform.

Add the given translation amount in to Translation

Using this method is equivalent to calling Append on this affine transform, passing a translation-only transform created from amount in.

Public / Attributes

Determinant


public attribute Determinant → (get)

value : float64

The sign of the value of Mat4D.Determinant of ToMatrix.

Returns the sign of the determinant of the matrix that corresponds to this affine transformation.

Rotation


public readonly attribute Rotation → (Mat3D)

The orthonormal matrix that represents the rotation / reflection component of the transform.

Scaling


public readonly attribute Scaling → (float64)

The uniform scale factor of the transform.

Translation


public readonly attribute Translation → (Vec3D)

The translation component of the transform.