rotate method

Vector3 rotate (Vector3 v)

Rotates v by this.

Implementation

Vector3 rotate(Vector3 v) {
  // conjugate(this) * [v,0] * this
  final double _w = _qStorage[3];
  final double _z = _qStorage[2];
  final double _y = _qStorage[1];
  final double _x = _qStorage[0];
  final double tiw = _w;
  final double tiz = -_z;
  final double tiy = -_y;
  final double tix = -_x;
  final double tx = tiw * v.x + tix * 0.0 + tiy * v.z - tiz * v.y;
  final double ty = tiw * v.y + tiy * 0.0 + tiz * v.x - tix * v.z;
  final double tz = tiw * v.z + tiz * 0.0 + tix * v.y - tiy * v.x;
  final double tw = tiw * 0.0 - tix * v.x - tiy * v.y - tiz * v.z;
  final double result_x = tw * _x + tx * _w + ty * _z - tz * _y;
  final double result_y = tw * _y + ty * _w + tz * _x - tx * _z;
  final double result_z = tw * _z + tz * _w + tx * _y - ty * _x;
  final Float32List vStorage = v.storage;
  vStorage[2] = result_z;
  vStorage[1] = result_y;
  vStorage[0] = result_x;
  return v;
}