Package com.jme3.math

Class TransformDp

java.lang.Object
com.jme3.math.TransformDp

public final class TransformDp extends Object
A 3-D coordinate transform composed of translation, rotation, and scaling. The order of application is: scale, then rotate, then translate.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • TransformDp

      public TransformDp()
      Instantiates an identity transform: no translation, no rotation, and no scaling.
    • TransformDp

      public TransformDp(Vec3d translate, Quatd rotate)
      Instantiates a coordinate transform without scaling.
      Parameters:
      translate - the desired translation (not null, unaffected)
      rotate - the desired rotation (not null, unaffected)
    • TransformDp

      public TransformDp(Vec3d translate, Quatd rotate, Vec3d scale)
      Instantiates a coordinate transform with scaling.
      Parameters:
      translate - the desired translation (not null, unaffected)
      rotate - the desired rotation (not null, unaffected)
      scale - the desired scaling (not null, unaffected)
    • TransformDp

      public TransformDp(TransformDp original)
      Instantiates a copy of the specified transform.
      Parameters:
      original - the instance to copy (not null, unaffected)
  • Method Details

    • combineWithParent

      public TransformDp combineWithParent(TransformDp parent)
      Combines with the argument and returns the (modified) current instance.

      It IS NOT safe for this and parent to be the same object.

      Parameters:
      parent - the parent transform (not null, unaffected unless it's this)
      Returns:
      the (modified) current instance (for chaining)
    • getRotation

      public Quatd getRotation()
      Accesses the rotation component.
      Returns:
      the pre-existing instance (not null)
    • getScale

      public Vec3d getScale()
      Accesses the scaling component.
      Returns:
      the pre-existing instance (not null)
    • getTranslation

      public Vec3d getTranslation()
      Accesses the translation component.
      Returns:
      the pre-existing instance (not null)
    • loadIdentity

      public TransformDp loadIdentity()
      Sets the current instance to the identity transform: translation=(0,0,0) scaling=(1,1,1) rotation=(0,0,0,1).
      Returns:
      the (modified) current instance (for chaining)
    • set

      public TransformDp set(TransformDp original)
      Copies all 3 components from the argument.
      Parameters:
      original - the TransformDp to copy (not null, unaffected)
      Returns:
      the (modified) current instance (for chaining)
    • set

      public TransformDp set(Vec3d translate, Quatd rotate, Vec3d scale)
      Sets all 3 components to the specified values.
      Parameters:
      translate - the desired translation (not null, unaffected)
      rotate - the desired rotation (not null, unaffected)
      scale - the desired scaling (not null, unaffected)
      Returns:
      the (modified) current instance (for chaining)
    • setRotation

      public TransformDp setRotation(Quatd rotate)
      Sets the rotation component to the argument.
      Parameters:
      rotate - the desired rotation value (not null, unaffected)
      Returns:
      the (modified) current instance (for chaining)
    • setScale

      public TransformDp setScale(double factor)
      Sets all components of the scaling component to the argument.
      Parameters:
      factor - the desired scale factor
      Returns:
      the (modified) current instance (for chaining)
    • setScale

      public TransformDp setScale(Vec3d scale)
      Sets the scaling component to the argument.
      Parameters:
      scale - the desired scaling (not null, unaffected)
      Returns:
      the (modified) current instance (for chaining)
    • setTranslation

      public TransformDp setTranslation(Vec3d translate)
      Sets the translation component to the argument.
      Parameters:
      translate - the desired translation (not null, unaffected)
      Returns:
      the (modified) current instance (for chaining)
    • transformInverseVector

      public Vec3d transformInverseVector(Vec3d in, Vec3d storeResult)
      Applies the inverse transform to the specified coordinates and returns the result in storeResult. If the storeResult is null, a new Vec3d is created to hold the value. Either way, the current instance is unaffected, unless storeResult is its translation or scaling.

      It IS safe for in and storeResult to be the same object.

      Parameters:
      in - the coordinates to transform (not null, unaffected unless it's storeResult)
      storeResult - storage for the result (modified if not null)
      Returns:
      the transformed coordinates (either storeResult or a new Vec3d)
    • transformVector

      public Vec3d transformVector(Vec3d in, Vec3d storeResult)
      Transforms the specified coordinates and returns the result in storeResult. If the storeResult is null, a new Vec3d is created to hold the value. Either way, the current instance is unaffected, unless storeResult is its scaling component or its translation component.

      It IS safe for in and storeResult to be the same object.

      Parameters:
      in - the coordinates to transform (not null, unaffected unless it's storeResult)
      storeResult - storage for the result (modified if not null)
      Returns:
      the transformed coordinates (either storeResult or a new Vec3d)
    • equals

      public boolean equals(Object otherObject)
      Tests for exact equality with the argument, distinguishing -0 from 0. If otherObject is null, false is returned. Either way, the current instance is unaffected.
      Overrides:
      equals in class Object
      Parameters:
      otherObject - the object to compare (may be null, unaffected)
      Returns:
      true if this and otherObject have identical values, otherwise false
    • hashCode

      public int hashCode()
      Returns a hash code. If two transforms have identical values, they will have the same hash code. The current instance is unaffected.
      Overrides:
      hashCode in class Object
      Returns:
      a 32-bit value for use in hashing
    • toString

      public String toString()
      Returns a string representation of the transform, which is unaffected. For example, the identity transform is represented by:
       TransformDp[ 0.0, 0.0, 0.0]
       [ 0.0, 0.0, 0.0, 1.0]
       [ 1.0 , 1.0, 1.0]
       
      Overrides:
      toString in class Object
      Returns:
      the string representation (not null, not empty)