Stay organized with collections
Save and categorize content based on your preferences.
Classes
BoundingBox |
Represents an axis-aligned bounding box in 3D space, defined by its minimum and maximum corner points.
|
FloatSize2d |
Size of a 2d object represented as a Float, such as the dimensions of a panel in meters.
|
FloatSize3d |
Size of a 3d object represented as a Float, such as the dimensions of a spatial volume in meters.
|
IntSize2d |
Size of a 2d object represented as an Int, such as the dimensions of the panel in pixels.
|
Matrix3 |
An immutable 3x3 matrix that represents rotation and scale.
|
Matrix4 |
An immutable 4x4 matrix that represents translation, scale, and rotation.
|
Pose |
Represents an immutable rigid transformation from one coordinate space to another.
|
Quaternion |
Represents a rotation component in three-dimensional space.
|
Ray |
Represents a ray in 3D space.
|
Vector2 |
Represents a position in the 2D plane.
|
Vector3 |
Represents a three-dimensional position in space.
|
Vector4 |
Represents a four-dimensional position in space.
|
Top-level functions summary
Top-level functions
fun lerp(a: Float, b: Float, t: Float): Float
Linearly interpolates between two values.
Parameters |
a: Float |
the start value.
|
b: Float |
the end value.
|
t: Float |
the ratio between the two floats.
|
Returns |
Float |
the interpolated value between a and b .
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-30 UTC."],[],[],null,["# androidx.xr.runtime.math\n========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/androidx/xr/runtime/math/package-summary \"View this page in Java\")\n\nClasses\n-------\n\n|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| [BoundingBox](/reference/kotlin/androidx/xr/runtime/math/BoundingBox) | Represents an axis-aligned bounding box in 3D space, defined by its minimum and maximum corner points. |\n| [FloatSize2d](/reference/kotlin/androidx/xr/runtime/math/FloatSize2d) | Size of a 2d object represented as a Float, such as the dimensions of a panel in meters. |\n| [FloatSize3d](/reference/kotlin/androidx/xr/runtime/math/FloatSize3d) | Size of a 3d object represented as a Float, such as the dimensions of a spatial volume in meters. |\n| [IntSize2d](/reference/kotlin/androidx/xr/runtime/math/IntSize2d) | Size of a 2d object represented as an Int, such as the dimensions of the panel in pixels. |\n| [Matrix3](/reference/kotlin/androidx/xr/runtime/math/Matrix3) | An immutable 3x3 matrix that represents rotation and scale. |\n| [Matrix4](/reference/kotlin/androidx/xr/runtime/math/Matrix4) | An immutable 4x4 matrix that represents translation, scale, and rotation. |\n| [Pose](/reference/kotlin/androidx/xr/runtime/math/Pose) | Represents an immutable rigid transformation from one coordinate space to another. |\n| [Quaternion](/reference/kotlin/androidx/xr/runtime/math/Quaternion) | Represents a rotation component in three-dimensional space. |\n| [Ray](/reference/kotlin/androidx/xr/runtime/math/Ray) | Represents a ray in 3D space. |\n| [Vector2](/reference/kotlin/androidx/xr/runtime/math/Vector2) | Represents a position in the 2D plane. |\n| [Vector3](/reference/kotlin/androidx/xr/runtime/math/Vector3) | Represents a three-dimensional position in space. |\n| [Vector4](/reference/kotlin/androidx/xr/runtime/math/Vector4) | Represents a four-dimensional position in space. |\n\nTop-level functions summary\n---------------------------\n\n|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [clamp](/reference/kotlin/androidx/xr/runtime/math/package-summary#clamp(kotlin.Float,kotlin.Float,kotlin.Float))`(x: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, min: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, max: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Clamps a value. |\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [lerp](/reference/kotlin/androidx/xr/runtime/math/package-summary#lerp(kotlin.Float,kotlin.Float,kotlin.Float))`(a: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, b: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, t: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Linearly interpolates between two values. |\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [toDegrees](/reference/kotlin/androidx/xr/runtime/math/package-summary#toDegrees(kotlin.Float))`(angleInRadians: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Converts [angleInRadians](/reference/kotlin/androidx/xr/runtime/math/package-summary#toDegrees(kotlin.Float)) from radians to degrees. |\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [toRadians](/reference/kotlin/androidx/xr/runtime/math/package-summary#toRadians(kotlin.Float))`(angleInDegrees: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Converts [angleInDegrees](/reference/kotlin/androidx/xr/runtime/math/package-summary#toRadians(kotlin.Float)) from degrees to radians. |\n\nTop-level functions\n-------------------\n\n### clamp\n\nArtifact: [androidx.xr.runtime:runtime](/jetpack/androidx/releases/xr-runtime) \n[View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:clamp) \nAdded in [1.0.0-alpha05](/jetpack/androidx/releases/xr-runtime#1.0.0-alpha05) \n\n```\nfun clamp(x: Float, min: Float, max: Float): Float\n```\n\nClamps a value. \n\n| Parameters |\n|----------------------------------------------------------------------------------------|---------------------|\n| `x: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the value to clamp. |\n| `min: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the minimum value. |\n| `max: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the maximum value. |\n\n### lerp\n\nArtifact: [androidx.xr.runtime:runtime](/jetpack/androidx/releases/xr-runtime) \n[View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:lerp) \nAdded in [1.0.0-alpha05](/jetpack/androidx/releases/xr-runtime#1.0.0-alpha05) \n\n```\nfun lerp(a: Float, b: Float, t: Float): Float\n```\n\nLinearly interpolates between two values. \n\n| Parameters |\n|--------------------------------------------------------------------------------------|-----------------------------------|\n| `a: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the start value. |\n| `b: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the end value. |\n| `t: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the ratio between the two floats. |\n\n| Returns |\n|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the interpolated value between [a](/reference/kotlin/androidx/xr/runtime/math/package-summary#lerp(kotlin.Float,kotlin.Float,kotlin.Float)) and [b](/reference/kotlin/androidx/xr/runtime/math/package-summary#lerp(kotlin.Float,kotlin.Float,kotlin.Float)). |\n\n### toDegrees\n\nArtifact: [androidx.xr.runtime:runtime](/jetpack/androidx/releases/xr-runtime) \n[View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:toDegrees) \nAdded in [1.0.0-alpha05](/jetpack/androidx/releases/xr-runtime#1.0.0-alpha05) \n\n```\nfun toDegrees(angleInRadians: Float): Float\n```\n\nConverts [angleInRadians](/reference/kotlin/androidx/xr/runtime/math/package-summary#toDegrees(kotlin.Float)) from radians to degrees. \n\n### toRadians\n\nArtifact: [androidx.xr.runtime:runtime](/jetpack/androidx/releases/xr-runtime) \n[View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:toRadians) \nAdded in [1.0.0-alpha05](/jetpack/androidx/releases/xr-runtime#1.0.0-alpha05) \n\n```\nfun toRadians(angleInDegrees: Float): Float\n```\n\nConverts [angleInDegrees](/reference/kotlin/androidx/xr/runtime/math/package-summary#toRadians(kotlin.Float)) from degrees to radians."]]