class Pose


Immutable rigid transformation from one coordinate space to another.

Summary

Public companion functions

Float
distance(lhs: Pose, rhs: Pose)

Returns the distance between the two poses.

Pose
fromLookAt(eye: Vector3, target: Vector3, up: Vector3)

Creates a pose looking at target from eye with up vector.

Pose
lerp(start: Pose, end: Pose, ratio: Float)

Linearly interpolates between start and end by ratio.

Public companion properties

Pose

Returns a new pose using the identity rotation.

Public constructors

Pose(other: Pose)

Creates a new pose with the same values as the other pose.

Pose(translation: Vector3, rotation: Quaternion)

Public functions

infix Pose
compose(other: Pose)

Returns the result of composing this with other.

Pose
copy(translation: Vector3, rotation: Quaternion)

Returns a copy of the pose.

open operator Boolean
equals(other: Any?)

Returns true if this pose is equal to the other.

Quaternion

Calculates rotation to align local Z-axis forward with other's up direction.

Quaternion

Calculates rotation to align local Y-axis up with other's up direction.

open Int
Pose
rotate(rotation: Quaternion)

Rotates this pose by the given rotation.

open String
infix Vector3

Transforms point using pose rotation and translation.

infix Vector3

Transforms vector using only pose rotation.

Pose
translate(translation: Vector3)

Translates this pose by the given translation.

Public properties

Vector3

The backward vector in the local coordinate system.

Vector3

The down vector in the local coordinate system.

Vector3

The forward vector in the local coordinate system.

Pose

Returns a pose that performs the opposite transformation.

Vector3

The left vector in the local coordinate system.

Vector3

The right vector in the local coordinate system.

Quaternion

the rotation component of this pose

Vector3

the translation component of this pose

Vector3

The up vector in the local coordinate system.

Public companion functions

distance

Added in 1.0.0
fun distance(lhs: Pose, rhs: Pose): Float

Returns the distance between the two poses.

Parameters
lhs: Pose

the first pose

rhs: Pose

the second pose

fromLookAt

Added in 1.0.0
fun fromLookAt(eye: Vector3, target: Vector3, up: Vector3 = Vector3.Up): Pose

Creates a pose looking at target from eye with up vector.

Parameters
eye: Vector3

the position from which to look at target

target: Vector3

the target position to look at

up: Vector3 = Vector3.Up

a vector indicating the general "up" direction

Returns
Pose

the pose oriented to look at target from eye position with up as the up vector

lerp

Added in 1.0.0
fun lerp(start: Pose, end: Pose, ratio: Float): Pose

Linearly interpolates between start and end by ratio. The position is lerped, but the rotation will be slerped if the angles are far apart.

If ratio is outside of the range [0, 1], the returned pose will be extrapolated.

Parameters
start: Pose

the starting pose

end: Pose

the ending pose

ratio: Float

the interpolation ratio

Public companion properties

Identity

val IdentityPose

Returns a new pose using the identity rotation.

Public constructors

Pose

Added in 1.0.0
Pose(other: Pose)

Creates a new pose with the same values as the other pose.

Pose

Added in 1.0.0
Pose(translation: Vector3 = Vector3(), rotation: Quaternion = Quaternion())

Public functions

compose

Added in 1.0.0
infix fun compose(other: Pose): Pose

Returns the result of composing this with other.

copy

Added in 1.0.0
fun copy(
    translation: Vector3 = this.translation,
    rotation: Quaternion = this.rotation
): Pose

Returns a copy of the pose.

Parameters
translation: Vector3 = this.translation

the new translation for the copied pose

rotation: Quaternion = this.rotation

the new rotation for the copied pose

equals

open operator fun equals(other: Any?): Boolean

Returns true if this pose is equal to the other.

getForwardVectorToUpRotation

Added in 1.0.0
fun getForwardVectorToUpRotation(other: Pose): Quaternion

Calculates rotation to align local Z-axis forward with other's up direction.

Parameters
other: Pose

the given pose

Returns
Quaternion

a Quaternion representing the rotation to apply to the pose

getUpVectorToUpRotation

Added in 1.0.0
fun getUpVectorToUpRotation(other: Pose): Quaternion

Calculates rotation to align local Y-axis up with other's up direction.

Parameters
other: Pose

the given pose

Returns
Quaternion

a Quaternion representing the rotation to apply to the pose

hashCode

open fun hashCode(): Int

rotate

Added in 1.0.0
fun rotate(rotation: Quaternion): Pose

Rotates this pose by the given rotation.

toString

open fun toString(): String

transformPoint

Added in 1.0.0
infix fun transformPoint(point: Vector3): Vector3

Transforms point using pose rotation and translation. A point represents a specific location in space and is affected by translation, scale, and orientation.

transformVector

Added in 1.0.0
infix fun transformVector(vector: Vector3): Vector3

Transforms vector using only pose rotation. A vector represents a direction and magnitude, not a specific location. It only needs to account for the scale and orientation of the space it is in since it has no position.

translate

Added in 1.0.0
fun translate(translation: Vector3): Pose

Translates this pose by the given translation.

Public properties

backward

Added in 1.0.0
val backwardVector3

The backward vector in the local coordinate system.

down

Added in 1.0.0
val downVector3

The down vector in the local coordinate system.

forward

Added in 1.0.0
val forwardVector3

The forward vector in the local coordinate system.

inverse

Added in 1.0.0
val inversePose

Returns a pose that performs the opposite transformation.

left

Added in 1.0.0
val leftVector3

The left vector in the local coordinate system.

right

Added in 1.0.0
val rightVector3

The right vector in the local coordinate system.

rotation

Added in 1.0.0
val rotationQuaternion

the rotation component of this pose

translation

Added in 1.0.0
val translationVector3

the translation component of this pose

up

Added in 1.0.0
val upVector3

The up vector in the local coordinate system.