xr_ai_tools.spatial#
Pure spatial calculations for native XR tools.
Functions#
|
Offset a point along the user's horizontal axes and world-space up. |
|
Return a point along the user's three-dimensional gaze direction. |
|
Return a point in a named direction from the user's frame origin. |
|
Return a point in a named user-relative direction from an anchor. |
|
Move a point by a signed distance along the line toward a target. |
|
Return the midpoint between two positions. |
Module Contents#
- xr_ai_tools.spatial.offset_user_frame(
- frame: xr_ai_tools.types.SpatialFrame,
- start: xr_ai_tools.types.Vector3,
- *,
- forward: float = 0.0,
- right: float = 0.0,
- up: float = 0.0,
Offset a point along the user’s horizontal axes and world-space up.
The user’s forward and right axes are projected onto the horizontal plane. Returned coordinates are rounded to millimeter precision.
- xr_ai_tools.spatial.gaze_target(
- frame: xr_ai_tools.types.SpatialFrame,
- distance: float = 1.5,
Return a point along the user’s three-dimensional gaze direction.
- xr_ai_tools.spatial.user_relative(
- frame: xr_ai_tools.types.SpatialFrame,
- direction: Literal['front', 'back', 'left', 'right', 'above', 'below'],
- distance: float,
Return a point in a named direction from the user’s frame origin.
- xr_ai_tools.spatial.anchor_relative(
- frame: xr_ai_tools.types.SpatialFrame,
- anchor: xr_ai_tools.types.Vector3,
- relation: Literal['toward_user', 'away_from_user', 'left_of', 'right_of', 'above', 'below'],
- distance: float,
Return a point in a named user-relative direction from an anchor.
- xr_ai_tools.spatial.toward(
- start: xr_ai_tools.types.Vector3,
- target: xr_ai_tools.types.Vector3,
- distance: float,
Move a point by a signed distance along the line toward a target.
- xr_ai_tools.spatial.midpoint(
- first: xr_ai_tools.types.Vector3,
- second: xr_ai_tools.types.Vector3,
Return the midpoint between two positions.