mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
add shear
This commit is contained in:
parent
fece5c2bde
commit
d746ff3078
44
src/__private__/__m_shearing.scad
Normal file
44
src/__private__/__m_shearing.scad
Normal file
@ -0,0 +1,44 @@
|
||||
function __m_shearing_sx(sx) =
|
||||
let(
|
||||
sx_along_y = sx[0],
|
||||
sx_along_z = sx[1]
|
||||
)
|
||||
[
|
||||
[1, sx_along_y, sx_along_z, 0],
|
||||
[0, 1, 0, 0],
|
||||
[0, 0, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function __m_shearing_sy(sy) =
|
||||
let(
|
||||
sy_along_x = sy[0],
|
||||
sy_along_z = sy[1]
|
||||
)
|
||||
[
|
||||
[1, 0, 0, 0],
|
||||
[sy_along_x, 1, sy_along_z, 0],
|
||||
[0, 0, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function __m_shearing_sz(sz) =
|
||||
let(
|
||||
sz_along_x = sz[0],
|
||||
sz_along_y = sz[1]
|
||||
)
|
||||
[
|
||||
[1, 0, 0, 0],
|
||||
[0, 1, 0, 0],
|
||||
[sz_along_x, sz_along_y, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function __m_shearing(sx, sy, sz) =
|
||||
__m_multiply(
|
||||
__m_shearing_sy(sz),
|
||||
__m_multiply(
|
||||
__m_shearing_sy(sy),
|
||||
__m_shearing_sx(sx)
|
||||
)
|
||||
);
|
@ -1,46 +1,4 @@
|
||||
include <__private__/__m_multiply.scad>;
|
||||
include <__private__/__m_shearing.scad>;
|
||||
|
||||
function _m_shearing_sx(sx) =
|
||||
let(
|
||||
sx_along_y = sx[0],
|
||||
sx_along_z = sx[1]
|
||||
)
|
||||
[
|
||||
[1, sx_along_y, sx_along_z, 0],
|
||||
[0, 1, 0, 0],
|
||||
[0, 0, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function _m_shearing_sy(sy) =
|
||||
let(
|
||||
sy_along_x = sy[0],
|
||||
sy_along_z = sy[1]
|
||||
)
|
||||
[
|
||||
[1, 0, 0, 0],
|
||||
[sy_along_x, 1, sy_along_z, 0],
|
||||
[0, 0, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function _m_shearing_sz(sz) =
|
||||
let(
|
||||
sz_along_x = sz[0],
|
||||
sz_along_y = sz[1]
|
||||
)
|
||||
[
|
||||
[1, 0, 0, 0],
|
||||
[0, 1, 0, 0],
|
||||
[sz_along_x, sz_along_y, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
];
|
||||
|
||||
function m_shearing(sx = [0, 0], sy = [0, 0], sz = [0, 0]) =
|
||||
__m_multiply(
|
||||
_m_shearing_sy(sz),
|
||||
__m_multiply(
|
||||
_m_shearing_sy(sy),
|
||||
_m_shearing_sx(sx)
|
||||
)
|
||||
);
|
||||
function m_shearing(sx = [0, 0], sy = [0, 0], sz = [0, 0]) = __m_shearing(sx, sy, sz);
|
6
src/shear.scad
Normal file
6
src/shear.scad
Normal file
@ -0,0 +1,6 @@
|
||||
include <__private__/__m_multiply.scad>;
|
||||
include <__private__/__m_shearing.scad>;
|
||||
|
||||
module shear(sx = [0, 0], sy = [0, 0], sz = [0, 0]) {
|
||||
multmatrix(__m_shearing(sx, sy, sz)) children();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user