rotate method

void rotate (Vector3 axis, double angle)

Rotate this angle radians around axis

Implementation

void rotate(Vector3 axis, double angle) {
  final double len = axis.length;
  final Float64List axisStorage = axis._v3storage;
  final double x = axisStorage[0] / len;
  final double y = axisStorage[1] / len;
  final double z = axisStorage[2] / len;
  final double c = math.cos(angle);
  final double s = math.sin(angle);
  final double C = 1.0 - c;
  final double m11 = x * x * C + c;
  final double m12 = x * y * C - z * s;
  final double m13 = x * z * C + y * s;
  final double m21 = y * x * C + z * s;
  final double m22 = y * y * C + c;
  final double m23 = y * z * C - x * s;
  final double m31 = z * x * C - y * s;
  final double m32 = z * y * C + x * s;
  final double m33 = z * z * C + c;
  final double t1 =
      _m4storage[0] * m11 + _m4storage[4] * m21 + _m4storage[8] * m31;
  final double t2 =
      _m4storage[1] * m11 + _m4storage[5] * m21 + _m4storage[9] * m31;
  final double t3 =
      _m4storage[2] * m11 + _m4storage[6] * m21 + _m4storage[10] * m31;
  final double t4 =
      _m4storage[3] * m11 + _m4storage[7] * m21 + _m4storage[11] * m31;
  final double t5 =
      _m4storage[0] * m12 + _m4storage[4] * m22 + _m4storage[8] * m32;
  final double t6 =
      _m4storage[1] * m12 + _m4storage[5] * m22 + _m4storage[9] * m32;
  final double t7 =
      _m4storage[2] * m12 + _m4storage[6] * m22 + _m4storage[10] * m32;
  final double t8 =
      _m4storage[3] * m12 + _m4storage[7] * m22 + _m4storage[11] * m32;
  final double t9 =
      _m4storage[0] * m13 + _m4storage[4] * m23 + _m4storage[8] * m33;
  final double t10 =
      _m4storage[1] * m13 + _m4storage[5] * m23 + _m4storage[9] * m33;
  final double t11 =
      _m4storage[2] * m13 + _m4storage[6] * m23 + _m4storage[10] * m33;
  final double t12 =
      _m4storage[3] * m13 + _m4storage[7] * m23 + _m4storage[11] * m33;
  _m4storage[0] = t1;
  _m4storage[1] = t2;
  _m4storage[2] = t3;
  _m4storage[3] = t4;
  _m4storage[4] = t5;
  _m4storage[5] = t6;
  _m4storage[6] = t7;
  _m4storage[7] = t8;
  _m4storage[8] = t9;
  _m4storage[9] = t10;
  _m4storage[10] = t11;
  _m4storage[11] = t12;
}