Quaternion class
Defines a Quaternion (a four-dimensional vector) for efficient rotation calculations.
Quaternion are better for interpolating between rotations and avoid the gimbal lock problem compared to euler rotations.
Constructors
- Quaternion(double x, double y, double z, double w)
- 
          Constructs a quaternion using the raw values x,y,z, andw.factory
- Quaternion.axisAngle(Vector3 axis, double angle)
- 
          Constructs a quaternion from a rotation of anglearoundaxis.factory
- Quaternion.copy(Quaternion original)
- 
          Constructs a quaternion as a copy of original.factory
- Quaternion.dq(Quaternion q, Vector3 omega)
- 
          Constructs a quaternion from time derivative of qwith angular velocityomega.factory
- Quaternion.euler(double yaw, double pitch, double roll)
- 
          Constructs a quaternion from yaw,pitchandroll.factory
- Quaternion.fromBuffer(ByteBuffer buffer, int offset)
- 
          Constructs a quaternion with a storage that views given bufferstarting atoffset.offsethas to be multiple of Float64List.bytesPerElement.
- Quaternion.fromFloat64List(Float64List _qStorage)
- Constructs a quaternion with given Float64List as storage.
- Quaternion.fromRotation(Matrix3 rotationMatrix)
- 
          Constructs a quaternion from a rotation matrix rotationMatrix.factory
- Quaternion.fromTwoVectors(Vector3 a, Vector3 b)
- 
          Constructs a quaternion to be the rotation that rotates vector atob.factory
- Quaternion.identity()
- 
          Constructs a quaternion set to the identity quaternion.
            factory
- Quaternion.random(Random rn)
- 
          Constructs a quaternion with a random rotation. The random number
generator rnis used to generate the random numbers for the rotation.factory
Properties
- axis → Vector3
- 
  axis of rotation.
  no setter
- hashCode → int
- 
  The hash code for this object.
  no setteroverride
- length → double
- 
  Length.
  no setter
- length2 → double
- 
  Length squared.
  no setter
- radians → double
- 
  radians of rotation around the axis of the rotation.
  no setter
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
- storage → Float64List
- 
  Access the internal storage of the quaternions components.
  no setter
- w ↔ double
- 
  Access the w component of the quaternion.
  getter/setter pair
- x ↔ double
- 
  Access the x component of the quaternion.
  getter/setter pair
- y ↔ double
- 
  Access the y component of the quaternion.
  getter/setter pair
- z ↔ double
- 
  Access the z component of the quaternion.
  getter/setter pair
Methods
- 
  absoluteError(Quaternion correct) → double 
- 
  Absolute error between this and correct.
- 
  add(Quaternion arg) → void 
- 
  Add argto this.
- 
  asRotationMatrix() → Matrix3 
- Returns a rotation matrix containing the same rotation as this.
- 
  clone() → Quaternion 
- Returns a new copy of this.
- 
  conjugate() → void 
- Conjugate this.
- 
  conjugated() → Quaternion 
- Conjugated copy of this.
- 
  copyRotationInto(Matrix3 rotationMatrix) → Matrix3 
- 
  Set rotationMatrixto a rotation matrix containing the same rotation as this.
- 
  inverse() → void 
- Invert this.
- 
  inverted() → Quaternion 
- Inverted copy of this.
- 
  negate() → void 
- Negate this.
- 
  negated() → Quaternion 
- Negated copy of this.
- 
  normalize() → double 
- Normalize this.
- 
  normalized() → Quaternion 
- Normalized copy of this.
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  relativeError(Quaternion correct) → double 
- 
  Relative error between this and correct.
- 
  rotate(Vector3 v) → Vector3 
- 
  Rotates vby this.
- 
  rotated(Vector3 v) → Vector3 
- 
  Returns a copy of vrotated by quaternion.
- 
  scale(double scale) → void 
- 
  Scales this by scale.
- 
  scaled(double scale) → Quaternion 
- Scaled copy of this.
- 
  setAxisAngle(Vector3 axis, double radians) → void 
- 
  Set the quaternion with rotation of radiansaroundaxis.
- 
  setDQ(Quaternion q, Vector3 omega) → void 
- 
  Set the quaternion to the time derivative of qwith angular velocityomega.
- 
  setEuler(double yaw, double pitch, double roll) → void 
- 
  Set quaternion with rotation of yaw,pitchandroll.
- 
  setFrom(Quaternion source) → void 
- 
  Copy sourceinto this.
- 
  setFromRotation(Matrix3 rotationMatrix) → void 
- 
  Set the quaternion with rotation from a rotation matrix rotationMatrix.
- 
  setFromTwoVectors(Vector3 a, Vector3 b) → void 
- 
  setRandom(Random rn) → void 
- 
  Set the quaternion to a random rotation. The random number generator rnis used to generate the random numbers for the rotation.
- 
  setValues(double x, double y, double z, double w) → void 
- 
  Set the quaternion to the raw values x,y,z, andw.
- 
  sub(Quaternion arg) → void 
- 
  Subtracts argfrom this.
- 
  toString() → String 
- 
  Printable string.
  override
Operators
- 
  operator *(Quaternion other) → Quaternion 
- 
  this rotated by other.
- 
  operator +(Quaternion other) → Quaternion 
- 
  Returns copy of this + other.
- 
  operator -(Quaternion other) → Quaternion 
- 
  Returns copy of this - other.
- 
  operator ==(Object other) → bool 
- 
  Check if two quaternions are the same.
  override
- 
  operator [](int i) → double 
- 
  Access the component of the quaternion at the index i.
- 
  operator []=(int i, double arg) → void 
- 
  Set the component of the quaternion at the index i.
- 
  operator unary-() → Quaternion 
- Returns negated copy of this.