API reference
API reference
Select your platform
No SDKs available
No versions available

TransformBuilder

TransformBuilder

class TransformBuilder
A builder class for creating and chaining spatial transformations that result in a final Pose
TransformBuilder allows for the creation of complex transformations by combining translation and rotation operations. These operations can be chained together to create composite transformations.
It is important to note that chaining transformations makes it so that the subsequent transformations are applied as if looking from the rotation of the previous transformation, not from the world graph. For example, if you rotate 180 degrees around the y-axis, then move +1 meter along the z-axis, the resulting world position will be (0, 0, -1) instead of (0, 0, 1).
Example usage:
val pose = TransformBuilder().move(1f, 2f, 3f).then(TransformBuilder().rotateX(90f)).build()

Constructors

NameSummary
TransformBuilder
constructor()

Types

NameSummary
class TransformStepBuilder(var value: Pose? = null, var root: TransformBuilder, var left: TransformBuilder.TransformStepBuilder? = null, var right: TransformBuilder.TransformStepBuilder? = null)

A builder class for chaining transformation steps. This is as a helper class for TransformBuilder. Use the TransformBuilder to create your transforms

Functions

NameSummary
build
fun build(): Transform

Builds the final Transform from the configured transformation steps.
cosDegrees
fun cosDegrees(angleInDegrees: Float): Float

Helper function that calculates the cosine of an angle specified in degrees.
degreesToRadians
fun degreesToRadians(angleInDegrees: Float): Float

Helper function that converts an angle from degrees to radians.
move
fun move(x: Float = 0.0f, y: Float = 0.0f, z: Float = 0.0f): TransformBuilder.TransformStepBuilder

Creates a translation transformation.
rotate_x
fun rotate_x(angleInDegrees: Float): Quaternion

Helper function that creates a quaternion representing a rotation around the X axis.
rotate_y
fun rotate_y(angleInDegrees: Float): Quaternion

Helper function that creates a quaternion representing a rotation around the Y axis.
rotate_z
fun rotate_z(angleInDegrees: Float): Quaternion

Helper function that creates a quaternion representing a rotation around the Z axis.
rotateX
fun rotateX(angleInDegrees: Float): TransformBuilder.TransformStepBuilder

Creates a rotation transformation around the X axis.
rotateY
fun rotateY(angleInDegrees: Float): TransformBuilder.TransformStepBuilder

Creates a rotation transformation around the Y axis.
rotateZ
fun rotateZ(angleInDegrees: Float): TransformBuilder.TransformStepBuilder

Creates a rotation transformation around the Z axis.
sinDegrees
fun sinDegrees(angleInDegrees: Float): Float

Helper function that calculates the sine of an angle specified in degrees.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon