Position

data class Position(val x: Float, val y: Float, val z: Float)

A point in 3-D space.

Distinct from Direction, Scale, and Color so the compiler stops you passing one where another is expected (they are all float-triples and trivially confused). All four are immutable, which also makes them stable Compose inputs — passing them to scene composables doesn't force needless recompositions the way the mutable Float3 did.

Interop with filament-utils vector math is a hop away: construct from a Float3 (Position(myFloat3)), or drop out with toFloat3/Float3.toPosition. Common in-domain math (translate, scale) is available as operators so you rarely need to.

Constructors

Link copied to clipboard
constructor(x: Float, y: Float, z: Float)
constructor(v: Float)

Uniform value on all axes.

constructor(v: Float3)

From a filament-utils Float3.

Properties

Link copied to clipboard
val x: Float
Link copied to clipboard
val y: Float
Link copied to clipboard
val z: Float

Functions

Link copied to clipboard
operator fun minus(d: Direction): Position

operator fun minus(other: Position): Direction

Displacement from other to this point.

Link copied to clipboard
operator fun plus(d: Direction): Position
Link copied to clipboard