Photon Quantum 2.1.1

Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Photon.Deterministic.FPQuaternion Struct Reference

A Quaternion representing an orientation. More...

Public Member Functions

 FPQuaternion (FP x, FP y, FP z, FP w)
 Creates a new instance of FPQuaternion More...
 

Static Public Member Functions

static FP Angle (FPQuaternion a, FPQuaternion b)
 Returns the angle in degrees between two rotations a and b . More...
 
static FPQuaternion AngleAxis (FP angle, FPVector3 axis)
 Creates a rotation which rotates angle degrees around axis . More...
 
static FPQuaternion Conjugate (FPQuaternion value)
 Returns conjugate quaternion. This method computes the equivalent to the following pseduo-code: More...
 
static FPQuaternion CreateFromYawPitchRoll (FP yaw, FP pitch, FP roll)
 Returns a rotation that rotates roll radians around the z axis, pitch radians around the x axis, and yaw radians around the y axis. More...
 
static FP Dot (FPQuaternion a, FPQuaternion b)
 Returns the dot product between two rotations. This method computes the equivalent to the following pseduo-code: More...
 
static FPQuaternion Euler (FP x, FP y, FP z)
 Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis. More...
 
static FPQuaternion Euler (FPVector3 eulerAngles)
 Returns a rotation that rotates eulerAngles .z degrees around the z axis, eulerAngles .x degrees around the x axis, and eulerAngles .y degrees around the y axis. More...
 
static FPQuaternion FromToRotation (FPVector3 fromVector, FPVector3 toVector)
 Creates a quaternion which rotates from fromVector to toVector (normalized internally). If these vectors are known to be normalized or have magnitude close to 1, FromToRotationSkipNormalize can be used for better performance. More...
 
static FPQuaternion FromToRotationSkipNormalize (FPVector3 fromVector, FPVector3 toVector)
 Creates a quaternion which rotates from fromVector to toVector (not normalized internally). If these vectors are known to be normalized or have magnitude close to 1, use FromToRotation instead. More...
 
static FPQuaternion Inverse (FPQuaternion value)
 Returns the Inverse of rotation value . If value is normalized it will be faster to call Conjugate(FPQuaternion). If value has a magnitude close to 0, value will be returned. More...
 
static bool IsIdentity (FPQuaternion value)
 Checks if the quaternion is the identity quaternion More...
 
static bool IsZero (FPQuaternion value)
 Checks if the quaternion is the invalid zero quaternion More...
 
static FPQuaternion Lerp (FPQuaternion a, FPQuaternion b, FP t)
 Interpolates between a and b by t and normalizes the result afterwards. The parameter t is clamped to the range [0, 1]. More...
 
static FPQuaternion LerpUnclamped (FPQuaternion a, FPQuaternion b, FP t)
 Interpolates between a and b by t and normalizes the result afterwards. More...
 
static FPQuaternion LookRotation (FPVector3 forward, bool orthoNormalize=false)
 Creates a rotation with the specified forward direction and FPVector3.Up. More...
 
static FPQuaternion LookRotation (FPVector3 forward, FPVector3 up, bool orthoNormalize=false)
 Creates a rotation with the specified forward and up directions. More...
 
static FPQuaternion Normalize (FPQuaternion value)
 Converts this quaternion value to one with the same orientation but with a magnitude of 1. If value has a magnitude close to 0, Identity is returned. More...
 
static FPQuaternion operator* (FP left, FPQuaternion right)
 Scales quaternion right with left . More...
 
static FPQuaternion operator* (FPQuaternion left, FP right)
 Scales quaternion left with right . More...
 
static FPQuaternion operator* (FPQuaternion left, FPQuaternion right)
 Computes product of two quaternions. Fully equivalent to Unity's Quaternion multiplication. See Product(FPQuaternion, FPQuaternion) for details. More...
 
static FPVector3 operator* (FPQuaternion quat, FPVector3 point)
 Rotates the point point with rotation quat . More...
 
static FPQuaternion operator+ (FPQuaternion left, FPQuaternion right)
 Adds each component of right to left . More...
 
static FPQuaternion operator- (FPQuaternion left, FPQuaternion right)
 Subtracts each component of right from left . More...
 
static FPQuaternion Product (FPQuaternion left, FPQuaternion right)
 Creates product of two quaternions. Can be used to combine two rotations. Just like in the case of FPMatrix4x4 the righmost operand gets applied first. This method computes the equivalent to the following pseduo-code: More...
 
static FPQuaternion RadianAxis (FP radians, FPVector3 axis)
 Creates a rotation which rotates radians radians around axis . More...
 
static FPQuaternion RotateTowards (FPQuaternion from, FPQuaternion to, FP maxDegreesDelta)
 Rotates a rotation from towards to by an angular step of maxDegreesDelta . More...
 
static FPQuaternion Slerp (FPQuaternion from, FPQuaternion to, FP t)
 Spherically interpolates between from and to by t and normalizes the result afterwards. t is clamped to the range [0, 1]. More...
 
static FPQuaternion SlerpUnclamped (FPQuaternion from, FPQuaternion to, FP t)
 Spherically interpolates between from and to by t and normalizes the result afterwards. More...
 

Public Attributes

FPVector3 AsEuler => ToEulerZXY(this)
 Returns one of possible Euler angles representation, where rotations are performed around the Z axis, the X axis, and the Y axis, in that order. More...
 
FPQuaternion Conjugated => Conjugate(this)
 Creates this quaternion's conjugate. For normalized quaternions this property represents inverse rotation and should be used instead of Inverted More...
 
FPQuaternion Inverted => Inverse(this)
 Creates this quaternion's inverse. If this quaternion is normalized, use Conjugated instead. More...
 
FP Magnitude => FP.FromRaw(FPMath.SqrtRaw(MagnitudeSqrRaw))
 Return this quaternion's magnitude. More...
 
FP MagnitudeSqr => FP.FromRaw(MagnitudeSqrRaw)
 Returns square of this quaternion's magnitude. More...
 
FPQuaternion Normalized => Normalize(this)
 Returns this quaternion with magnitude of 1. Most API functions expect and return normalized quaternions, so unless components get set manually, there should not be a need to normalize quaternions More...
 
FP W
 The W component of the quaternion. More...
 
FP X
 The X component of the quaternion. More...
 
FP Y
 The Y component of the quaternion. More...
 
FP Z
 The Z component of the quaternion. More...
 

Properties

static FPQuaternion Identity [get]
 Quaternion corresponding to "no rotation". More...
 

Detailed Description

A Quaternion representing an orientation.

Constructor & Destructor Documentation

◆ FPQuaternion()

Photon.Deterministic.FPQuaternion.FPQuaternion ( FP  x,
FP  y,
FP  z,
FP  w 
)
inline

Creates a new instance of FPQuaternion

Parameters
xX component.
yY component.
zZ component.
wW component.

Member Function Documentation

◆ Product()

static FPQuaternion Photon.Deterministic.FPQuaternion.Product ( FPQuaternion  left,
FPQuaternion  right 
)
inlinestatic

Creates product of two quaternions. Can be used to combine two rotations. Just like in the case of FPMatrix4x4 the righmost operand gets applied first. This method computes the equivalent to the following pseduo-code:

FPQuaternion result; result.x = (left.w * right.x) + (left.x * right.w) + (left.y * right.z) - (left.z * right.y); result.y = (left.w * right.y) - (left.x * right.z) + (left.y * right.w) + (left.z * right.x); result.z = (left.w * right.z) + (left.x * right.y) - (left.y * right.x) + (left.z * right.w); result.w = (left.w * right.w) - (left.x * right.x) - (left.y * right.y) - (left.z * right.z); return result;

Parameters
left
right
Returns

◆ Conjugate()

static FPQuaternion Photon.Deterministic.FPQuaternion.Conjugate ( FPQuaternion  value)
inlinestatic

Returns conjugate quaternion. This method computes the equivalent to the following pseduo-code:

return new FPQuaternion(-value.X, -value.Y, -value.Z, value.W); Conjugate can be used instead of an inverse quaterion if value is normalized.

Parameters
value
Returns

◆ IsIdentity()

static bool Photon.Deterministic.FPQuaternion.IsIdentity ( FPQuaternion  value)
inlinestatic

Checks if the quaternion is the identity quaternion

Parameters
value
Returns

◆ IsZero()

static bool Photon.Deterministic.FPQuaternion.IsZero ( FPQuaternion  value)
inlinestatic

Checks if the quaternion is the invalid zero quaternion

Parameters
value
Returns

◆ Dot()

static FP Photon.Deterministic.FPQuaternion.Dot ( FPQuaternion  a,
FPQuaternion  b 
)
inlinestatic

Returns the dot product between two rotations. This method computes the equivalent to the following pseduo-code:

return a.X * b.X + a.Y * b.Y + a.Z * b.Z + a.W * b.W;

Parameters
a
b
Returns

◆ FromToRotation()

static FPQuaternion Photon.Deterministic.FPQuaternion.FromToRotation ( FPVector3  fromVector,
FPVector3  toVector 
)
inlinestatic

Creates a quaternion which rotates from fromVector to toVector (normalized internally). If these vectors are known to be normalized or have magnitude close to 1, FromToRotationSkipNormalize can be used for better performance.

Parameters
fromVector
toVector
Returns

◆ FromToRotationSkipNormalize()

static FPQuaternion Photon.Deterministic.FPQuaternion.FromToRotationSkipNormalize ( FPVector3  fromVector,
FPVector3  toVector 
)
inlinestatic

Creates a quaternion which rotates from fromVector to toVector (not normalized internally). If these vectors are known to be normalized or have magnitude close to 1, use FromToRotation instead.

Parameters
fromVector
toVector
Returns

◆ Lerp()

static FPQuaternion Photon.Deterministic.FPQuaternion.Lerp ( FPQuaternion  a,
FPQuaternion  b,
FP  t 
)
inlinestatic

Interpolates between a and b by t and normalizes the result afterwards. The parameter t is clamped to the range [0, 1].

Parameters
a
b
t
Returns

◆ LerpUnclamped()

static FPQuaternion Photon.Deterministic.FPQuaternion.LerpUnclamped ( FPQuaternion  a,
FPQuaternion  b,
FP  t 
)
inlinestatic

Interpolates between a and b by t and normalizes the result afterwards.

Parameters
a
b
t
Returns

◆ CreateFromYawPitchRoll()

static FPQuaternion Photon.Deterministic.FPQuaternion.CreateFromYawPitchRoll ( FP  yaw,
FP  pitch,
FP  roll 
)
inlinestatic

Returns a rotation that rotates roll radians around the z axis, pitch radians around the x axis, and yaw radians around the y axis.

Parameters
yawYaw in radians
pitchPitch in radians
rollRoll in radians
Returns

◆ Angle()

static FP Photon.Deterministic.FPQuaternion.Angle ( FPQuaternion  a,
FPQuaternion  b 
)
inlinestatic

Returns the angle in degrees between two rotations a and b .

Parameters
a
b
Returns

◆ LookRotation() [1/2]

static FPQuaternion Photon.Deterministic.FPQuaternion.LookRotation ( FPVector3  forward,
bool  orthoNormalize = false 
)
static

Creates a rotation with the specified forward direction and FPVector3.Up.

Parameters
forward
orthoNormalize
Returns

◆ LookRotation() [2/2]

static FPQuaternion Photon.Deterministic.FPQuaternion.LookRotation ( FPVector3  forward,
FPVector3  up,
bool  orthoNormalize = false 
)
inlinestatic

Creates a rotation with the specified forward and up directions.

Parameters
forward
up
orthoNormalize
Returns

◆ Slerp()

static FPQuaternion Photon.Deterministic.FPQuaternion.Slerp ( FPQuaternion  from,
FPQuaternion  to,
FP  t 
)
inlinestatic

Spherically interpolates between from and to by t and normalizes the result afterwards. t is clamped to the range [0, 1].

FPLut needs to be initialised.

Parameters
from
to
t
Returns

◆ SlerpUnclamped()

static FPQuaternion Photon.Deterministic.FPQuaternion.SlerpUnclamped ( FPQuaternion  from,
FPQuaternion  to,
FP  t 
)
inlinestatic

Spherically interpolates between from and to by t and normalizes the result afterwards.

FPLut needs to be initialised.

Parameters
from
to
t
Returns

◆ RotateTowards()

static FPQuaternion Photon.Deterministic.FPQuaternion.RotateTowards ( FPQuaternion  from,
FPQuaternion  to,
FP  maxDegreesDelta 
)
inlinestatic

Rotates a rotation from towards to by an angular step of maxDegreesDelta .

Parameters
from
to
maxDegreesDelta
Returns

◆ Euler() [1/2]

static FPQuaternion Photon.Deterministic.FPQuaternion.Euler ( FP  x,
FP  y,
FP  z 
)
inlinestatic

Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.

Parameters
x
y
z
Returns

◆ Euler() [2/2]

static FPQuaternion Photon.Deterministic.FPQuaternion.Euler ( FPVector3  eulerAngles)
inlinestatic

Returns a rotation that rotates eulerAngles .z degrees around the z axis, eulerAngles .x degrees around the x axis, and eulerAngles .y degrees around the y axis.

Parameters
eulerAngles
Returns

◆ AngleAxis()

static FPQuaternion Photon.Deterministic.FPQuaternion.AngleAxis ( FP  angle,
FPVector3  axis 
)
inlinestatic

Creates a rotation which rotates angle degrees around axis .

FPLut needs to be initialised.

Parameters
angle
axis
Returns

◆ RadianAxis()

static FPQuaternion Photon.Deterministic.FPQuaternion.RadianAxis ( FP  radians,
FPVector3  axis 
)
inlinestatic

Creates a rotation which rotates radians radians around axis .

FPLut needs to be initialised.

Parameters
radians
axis
Returns

◆ Inverse()

static FPQuaternion Photon.Deterministic.FPQuaternion.Inverse ( FPQuaternion  value)
inlinestatic

Returns the Inverse of rotation value . If value is normalized it will be faster to call Conjugate(FPQuaternion). If value has a magnitude close to 0, value will be returned.

FPLut needs to be initialised.

Parameters
value
Returns

◆ Normalize()

static FPQuaternion Photon.Deterministic.FPQuaternion.Normalize ( FPQuaternion  value)
inlinestatic

Converts this quaternion value to one with the same orientation but with a magnitude of 1. If value has a magnitude close to 0, Identity is returned.

Parameters
value
Returns

◆ operator*() [1/4]

static FPQuaternion Photon.Deterministic.FPQuaternion.operator* ( FPQuaternion  left,
FPQuaternion  right 
)
static

Computes product of two quaternions. Fully equivalent to Unity's Quaternion multiplication. See Product(FPQuaternion, FPQuaternion) for details.

Parameters
left
right
Returns

◆ operator*() [2/4]

static FPQuaternion Photon.Deterministic.FPQuaternion.operator* ( FPQuaternion  left,
FP  right 
)
inlinestatic

Scales quaternion left with right .

Parameters
left
right
Returns

◆ operator*() [3/4]

static FPQuaternion Photon.Deterministic.FPQuaternion.operator* ( FP  left,
FPQuaternion  right 
)
static

Scales quaternion right with left .

Parameters
right
left
Returns

◆ operator+()

static FPQuaternion Photon.Deterministic.FPQuaternion.operator+ ( FPQuaternion  left,
FPQuaternion  right 
)
inlinestatic

Adds each component of right to left .

Parameters
left
right
Returns

◆ operator-()

static FPQuaternion Photon.Deterministic.FPQuaternion.operator- ( FPQuaternion  left,
FPQuaternion  right 
)
inlinestatic

Subtracts each component of right from left .

Parameters
left
right
Returns

◆ operator*() [4/4]

static FPVector3 Photon.Deterministic.FPQuaternion.operator* ( FPQuaternion  quat,
FPVector3  point 
)
inlinestatic

Rotates the point point with rotation quat .

Parameters
quat
point
Returns

Member Data Documentation

◆ X

FP Photon.Deterministic.FPQuaternion.X

The X component of the quaternion.

◆ Y

FP Photon.Deterministic.FPQuaternion.Y

The Y component of the quaternion.

◆ Z

FP Photon.Deterministic.FPQuaternion.Z

The Z component of the quaternion.

◆ W

FP Photon.Deterministic.FPQuaternion.W

The W component of the quaternion.

◆ Normalized

FPQuaternion Photon.Deterministic.FPQuaternion.Normalized => Normalize(this)

Returns this quaternion with magnitude of 1. Most API functions expect and return normalized quaternions, so unless components get set manually, there should not be a need to normalize quaternions

See also
Normalize(FPQuaternion)

◆ Inverted

FPQuaternion Photon.Deterministic.FPQuaternion.Inverted => Inverse(this)

Creates this quaternion's inverse. If this quaternion is normalized, use Conjugated instead.

See also
Inverse(FPQuaternion)

◆ Conjugated

FPQuaternion Photon.Deterministic.FPQuaternion.Conjugated => Conjugate(this)

Creates this quaternion's conjugate. For normalized quaternions this property represents inverse rotation and should be used instead of Inverted

See also
Conjugate(FPQuaternion)

◆ MagnitudeSqr

FP Photon.Deterministic.FPQuaternion.MagnitudeSqr => FP.FromRaw(MagnitudeSqrRaw)

Returns square of this quaternion's magnitude.

◆ Magnitude

FP Photon.Deterministic.FPQuaternion.Magnitude => FP.FromRaw(FPMath.SqrtRaw(MagnitudeSqrRaw))

Return this quaternion's magnitude.

◆ AsEuler

FPVector3 Photon.Deterministic.FPQuaternion.AsEuler => ToEulerZXY(this)

Returns one of possible Euler angles representation, where rotations are performed around the Z axis, the X axis, and the Y axis, in that order.

Property Documentation

◆ Identity

FPQuaternion Photon.Deterministic.FPQuaternion.Identity
staticget

Quaternion corresponding to "no rotation".