mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 06:08:31 +01:00
1.2 KiB
1.2 KiB
m_rotation
Generate a 4x4 transformation matrix which can pass into multmatrix
to rotate the child element about the axis of the coordinate system or around an arbitrary axis.
Since: 1.1
Parameters
a
: If it's[deg_x, deg_y, deg_z]
, the rotation is applied in the orderx
,y
,z
. If it's[deg_x, deg_y]
, the rotation is applied in the orderx
,y
. If it's[deg_x]
, the rotation is only applied to thex
axis. If it's an number, the rotation is only applied to thez
axis or an arbitrary axis.v
: A vector allows you to set an arbitrary axis about which the object will be rotated. Whena
is an array, thev
argument is ignored.
Examples
use <matrix/m_rotation.scad>
point = [20, 0, 0];
a = [0, -45, 45];
hull() {
sphere(1);
multmatrix(m_rotation(a))
translate(point)
sphere(1);
}
use <matrix/m_rotation.scad>
v = [10, 10, 10];
hull() {
sphere(1);
translate(v)
sphere(1);
}
p = [10, 10, 0];
for(i = [0:20:340]) {
multmatrix(m_rotation(a = i, v = v))
translate(p)
sphere(1);
}