Skip to content

Instantly share code, notes, and snippets.

@cpb
Last active December 11, 2015 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpb/4519651 to your computer and use it in GitHub Desktop.
Save cpb/4519651 to your computer and use it in GitHub Desktop.
Matrix Multiplication Operator Question
rotation_z180 = [
[cos(180), -sin(180), 0, 0],
[sin(180), cos(180), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]];
rotation_x90 = [
[1, 0, 0, 0],
[0, cos(90), sin(90), 0],
[0, -sin(90), cos(90), 0],
[0, 0, 0, 1]];
echo(rotation_z180);
// ECHO: [[1, 0, 0, 0], [0, 6.123233995736766e-17, 1, 0], [0, -1, 6.123233995736766e-17, 0], [0, 0, 0, 1]]
echo(rotation_x90);
// ECHO: [[1, 0, 0, 0], [0, 6.123233995736766e-17, 1, 0], [0, -1, 6.123233995736766e-17, 0], [0, 0, 0, 1]]
echo(rotation_x90 * rotation_z180);
// ECHO: undef ... but: http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Mathematical_Operators#Matrix_Multiplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment