Fixed references to skew_*()

This commit is contained in:
Revar Desmera 2019-12-19 23:26:54 -08:00
parent 17867c9dc1
commit 91b0e58093
4 changed files with 29 additions and 17 deletions

View file

@ -276,11 +276,31 @@ function affine3d_mirror(v) =
]; ];
// Function: affine3d_skew()
// Usage:
// mat = affine3d_skew([sxy], [sxz], [syx], [xyz], [szx], [szy]);
// Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation.
// Arguments:
// sxy = Skew factor multiplier for skewing along the X axis as you get farther from the Y axis. Default: 0
// sxz = Skew factor multiplier for skewing along the X axis as you get farther from the Z axis. Default: 0
// syx = Skew factor multiplier for skewing along the Y axis as you get farther from the X axis. Default: 0
// syz = Skew factor multiplier for skewing along the Y axis as you get farther from the Z axis. Default: 0
// szx = Skew factor multiplier for skewing along the Z axis as you get farther from the X axis. Default: 0
// szy = Skew factor multiplier for skewing along the Z axis as you get farther from the Y axis. Default: 0
function affine3d_skew(sxy=0, sxz=0, syx=0, xyz=0, szx=0, szy=0) = [
[ 1, sxy, sxz, 0],
[syx, 1, syz, 0],
[szx, szy, 1, 0],
[ 0, 0, 0, 1]
];
// Function: affine3d_skew_xy() // Function: affine3d_skew_xy()
// Usage: // Usage:
// affine3d_skew_xy(xa, ya) // affine3d_skew_xy(xa, ya)
// Description: // Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation along the XY plane.. // Returns the 4x4 affine3d matrix to perform a skew transformation along the XY plane.
// Arguments: // Arguments:
// xa = Skew angle, in degrees, in the direction of the X axis. // xa = Skew angle, in degrees, in the direction of the X axis.
// ya = Skew angle, in degrees, in the direction of the Y axis. // ya = Skew angle, in degrees, in the direction of the Y axis.

View file

@ -952,12 +952,9 @@ function zflip(z=0,p) =
// trace_polyline(close_path(pts), showpts=true); // trace_polyline(close_path(pts), showpts=true);
module skew(sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0) module skew(sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0)
{ {
multmatrix([ multmatrix(
[ 1, sxy, sxz, 0], affine3d_skew(sxy=sxy, sxz=sxz, syx=syx, syz=syz, szx=szx, szy=szy)
[syx, 1, syz, 0], ) children();
[szx, szy, 1, 0],
[ 0, 0, 0, 1]
]) children();
} }
function skew(p, sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0, planar=false) = function skew(p, sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0, planar=false) =
@ -967,12 +964,7 @@ function skew(p, sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0, planar=false) =
[ 1, sxy, 0], [ 1, sxy, 0],
[syx, 1, 0], [syx, 1, 0],
[ 0, 0, 1] [ 0, 0, 1]
] : [ ] : affine3d_skew(sxy=sxy, sxz=sxz, syx=syx, syz=syz, szx=szx, szy=szy)
[ 1, sxy, sxz, 0],
[syx, 1, syz, 0],
[szx, szy, 1, 0],
[ 0, 0, 0, 1]
]
) )
is_undef(p)? m : is_undef(p)? m :
assert(is_list(p)) assert(is_list(p))

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,61]; BOSL_VERSION = [2,0,62];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions

View file

@ -352,8 +352,8 @@ module sparse_strut(h=50, l=100, thick=4, maxang=30, strut=5, max_bridge=20, anc
} }
yspread(ystep, n=yreps) { yspread(ystep, n=yreps) {
xspread(zstep, n=zreps) { xspread(zstep, n=zreps) {
skew_xy(planar=true, ya=-ang) square([(h-strut)/zreps, strut], center=true); skew(syx=tan(-ang)) square([(h-strut)/zreps, strut], center=true);
skew_xy(planar=true, ya= ang) square([(h-strut)/zreps, strut], center=true); skew(syx=tan( ang)) square([(h-strut)/zreps, strut], center=true);
} }
} }
} }
@ -440,7 +440,7 @@ module sparse_strut3d(h=50, l=100, w=50, thick=3, maxang=40, strut=3, max_bridge
for (soff = [0:1:supp_reps-1] ) { for (soff = [0:1:supp_reps-1] ) {
yflip_copy() { yflip_copy() {
back(soff*supp_step) { back(soff*supp_step) {
skew_xy(ya=supp_ang) { skew(syz=tan(supp_ang)) {
cube([strut, strut, zstep], anchor=BOTTOM); cube([strut, strut, zstep], anchor=BOTTOM);
} }
} }