44 return _xBasisScaled * point.
x + _yBasisScaled * point.
y + _zBasisScaled * point.
z +
translation;
52 return _xBasis * direction.
x + _yBasis * direction.
y + _zBasis * direction.
z;
60 return _xBasisScaled * velocity.
x + _yBasisScaled * velocity.
y + _zBasisScaled * velocity.
z;
76 throw new InvalidOperationException(
"Calling TransformQuaternion after Basis vectors have been modified.");
95 _xBasisScaled = -_xBasisScaled;
98 _flipAxes.
y = -_flipAxes.
y;
99 _flipAxes.
z = -_flipAxes.
z;
108 _zBasisScaled = -_zBasisScaled;
111 _flipAxes.
x = -_flipAxes.
x;
112 _flipAxes.
y = -_flipAxes.
y;
125 get {
return _xBasis; }
128 _xBasisScaled = value *
scale.
x;
129 _quaternionDirty =
true;
143 get {
return _yBasis; }
146 _yBasisScaled = value *
scale.
y;
147 _quaternionDirty =
true;
161 get {
return _zBasis; }
164 _zBasisScaled = value *
scale.
z;
165 _quaternionDirty =
true;
174 get {
return _translation; }
176 _translation = value;
186 get {
return _scale; }
189 _xBasisScaled = _xBasis *
scale.
x;
190 _yBasisScaled = _yBasis *
scale.
y;
191 _zBasisScaled = _zBasis *
scale.
z;
206 if (_quaternionDirty)
207 throw new InvalidOperationException(
"Requesting rotation after Basis vectors have been modified.");
215 float xs = value.x * s, ys = value.y * s, zs = value.z * s;
216 float wx = value.w * xs, wy = value.w * ys, wz = value.w * zs;
217 float xx = value.x * xs, xy = value.x * ys, xz = value.x * zs;
218 float yy = value.y * ys, yz = value.y * zs, zz = value.z * zs;
220 _xBasis =
new Vector(1.0f - (yy + zz), xy + wz, xz - wy);
221 _yBasis =
new Vector(xy - wz, 1.0f - (xx + zz), yz + wx);
222 _zBasis =
new Vector(xz + wy, yz - wx, 1.0f - (xx + yy));
224 _xBasisScaled = _xBasis *
scale.
x;
225 _yBasisScaled = _yBasis *
scale.
y;
226 _zBasisScaled = _zBasis *
scale.
z;
228 _quaternionDirty =
false;
230 _flipAxes =
new Vector(1.0f, 1.0f, 1.0f);
240 private Vector _translation;
243 private bool _quaternionDirty;
249 private Vector _xBasisScaled;
250 private Vector _yBasisScaled;
251 private Vector _zBasisScaled;
The LeapQuaternion struct represents a rotation in three-dimensional space.
LeapQuaternion Multiply(LeapQuaternion rhs)
Concatenates the rotation described by this quaternion with the one provided and returns the result.
float MagnitudeSquared
The square of the magnitude, or length, of this quaternion.
static readonly LeapQuaternion Identity
The identity quaternion.
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
static readonly Vector Zero
The zero vector: (0, 0, 0)
static readonly Vector Ones
The ones vector: (1, 1, 1)