Skip to content

CartesianCoordinateSystem

class CartesianCoordinateSystem

A class representing a cartesian coordinate system.

It's used to know which direction is positive along each axis, and also allows Amplitude to convert incoming data to the internal coordinate system.

Types

Name Description
Axis Enumerates the axes of the cartesian coordinate system.
Converter Converts values from one cartesian coordinate system to another.

Functions

Name Description
Default Creates a cartesian coordinate system which match the one used in Amplitude.
AmbiX Creates a cartesian coordinate system suitable for the AmbiX ambisonics format.
RightHandedYUp Creates a right-handed, Y-up cartesian coordinate system.
LeftHandedYUp Creates a left-handed, Y-up cartesian coordinate system.
RightHandedZUp Creates a right-handed, Z-up cartesian coordinate system.
LeftHandedZUp Creates a left-handed, Z-up cartesian coordinate system.
Convert Converts a vector from one coordinate system to another.
Convert Converts a quaternion rotation from one coordinate system to another.
Convert Converts a scalar from one coordinate system to another.
ConvertToDefault Converts a vector from one coordinate system to the default coordinate system.
GetVector Gets a vector corresponding to the given axis.
CartesianCoordinateSystem Creates a new cartesian coordinate system with the given axes.
GetRightVector Gets the vector corresponding to the coordinate system's right axis.
GetForwardVector Gets the vector corresponding to the coordinate system's forward axis.
GetUpVector Gets the vector corresponding to the coordinate system's up axis.
Convert Converts a vector from one coordinate system to the current one.
Convert Converts a quaternion from one coordinate system to the current one.
Convert Converts a scalar from one coordinate system to the current one.

Function Details

AmbiX

static CartesianCoordinateSystem AmbiX()

Creates a cartesian coordinate system suitable for the AmbiX ambisonics format.

Return
AmbiX format's cartesian coordinate system.

CartesianCoordinateSystem

CartesianCoordinateSystem(Axis right, Axis forward, Axis up)

Creates a new cartesian coordinate system with the given axes.

Parameter right
The right axis of the new coordinate system.
Parameter forward
The forward axis of the new coordinate system.
Parameter up
The up axis of the new coordinate system.

Convert

static AmVec3 Convert(const AmVec3& vector, const CartesianCoordinateSystem& from, const CartesianCoordinateSystem& to)

Converts a vector from one coordinate system to another.

Parameter vector
The vector to convert.
Parameter from
The source coordinate system.
Parameter to
The destination coordinate system.
Return
The converted vector.

static AmQuat Convert(const AmQuat& rotation, const CartesianCoordinateSystem& from, const CartesianCoordinateSystem& to)

Converts a quaternion rotation from one coordinate system to another.

Parameter rotation
The rotation to convert.
Parameter from
The source coordinate system.
Parameter to
The destination coordinate system.
Return
The converted rotation.

static AmReal32 Convert(AmReal32 scalar, const CartesianCoordinateSystem& from, const CartesianCoordinateSystem& to)

Converts a scalar from one coordinate system to another.

Parameter scalar
The scalar to convert.
Parameter from
The source coordinate system.
Parameter to
The destination coordinate system.
Return
The converted scalar.

[[nodiscard]] AmVec3 Convert(const AmVec3& vector, const CartesianCoordinateSystem& from) const

Converts a vector from one coordinate system to the current one.

Parameter vector
The vector to convert.
Parameter from
The original coordinate system of the vector.
Return
The converted vector in the current coordinate system.

[[nodiscard]] AmQuat Convert(const AmQuat& quaternion, const CartesianCoordinateSystem& from) const

Converts a quaternion from one coordinate system to the current one.

Parameter quaternion
The quaternion to convert.
Parameter from
The original coordinate system of the quaternion.
Return
The converted quaternion in the current coordinate system.

[[nodiscard]] AmReal32 Convert(const AmReal32& scalar, const CartesianCoordinateSystem& from) const

Converts a scalar from one coordinate system to the current one.

Parameter scalar
The scalar to convert.
Parameter from
The original coordinate system of the scalar.
Return
The converted scalar in the current coordinate system.

ConvertToDefault

static AmVec3 ConvertToDefault(const AmVec3& vector, const CartesianCoordinateSystem& from)

Converts a vector from one coordinate system to the default coordinate system.

Parameter vector
The vector to convert.
Parameter from
The source coordinate system.
Return
The converted vector.

Default

static CartesianCoordinateSystem Default()

Creates a cartesian coordinate system which match the one used in Amplitude.

Return
Amplitude's internal coordinate system for right-handed, Z-up cartesian coordinate system.

GetForwardVector

[[nodiscard]] inline AmVec3 GetForwardVector() const

Gets the vector corresponding to the coordinate system's forward axis.

Return
The coordinate system's forward vector.

GetRightVector

[[nodiscard]] inline AmVec3 GetRightVector() const

Gets the vector corresponding to the coordinate system's right axis.

Return
The coordinate system's right vector.

GetUpVector

[[nodiscard]] inline AmVec3 GetUpVector() const

Gets the vector corresponding to the coordinate system's up axis.

Return
The coordinate system's up vector.

GetVector

[[nodiscard]] static AmVec3 GetVector(Axis axis)

Gets a vector corresponding to the given axis.

Parameter axis
The axis to get the vector for.
Return
A vector corresponding to the given axis.

LeftHandedYUp

static CartesianCoordinateSystem LeftHandedYUp()

Creates a left-handed, Y-up cartesian coordinate system.

Return
A left-handed, Y-up cartesian coordinate system.

LeftHandedZUp

static CartesianCoordinateSystem LeftHandedZUp()

Creates a left-handed, Z-up cartesian coordinate system.

Return
A left-handed, Z-up cartesian coordinate system.

RightHandedYUp

static CartesianCoordinateSystem RightHandedYUp()

Creates a right-handed, Y-up cartesian coordinate system.

Return
A right-handed, Y-up cartesian coordinate system.

RightHandedZUp

static CartesianCoordinateSystem RightHandedZUp()

Creates a right-handed, Z-up cartesian coordinate system.

Return
A right-handed, Z-up cartesian coordinate system.