Created
January 5, 2016 06:02
-
-
Save boredzo/fde487c724a40a26fa9c to your computer and use it in GitHub Desktop.
Skew operator for OpenSCAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*skew takes an array of six angles: | |
*x along y | |
*x along z | |
*y along x | |
*y along z | |
*z along x | |
*z along y | |
*/ | |
module skew(dims) { | |
matrix = [ | |
[ 1, dims[0]/45, dims[1]/45, 0 ], | |
[ dims[2]/45, 1, dims[4]/45, 0 ], | |
[ dims[5]/45, dims[3]/45, 1, 0 ], | |
[ 0, 0, 0, 1 ] | |
]; | |
multmatrix(matrix) | |
children(); | |
} | |
skew([45, 0, 0, 0, 0, 0]) | |
cube([10,10,10]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, works wonderfully (only tried the corrected version from the comment). I've changed the interface a bit to make it easier to use:
Example: