androidx.xr.runtime.math


Classes

BoundingBox

Axis-aligned bounding box in 3D space, defined by minimum and maximum corners.

FieldOfView

Field of view of a virtual or rendering camera.

FloatSize2d

2D size represented as a Float (e.g., panel dimensions in meters).

FloatSize3d

3D size represented as a Float (e.g., spatial volume dimensions in meters).

GeospatialPose

Describes a specific location, elevation, and orientation relative to Earth.

IntSize2d

2D size represented as an Int (e.g., panel dimensions in pixels).

Matrix3

An immutable 3x3 matrix that represents rotation and scale.

Matrix4

An immutable 4x4 matrix that represents translation, scale, and rotation.

Pose

Immutable rigid transformation from one coordinate space to another.

Quaternion

Rotation component in three-dimensional space.

Ray

Ray in 3D space defined by an origin point and a direction vector.

Vector2

Position in the 2D plane.

Vector3

Three-dimensional position in space.

Vector4

Four-dimensional position in space.

Top-level functions summary

Float
clamp(x: Float, min: Float, max: Float)

Clamps a value.

Float
lerp(a: Float, b: Float, t: Float)

Linearly interpolates between two values.

Float
toDegrees(angleInRadians: Float)

Converts angleInRadians from radians to degrees.

Float
toRadians(angleInDegrees: Float)

Converts angleInDegrees from degrees to radians.

Top-level functions

fun clamp(x: Float, min: Float, max: Float): Float

Clamps a value.

Parameters
x: Float

the value to clamp

min: Float

the minimum value

max: Float

the maximum value

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

fun toDegrees(angleInRadians: Float): Float

Converts angleInRadians from radians to degrees.

Parameters
angleInRadians: Float

the angle in radians

fun toRadians(angleInDegrees: Float): Float

Converts angleInDegrees from degrees to radians.

Parameters
angleInDegrees: Float

the angle in degrees