Method code for $math.rotation_mat_3d()

[Turn on line numbering]
arg axis, angle;
var s, c, m, tens;

s = sin(angle);
c = cos(angle);
if (type(axis) == 'list) {
    axis = .scale(1.0 / .distance(axis, origin_3d), axis);
    tens = .tensor(axis, axis);
    m = .matrix_add(tens, .matrix_add(.matrix_scale(s, .skew(axis)), .matrix_scale(c, .matrix_sub(.ident_mat(3), tens))));
    return [[@m[1], 0.0], [@m[2], 0.0], [@m[3], 0.0], [0.0, 0.0, 0.0, 1.0]];
} else {
    switch (axis) {
        case 'z:
            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]];
        case 'y:
            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]];
        case 'x:
            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]];
    }
}

["// 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