Method InverseTransformDirection
InverseTransformDirection(float3)
Transforms a direction by the inverse of this transform.
Declaration
public float3 InverseTransformDirection(float3 direction)
Parameters
| Type | Name | Description |
|---|---|---|
| float3 | direction | The direction to be transformed. |
Returns
| Type | Description |
|---|---|
| float3 | The direction after transformation. |
Remarks
To apply a forward transform instead, use TransformDirection(float3). To inverse-transform a point instead, use InverseTransformPoint(float3).
Examples
float3 dir = new float3(2, 1, 0);
LocalTransform translationTransform = LocalTransform.FromPosition(new float3(1, 2, 3));
// dir2 will be identical to dir; transforming a direction by a translation does not change its direction.
float3 dir2 = translationTransform.TransformDirection(dir);
// Rotate the direction by pi/2 radians around the X axis, and back again.
LocalTransform rotationTransform = LocalTransform.FromRotation(quaternion.RotateX(math.PI2));
float3 dir3 = rotationTransform.TransformDirection(dir);
// dir4 should be identical to dir, within the limits of floating-point precision
float3 dir4 = rotationTransform.InverseTransformDirection(dir3);