rotate method

void rotate(
  1. Vector3 axis,
  2. double angle
)

Rotate this angle radians around axis

Implementation

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