Skip to main content

Auki::Ark::CoordinateEnvironment

Holds transformation matrices and converts points, directions and poses from one coordinate system to another.

Public Functions

Name
CoordinateEnvironment(Matrix4x4 textureToProjectedCoordinatesMatrix, Matrix4x4 projectionMatrix, Matrix4x4 worldToCameraMatrix, Matrix4x4 screenToNDCMatrix, Matrix4x4 sessionOriginToWorldMatrix)
Constructor.
CoordinateEnvironment(Texture texture, Matrix4x4 projectionMatrix, Matrix4x4 worldToCameraMatrix)
Constructor.
CoordinateEnvironment(Matrix4x4 textureToProjectedCoordinatesMatrix, Matrix4x4 projectionMatrix, Matrix4x4 worldToCameraMatrix)
Constructor.
CoordinateEnvironment(Texture texture, Camera camera)
Constructor.
CoordinateEnvironment(Texture texture, Matrix4x4 projectionMatrix, Matrix4x4 worldToCameraMatrix, Matrix4x4 sessionOriginToWorldMatrix)
Constructor.
Vector3CameraSpaceToWorldSpace(Vector3 inCamera, float w =1.0f)
Converts coordinates from camera space to world space.
Vector2WorldSpaceToTextureSpace(Vector3 inWorld)
Converts coordinates from world space to texture space.
Vector3TextureSpaceToCameraSpace(Vector2 inTexture, float z)
Converts coordinates from texture space to camera space.
Vector3TextureSpaceToNaiveCameraSpace(Vector2 inTexture, float z)
Converts coordinates from texture space to naive camera space (Z pointing forward).
Vector3CameraSpaceToNaiveCameraSpace(Vector3 v)
Converts coordinates from Unity camera space (Z pointing backwards) to native camera space (Z pointing forward).
Vector2CameraSpaceToScreenSpace(Vector3 inCamera)
Converts coordinates from camera space to screen space.
Vector2CameraSpaceToTextureSpace(Vector3 inCamera)
Converts coordinates from camera space to texture space.
Vector2TextureSpaceToScreenSpace(Vector2 inTexture)
Converts coordinates from texture space to screen space.
Vector3WorldSpaceToSessionOriginSpace(Vector3 inWorld, float w =1.0f)
Converts coordinates from world space to session origin space.
Vector3SessionOriginSpaceToWorldSpace(Vector3 inSessionOrigin, float w =1.0f)
Converts coordinates from session origin space to world space.
Vector3CameraSpaceToSessionOriginSpace(Vector3 inCamera, float w =1.0f)
Converts coordinates from camera space to session origin space.
PoseCameraSpaceToWorldSpace(Pose inCamera)
Converts a pose from camera space to world space.
PoseCameraPoseInWorldSpace()
Returns the camera pose in world space.
QuaternionCameraRotationInWorldSpace()
Returns the camera rotation in world space.
PoseWorldSpaceToSessionOriginSpace(Pose inWorld)
Converts a pose from world space to session origin space.
PoseSessionOriginSpaceToWorldSpace(Pose inSessionOrigin)
Converts a pose from session origin space to world space.
PoseCameraSpaceToSessionOriginSpace(Pose inCamera)
Converts a pose from camera space to session origin space.
RayTexturePointToWorldRay(Vector2 texturePoint)
Constructs a Ray starting from the given texture coordinate, going "into" the screen. Essentially the same as Camera.ScreenPointToRay but using the matrices of this coordinate environment instead of a Unity camera component.

Public Properties

Name
Matrix4x4textureToProjectedCoordinatesMatrix
Texture to projected coordinates matrix. See Manna.ProcessVideoFrameTexture documentation for more details.
Matrix4x4projectionMatrix
Projection matrix, aka arCamera.projectionMatrix.
Matrix4x4worldToCameraMatrix
World-to-camera matrix, aka arCamera.worldToCameraMatrix.

Public Functions Documentation

function CoordinateEnvironment

CoordinateEnvironment(
Matrix4x4 textureToProjectedCoordinatesMatrix,
Matrix4x4 projectionMatrix,
Matrix4x4 worldToCameraMatrix,
Matrix4x4 screenToNDCMatrix,
Matrix4x4 sessionOriginToWorldMatrix
)

Constructor.

Parameters:

  • textureToProjectedCoordinatesMatrix Texture to projected coordinates matrix
  • projectionMatrix Projection matrix
  • worldToCameraMatrix World to camera matrix
  • screenToNDCMatrix Screen to NDC matrix
  • sessionOriginToWorldMatrix Session origin to world matrix

function CoordinateEnvironment

CoordinateEnvironment(
Texture texture,
Matrix4x4 projectionMatrix,
Matrix4x4 worldToCameraMatrix
)

Constructor.

Parameters:

  • texture Texture associated to the CoordinateEnvironment
  • projectionMatrix Projection matrix
  • worldToCameraMatrix World to camera matrix

function CoordinateEnvironment

CoordinateEnvironment(
Matrix4x4 textureToProjectedCoordinatesMatrix,
Matrix4x4 projectionMatrix,
Matrix4x4 worldToCameraMatrix
)

Constructor.

Parameters:

  • textureToProjectedCoordinatesMatrix Texture to projected coordinates matrix
  • projectionMatrix Projection matrix
  • worldToCameraMatrix World to camera matrix

function CoordinateEnvironment

CoordinateEnvironment(
Texture texture,
Camera camera
)

Constructor.

Parameters:

  • texture Input texture
  • camera Camera

function CoordinateEnvironment

CoordinateEnvironment(
Texture texture,
Matrix4x4 projectionMatrix,
Matrix4x4 worldToCameraMatrix,
Matrix4x4 sessionOriginToWorldMatrix
)

Constructor.

Parameters:

  • texture Input texture
  • projectionMatrix Projection matrix
  • worldToCameraMatrix World to camera matrix
  • sessionOriginToWorldMatrix Session origin to world matrix

function CameraSpaceToWorldSpace

Vector3 CameraSpaceToWorldSpace(
Vector3 inCamera,
float w =1.0f
)

Converts coordinates from camera space to world space.

Parameters:

  • inCamera Coordinates in camera space
  • w (Optional) Set to 1.0f for points (default value) or 0.0f for directions

Return: Coordinates in world space

function WorldSpaceToTextureSpace

Vector2 WorldSpaceToTextureSpace(
Vector3 inWorld
)

Converts coordinates from world space to texture space.

Parameters:

  • inWorld Coordinates in world space

Return: Coordinates in texture space

function TextureSpaceToCameraSpace

Vector3 TextureSpaceToCameraSpace(
Vector2 inTexture,
float z
)

Converts coordinates from texture space to camera space.

Parameters:

  • inTexture Coordinates of point in texture space
  • z Distance from point to camera

Return: Coordinates of point in camera space

function TextureSpaceToNaiveCameraSpace

Vector3 TextureSpaceToNaiveCameraSpace(
Vector2 inTexture,
float z
)

Converts coordinates from texture space to naive camera space (Z pointing forward).

Parameters:

  • inTexture Coordinates of point in texture space
  • z Distance from point to camera

Return: Coordinates of point in naive camera space

function CameraSpaceToNaiveCameraSpace

Vector3 CameraSpaceToNaiveCameraSpace(
Vector3 v
)

Converts coordinates from Unity camera space (Z pointing backwards) to native camera space (Z pointing forward).

Parameters:

  • v Coordinates of point in camera space

Return: Coordinates of point in naive camera space

function CameraSpaceToScreenSpace

Vector2 CameraSpaceToScreenSpace(
Vector3 inCamera
)

Converts coordinates from camera space to screen space.

Parameters:

  • inCamera Coordinates of point in camera space

Return: Coordinates of point in screen space

function CameraSpaceToTextureSpace

Vector2 CameraSpaceToTextureSpace(
Vector3 inCamera
)

Converts coordinates from camera space to texture space.

Parameters:

  • inCamera Coordinates in camera space

Return: Coordinates in texture space

function TextureSpaceToScreenSpace

Vector2 TextureSpaceToScreenSpace(
Vector2 inTexture
)

Converts coordinates from texture space to screen space.

Parameters:

  • inTexture Coordinates in texture space

Return: Coordinates in screen space

function WorldSpaceToSessionOriginSpace

Vector3 WorldSpaceToSessionOriginSpace(
Vector3 inWorld,
float w =1.0f
)

Converts coordinates from world space to session origin space.

Parameters:

  • inWorld Coordinates in world space
  • w (Optional) Set to 1.0f for points (default value) or 0.0f for directions

Return: Coordinates in session origin space

function SessionOriginSpaceToWorldSpace

Vector3 SessionOriginSpaceToWorldSpace(
Vector3 inSessionOrigin,
float w =1.0f
)

Converts coordinates from session origin space to world space.

Parameters:

  • inSessionOrigin Coordinates in session origin space
  • w (Optional) Set to 1.0f for points (default value) or 0.0f for directions

Return: Coordinates in world space

function CameraSpaceToSessionOriginSpace

Vector3 CameraSpaceToSessionOriginSpace(
Vector3 inCamera,
float w =1.0f
)

Converts coordinates from camera space to session origin space.

Parameters:

  • inCamera Coordinates in camera space
  • w (Optional) Set to 1.0f for points (default value) or 0.0f for directions

Return: Coordinates in session origin space

function CameraSpaceToWorldSpace

Pose CameraSpaceToWorldSpace(
Pose inCamera
)

Converts a pose from camera space to world space.

Parameters:

  • inCamera Pose in camera space

Return: Pose in world space

function CameraPoseInWorldSpace

Pose CameraPoseInWorldSpace()

Returns the camera pose in world space.

Return: Pose in world space

function CameraRotationInWorldSpace

Quaternion CameraRotationInWorldSpace()

Returns the camera rotation in world space.

Return: Rotation in world space

function WorldSpaceToSessionOriginSpace

Pose WorldSpaceToSessionOriginSpace(
Pose inWorld
)

Converts a pose from world space to session origin space.

Parameters:

  • inWorld Pose in world space

Return: Pose in session origin space

function SessionOriginSpaceToWorldSpace

Pose SessionOriginSpaceToWorldSpace(
Pose inSessionOrigin
)

Converts a pose from session origin space to world space.

Parameters:

  • inSessionOrigin Pose in session origin space

Return: Pose in world space

function CameraSpaceToSessionOriginSpace

Pose CameraSpaceToSessionOriginSpace(
Pose inCamera
)

Converts a pose from camera space to session origin space.

Parameters:

  • inCamera Pose in camera space

Return: Pose in session origin space

function TexturePointToWorldRay

Ray TexturePointToWorldRay(
Vector2 texturePoint
)

Constructs a Ray starting from the given texture coordinate, going "into" the screen. Essentially the same as Camera.ScreenPointToRay but using the matrices of this coordinate environment instead of a Unity camera component.

Parameters:

  • texturePoint A 2D point in texture space

Return: A Ray in world space

Public Property Documentation

property textureToProjectedCoordinatesMatrix

Matrix4x4 textureToProjectedCoordinatesMatrix;

Texture to projected coordinates matrix. See Manna.ProcessVideoFrameTexture documentation for more details.

property projectionMatrix

Matrix4x4 projectionMatrix;

Projection matrix, aka arCamera.projectionMatrix.

property worldToCameraMatrix

Matrix4x4 worldToCameraMatrix;

World-to-camera matrix, aka arCamera.worldToCameraMatrix.