Package com.jme3.math
Class TransformDp
java.lang.Object
com.jme3.math.TransformDp
A 3-D coordinate transform composed of translation, rotation, and scaling.
The order of application is: scale, then rotate, then translate.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionInstantiates an identity transform: no translation, no rotation, and no scaling.TransformDp
(TransformDp original) Instantiates a copy of the specified transform.TransformDp
(Vec3d translate, Quatd rotate) Instantiates a coordinate transform without scaling.TransformDp
(Vec3d translate, Quatd rotate, Vec3d scale) Instantiates a coordinate transform with scaling. -
Method Summary
Modifier and TypeMethodDescriptioncombineWithParent
(TransformDp parent) Combines with the argument and returns the (modified) current instance.boolean
Tests for exact equality with the argument, distinguishing -0 from 0.Accesses the rotation component.getScale()
Accesses the scaling component.Accesses the translation component.int
hashCode()
Returns a hash code.Sets the current instance to the identity transform: translation=(0,0,0) scaling=(1,1,1) rotation=(0,0,0,1).set
(TransformDp original) Copies all 3 components from the argument.Sets all 3 components to the specified values.setRotation
(Quatd rotate) Sets the rotation component to the argument.setScale
(double factor) Sets all components of the scaling component to the argument.Sets the scaling component to the argument.setTranslation
(Vec3d translate) Sets the translation component to the argument.toString()
Returns a string representation of the transform, which is unaffected.transformInverseVector
(Vec3d in, Vec3d storeResult) Applies the inverse transform to the specified coordinates and returns the result instoreResult
.transformVector
(Vec3d in, Vec3d storeResult) Transforms the specified coordinates and returns the result instoreResult
.
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
TransformDp
public TransformDp()Instantiates an identity transform: no translation, no rotation, and no scaling. -
TransformDp
Instantiates a coordinate transform without scaling.- Parameters:
translate
- the desired translation (not null, unaffected)rotate
- the desired rotation (not null, unaffected)
-
TransformDp
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
Instantiates a copy of the specified transform.- Parameters:
original
- the instance to copy (not null, unaffected)
-
-
Method Details
-
combineWithParent
Combines with the argument and returns the (modified) current instance.It IS NOT safe for
this
andparent
to be the same object.- Parameters:
parent
- the parent transform (not null, unaffected unless it'sthis
)- Returns:
- the (modified) current instance (for chaining)
-
getRotation
Accesses the rotation component.- Returns:
- the pre-existing instance (not null)
-
getScale
Accesses the scaling component.- Returns:
- the pre-existing instance (not null)
-
getTranslation
Accesses the translation component.- Returns:
- the pre-existing instance (not null)
-
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
Copies all 3 components from the argument.- Parameters:
original
- the TransformDp to copy (not null, unaffected)- Returns:
- the (modified) current instance (for chaining)
-
set
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
Sets the rotation component to the argument.- Parameters:
rotate
- the desired rotation value (not null, unaffected)- Returns:
- the (modified) current instance (for chaining)
-
setScale
Sets all components of the scaling component to the argument.- Parameters:
factor
- the desired scale factor- Returns:
- the (modified) current instance (for chaining)
-
setScale
Sets the scaling component to the argument.- Parameters:
scale
- the desired scaling (not null, unaffected)- Returns:
- the (modified) current instance (for chaining)
-
setTranslation
Sets the translation component to the argument.- Parameters:
translate
- the desired translation (not null, unaffected)- Returns:
- the (modified) current instance (for chaining)
-
transformInverseVector
Applies the inverse transform to the specified coordinates and returns the result instoreResult
. If thestoreResult
is null, a new Vec3d is created to hold the value. Either way, the current instance is unaffected, unlessstoreResult
is its translation or scaling.It IS safe for
in
andstoreResult
to be the same object.- Parameters:
in
- the coordinates to transform (not null, unaffected unless it'sstoreResult
)storeResult
- storage for the result (modified if not null)- Returns:
- the transformed coordinates (either
storeResult
or a new Vec3d)
-
transformVector
Transforms the specified coordinates and returns the result instoreResult
. If thestoreResult
is null, a new Vec3d is created to hold the value. Either way, the current instance is unaffected, unlessstoreResult
is its scaling component or its translation component.It IS safe for
in
andstoreResult
to be the same object.- Parameters:
in
- the coordinates to transform (not null, unaffected unless it'sstoreResult
)storeResult
- storage for the result (modified if not null)- Returns:
- the transformed coordinates (either
storeResult
or a new Vec3d)
-
equals
Tests for exact equality with the argument, distinguishing -0 from 0. IfotherObject
is null, false is returned. Either way, the current instance is unaffected. -
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. -
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]
-