Method code for $math.rotation_mat_3d()

[Turn off line numbering]
  1: arg axis, angle;
  2: var s, c, m, tens;
  3: 
  4: s = sin(angle);
  5: c = cos(angle);
  6: if (type(axis) == 'list) {
  7:     axis = .scale(1.0 / .distance(axis, origin_3d), axis);
  8:     tens = .tensor(axis, axis);
  9:     m = .matrix_add(tens, .matrix_add(.matrix_scale(s, .skew(axis)), .matrix_scale(c, .matrix_sub(.ident_mat(3), tens))));
 10:     return [[@m[1], 0.0], [@m[2], 0.0], [@m[3], 0.0], [0.0, 0.0, 0.0, 1.0]];
 11: } else {
 12:     switch (axis) {
 13:         case 'z:
 14:             return [[c, s, 0.0, 0.0], [-s, c, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]];
 15:         case 'y:
 16:             return [[c, 0.0, -s, 0.0], [0.0, 1.0, 0.0, 0.0], [s, 0.0, c, 0.0], [0.0, 0.0, 0.0, 1.0]];
 17:         case 'x:
 18:             return [[1.0, 0.0, 0.0, 0.0], [0.0, c, s, 0.0], [0.0, -s, c, 0.0], [0.0, 0.0, 0.0, 1.0]];
 19:     }
 20: }

["// Various Contributors, including: Miroslav Silovic, Bruce Mitchner, Nolan, Sean R. Lynch, Technobunny", "// Created 19-Oct-1996 as a part of ColdCore, see: @help Credit"]

the Cold Dark