BOSL2/tests/test_transforms.scad

459 lines
16 KiB
OpenSCAD
Raw Normal View History

2020-07-22 00:05:21 +00:00
include <../std.scad>
2020-06-21 08:30:49 +00:00
module test_translate() {
vals = [[-1,-2,-3],[0,0,0],[3,6,2],[1,2,3],[243,75,147]];
for (val=vals) {
assert_equal(translate(val), [[1,0,0,val.x],[0,1,0,val.y],[0,0,1,val.z],[0,0,0,1]]);
assert_equal(translate(val, p=[1,2,3]), [1,2,3]+val);
}
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
translate([-5,-5,-5]) translate([0,0,0]) translate([5,5,5]) union(){};
2020-06-21 08:30:49 +00:00
}
test_translate();
module test_move() {
vals = [[-1,-2,-3],[0,0,0],[3,6,2],[1,2,3],[243,75,147]];
for (val=vals) {
assert_equal(move(val), [[1,0,0,val.x],[0,1,0,val.y],[0,0,1,val.z],[0,0,0,1]]);
assert_equal(move(val, p=[1,2,3]), [1,2,3]+val);
assert_equal(move(x=val.x, y=val.y, z=val.z, p=[1,2,3]), [1,2,3]+val);
}
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
move(x=-5) move(y=-5) move(z=-5) move([-5,-5,-5]) union(){};
move(x=5) move(y=5) move(z=5) move([5,5,5]) union(){};
2022-01-11 02:23:09 +00:00
sq = square(10);
assert_equal(move("centroid", sq), move(-centroid(sq),sq));
assert_equal(move("mean", vals), move(-mean(vals), vals));
assert_equal(move("box", vals), move(-mean(pointlist_bounds(vals)),vals));
2020-06-21 08:30:49 +00:00
}
test_move();
module test_left() {
assert_equal(left(5),[[1,0,0,-5],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(left(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(left(-5),[[1,0,0,5],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(left(5,p=[1,2,3]),[-4,2,3]);
assert_equal(left(0,p=[1,2,3]),[1,2,3]);
assert_equal(left(-5,p=[1,2,3]),[6,2,3]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
left(-5) left(0) left(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_left();
module test_right() {
assert_equal(right(-5),[[1,0,0,-5],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(right(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(right(5),[[1,0,0,5],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(right(-5,p=[1,2,3]),[-4,2,3]);
assert_equal(right(0,p=[1,2,3]),[1,2,3]);
assert_equal(right(5,p=[1,2,3]),[6,2,3]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
right(-5) right(0) right(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_right();
module test_back() {
assert_equal(back(-5),[[1,0,0,0],[0,1,0,-5],[0,0,1,0],[0,0,0,1]]);
assert_equal(back(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(back(5),[[1,0,0,0],[0,1,0,5],[0,0,1,0],[0,0,0,1]]);
assert_equal(back(-5,p=[1,2,3]),[1,-3,3]);
assert_equal(back(0,p=[1,2,3]),[1,2,3]);
assert_equal(back(5,p=[1,2,3]),[1,7,3]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
back(-5) back(0) back(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_back();
module test_fwd() {
assert_equal(fwd(5),[[1,0,0,0],[0,1,0,-5],[0,0,1,0],[0,0,0,1]]);
assert_equal(fwd(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(fwd(-5),[[1,0,0,0],[0,1,0,5],[0,0,1,0],[0,0,0,1]]);
assert_equal(fwd(5,p=[1,2,3]),[1,-3,3]);
assert_equal(fwd(0,p=[1,2,3]),[1,2,3]);
assert_equal(fwd(-5,p=[1,2,3]),[1,7,3]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
fwd(-5) fwd(0) fwd(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_fwd();
module test_down() {
assert_equal(down(5),[[1,0,0,0],[0,1,0,0],[0,0,1,-5],[0,0,0,1]]);
assert_equal(down(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(down(-5),[[1,0,0,0],[0,1,0,0],[0,0,1,5],[0,0,0,1]]);
assert_equal(down(5,p=[1,2,3]),[1,2,-2]);
assert_equal(down(0,p=[1,2,3]),[1,2,3]);
assert_equal(down(-5,p=[1,2,3]),[1,2,8]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
down(-5) down(0) down(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_down();
module test_up() {
assert_equal(up(-5),[[1,0,0,0],[0,1,0,0],[0,0,1,-5],[0,0,0,1]]);
assert_equal(up(0),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(up(5),[[1,0,0,0],[0,1,0,0],[0,0,1,5],[0,0,0,1]]);
assert_equal(up(-5,p=[1,2,3]),[1,2,-2]);
assert_equal(up(0,p=[1,2,3]),[1,2,3]);
assert_equal(up(5,p=[1,2,3]),[1,2,8]);
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
up(-5) up(0) up(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_up();
module test_scale() {
2020-12-01 05:09:00 +00:00
cb = cube(1);
2020-06-21 08:30:49 +00:00
vals = [[-1,-2,-3],[1,1,1],[3,6,2],[1,2,3],[243,75,147]];
for (val=vals) {
assert_equal(scale(point2d(val)), [[val.x,0,0,0],[0,val.y,0,0],[0,0,1,0],[0,0,0,1]]);
2020-06-21 08:30:49 +00:00
assert_equal(scale(val), [[val.x,0,0,0],[0,val.y,0,0],[0,0,val.z,0],[0,0,0,1]]);
2021-06-15 03:28:49 +00:00
assert_equal(scale(val, p=[1,2,3]), v_mul([1,2,3], val));
2021-11-16 11:15:56 +00:00
scale(val) union(){};
2020-06-21 08:30:49 +00:00
}
assert_equal(scale(3), [[3,0,0,0],[0,3,0,0],[0,0,3,0],[0,0,0,1]]);
assert_equal(scale(3, p=[1,2,3]), 3*[1,2,3]);
2020-12-01 05:09:00 +00:00
assert_equal(scale(3, p=cb), cube(3));
assert_equal(scale(2, p=square(1)), square(2));
assert_equal(scale(2, cp=[1,1], p=square(1)), square(2, center=true));
assert_equal(scale([2,3], p=square(1)), square([2,3]));
assert_equal(scale([2,2], cp=[0.5,0.5], p=square(1)), move([-0.5,-0.5], p=square([2,2])));
assert_equal(scale([2,3,4], p=cb), cube([2,3,4]));
2021-06-15 03:28:49 +00:00
assert_equal(scale([-2,-3,-4], p=cb), [[for (p=cb[0]) v_mul(p,[-2,-3,-4])], [for (f=cb[1]) reverse(f)]]);
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
scale(-5) scale(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_scale();
module test_xscale() {
vals = [1,-1,-2,-3,10,147];
for (val=vals) {
assert_equal(xscale(val), [[val,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(xscale(val, p=[1,2,3]), [val*1,2,3]);
2021-11-16 11:15:56 +00:00
xscale(val) union(){};
}
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
xscale(-5) xscale(5) union(){};
}
2020-06-21 08:30:49 +00:00
test_xscale();
module test_yscale() {
vals = [1,-1,-2,-3,10,147];
for (val=vals) {
assert_equal(yscale(val), [[1,0,0,0],[0,val,0,0],[0,0,1,0],[0,0,0,1]]);
assert_equal(yscale(val, p=[1,2,3]), [1,val*2,3]);
2021-11-16 11:15:56 +00:00
yscale(val) union(){};
2020-06-21 08:30:49 +00:00
}
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
yscale(-5) yscale(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_yscale();
module test_zscale() {
vals = [1,-1,-2,-3,10,147];
for (val=vals) {
assert_equal(zscale(val), [[1,0,0,0],[0,1,0,0],[0,0,val,0],[0,0,0,1]]);
assert_equal(zscale(val, p=[1,2,3]), [1,2,val*3]);
2021-11-16 11:15:56 +00:00
zscale(val) union(){};
2020-06-21 08:30:49 +00:00
}
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
zscale(-5) zscale(5) union(){};
2020-06-21 08:30:49 +00:00
}
test_zscale();
module test_mirror() {
vals = [LEFT,RIGHT,FWD,BACK,DOWN,UP,BACK+UP+RIGHT,FWD+LEFT];
for (val=vals) {
v = unit(val);
a = v.x;
b = v.y;
c = v.z;
m = [
[1-2*a*a, -2*b*a, -2*c*a, 0],
[ -2*a*b, 1-2*b*b, -2*c*b, 0],
[ -2*a*c, -2*b*c, 1-2*c*c, 0],
[ 0, 0, 0, 1]
];
assert_approx(mirror(val), m, str("mirror(",val,")"));
assert_approx(mirror(val, p=[1,2,3]), apply(m, [1,2,3]), str("mirror(",val,",p=...)"));
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
mirror(val) union(){};
2020-06-21 08:30:49 +00:00
}
}
test_mirror();
module test_xflip() {
2021-06-29 02:06:16 +00:00
assert_approx(xflip(), [[-1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_approx(xflip(p=[1,2,3]), [-1,2,3]);
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
xflip() union(){};
2020-06-21 08:30:49 +00:00
}
test_xflip();
module test_yflip() {
2021-06-29 02:06:16 +00:00
assert_approx(yflip(), [[1,0,0,0],[0,-1,0,0],[0,0,1,0],[0,0,0,1]]);
assert_approx(yflip(p=[1,2,3]), [1,-2,3]);
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
yflip() union(){};
2020-06-21 08:30:49 +00:00
}
test_yflip();
module test_zflip() {
2021-06-29 02:06:16 +00:00
assert_approx(zflip(), [[1,0,0,0],[0,1,0,0],[0,0,-1,0],[0,0,0,1]]);
assert_approx(zflip(p=[1,2,3]), [1,2,-3]);
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
zflip() union(){};
2020-06-21 08:30:49 +00:00
}
test_zflip();
2021-06-29 02:06:16 +00:00
module test_rot() {
pts2d = 50 * [for (x=[-1,0,1],y=[-1,0,1]) [x,y]];
pts3d = 50 * [for (x=[-1,0,1],y=[-1,0,1],z=[-1,0,1]) [x,y,z]];
vecs2d = [
for (x=[-1,0,1], y=[-1,0,1]) if(x!=0||y!=0) [x,y],
polar_to_xy(1, -75),
polar_to_xy(1, 75)
];
vecs3d = [
LEFT, RIGHT, FRONT, BACK, DOWN, UP,
spherical_to_xyz(1, -30, 45),
spherical_to_xyz(1, 0, 45),
spherical_to_xyz(1, 30, 45),
spherical_to_xyz(2, -30, 135),
spherical_to_xyz(1, 30, 135),
spherical_to_xyz(1, -30, 75),
spherical_to_xyz(1, 45, 45),
];
2020-06-21 08:30:49 +00:00
angs = [-180, -90, 0, 30, 45, 90];
for (a = [-360*3:360:360*3]) {
2021-06-29 02:06:16 +00:00
assert_approx(rot(a), affine3d_identity(), info=str("rot(",a,") != identity"));
assert_approx(rot(a,p=pts2d), pts2d, info=str("rot(",a,",p=...), 2D"));
assert_approx(rot(a,p=pts3d), pts3d, info=str("rot(",a,",p=...), 3D"));
}
2021-06-29 02:06:16 +00:00
assert_approx(rot(90), [[0,-1,0,0],[1,0,0,0],[0,0,1,0],[0,0,0,1]]);
for (a=angs) {
2021-06-29 02:06:16 +00:00
assert_approx(rot(a), affine3d_zrot(a), info=str("Z angle (only) = ",a));
assert_approx(rot([a,0,0]), affine3d_xrot(a), info=str("X angle = ",a));
assert_approx(rot([0,a,0]), affine3d_yrot(a), info=str("Y angle = ",a));
assert_approx(rot([0,0,a]), affine3d_zrot(a), info=str("Z angle = ",a));
assert_approx(rot(a,p=pts2d), apply(affine3d_zrot(a),pts2d), info=str("Z angle (only) = ",a, ", p=..., 2D"));
assert_approx(rot([0,0,a],p=pts2d), apply(affine3d_zrot(a),pts2d), info=str("Z angle = ",a, ", p=..., 2D"));
assert_approx(rot(a,p=pts3d), apply(affine3d_zrot(a),pts3d), info=str("Z angle (only) = ",a, ", p=..., 3D"));
assert_approx(rot([a,0,0],p=pts3d), apply(affine3d_xrot(a),pts3d), info=str("X angle = ",a, ", p=..., 3D"));
assert_approx(rot([0,a,0],p=pts3d), apply(affine3d_yrot(a),pts3d), info=str("Y angle = ",a, ", p=..., 3D"));
assert_approx(rot([0,0,a],p=pts3d), apply(affine3d_zrot(a),pts3d), info=str("Z angle = ",a, ", p=..., 3D"));
}
for (xa=angs, ya=angs, za=angs) {
2021-06-29 02:06:16 +00:00
assert_approx(
rot([xa,ya,za]),
2021-01-21 02:14:04 +00:00
affine3d_zrot(za) * affine3d_yrot(ya) * affine3d_xrot(xa),
2020-06-21 08:30:49 +00:00
info=str("[X,Y,Z] = ",[xa,ya,za])
);
2021-06-29 02:06:16 +00:00
assert_approx(
rot([xa,ya,za],p=pts3d),
apply(
2021-01-21 02:14:04 +00:00
affine3d_zrot(za) * affine3d_yrot(ya) * affine3d_xrot(xa),
pts3d
),
2020-06-21 08:30:49 +00:00
info=str("[X,Y,Z] = ",[xa,ya,za], ", p=...")
);
}
for (vec1 = vecs3d) {
for (ang = angs) {
2021-06-29 02:06:16 +00:00
assert_approx(
rot(a=ang, v=vec1),
affine3d_rot_by_axis(vec1,ang),
2020-06-21 08:30:49 +00:00
info=str("a = ",ang,", v = ", vec1)
);
2021-06-29 02:06:16 +00:00
assert_approx(
rot(a=ang, v=vec1, p=pts3d),
apply(affine3d_rot_by_axis(vec1,ang), pts3d),
2020-06-21 08:30:49 +00:00
info=str("a = ",ang,", v = ", vec1, ", p=...")
);
}
}
for (vec1 = vecs2d) {
for (vec2 = vecs2d) {
2021-06-29 02:06:16 +00:00
assert_approx(
rot(from=vec1, to=vec2, p=pts2d),
2021-06-15 03:28:49 +00:00
apply(affine2d_zrot(v_theta(vec2)-v_theta(vec1)), pts2d),
2020-06-21 08:30:49 +00:00
info=str(
"from = ", vec1, ", ",
"to = ", vec2, ", ",
"p=..., 2D"
)
);
}
}
for (vec1 = vecs3d) {
for (vec2 = vecs3d) {
for (a = angs) {
2021-06-29 02:06:16 +00:00
assert_approx(
rot(from=vec1, to=vec2, a=a),
2021-03-08 22:54:16 +00:00
affine3d_rot_from_to(vec1,vec2) * affine3d_rot_by_axis(vec1,a),
2020-06-21 08:30:49 +00:00
info=str(
"from = ", vec1, ", ",
"to = ", vec2, ", ",
"a = ", a
)
);
2021-06-29 02:06:16 +00:00
assert_approx(
rot(from=vec1, to=vec2, a=a, p=pts3d),
apply(
2021-03-08 22:54:16 +00:00
affine3d_rot_from_to(vec1,vec2) * affine3d_rot_by_axis(vec1,a),
pts3d
),
2020-06-21 08:30:49 +00:00
info=str(
"from = ", vec1, ", ",
"to = ", vec2, ", ",
"a = ", a, ", ",
"p=..., 3D"
)
);
}
}
}
}
test_rot();
2020-06-21 08:30:49 +00:00
module test_xrot() {
2020-06-22 02:46:22 +00:00
vals = [-270,-135,-90,45,0,30,45,90,135,147,180];
path = path3d(pentagon(d=100), 50);
2020-06-21 08:30:49 +00:00
for (a=vals) {
m = [[1,0,0,0],[0,cos(a),-sin(a),0],[0,sin(a),cos(a),0],[0,0,0,1]];
2021-06-29 02:06:16 +00:00
assert_approx(xrot(a), m);
assert_approx(xrot(a, p=path[0]), apply(m, path[0]));
assert_approx(xrot(a, p=path), apply(m, path));
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
xrot(a) union(){};
2020-06-21 08:30:49 +00:00
}
}
test_xrot();
module test_yrot() {
2020-06-22 02:46:22 +00:00
vals = [-270,-135,-90,45,0,30,45,90,135,147,180];
path = path3d(pentagon(d=100), 50);
2020-06-21 08:30:49 +00:00
for (a=vals) {
m = [[cos(a),0,sin(a),0],[0,1,0,0],[-sin(a),0,cos(a),0],[0,0,0,1]];
2021-06-29 02:06:16 +00:00
assert_approx(yrot(a), m);
assert_approx(yrot(a, p=path[0]), apply(m, path[0]));
assert_approx(yrot(a, p=path), apply(m, path));
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
yrot(a) union(){};
2020-06-21 08:30:49 +00:00
}
}
test_yrot();
module test_zrot() {
2020-06-22 02:46:22 +00:00
vals = [-270,-135,-90,45,0,30,45,90,135,147,180];
path = path3d(pentagon(d=100), 50);
2020-06-21 08:30:49 +00:00
for (a=vals) {
m = [[cos(a),-sin(a),0,0],[sin(a),cos(a),0,0],[0,0,1,0],[0,0,0,1]];
2021-06-29 02:06:16 +00:00
assert_approx(zrot(a), m);
assert_approx(zrot(a, p=path[0]), apply(m, path[0]));
assert_approx(zrot(a, p=path), apply(m, path));
2020-06-21 08:30:49 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
zrot(a) union(){};
2020-06-21 08:30:49 +00:00
}
}
2020-06-22 02:46:22 +00:00
test_zrot();
2021-06-29 02:06:16 +00:00
2021-09-06 22:38:00 +00:00
module test_frame_map() {
assert(approx(frame_map(x=[1,1,0], y=[-1,1,0]), affine3d_zrot(45)));
2021-09-11 23:35:05 +00:00
assert(approx(frame_map(x=[0,1,0], y=[0,0,1]), rot(v=[1,1,1],a=120)));
2021-09-06 22:38:00 +00:00
}
test_frame_map();
2021-06-29 02:06:16 +00:00
2020-06-22 02:46:22 +00:00
module test_skew() {
m = affine3d_skew(sxy=2, sxz=3, syx=4, syz=5, szx=6, szy=7);
2021-06-29 02:06:16 +00:00
assert_approx(skew(sxy=2, sxz=3, syx=4, syz=5, szx=6, szy=7), m);
assert_approx(skew(sxy=2, sxz=3, syx=4, syz=5, szx=6, szy=7, p=[1,2,3]), apply(m,[1,2,3]));
2020-06-22 02:46:22 +00:00
// Verify that module at least doesn't crash.
2021-11-16 11:15:56 +00:00
skew(undef,2,3,4,5,6,7) union(){};
2020-06-22 02:46:22 +00:00
}
test_skew();
2020-06-21 08:30:49 +00:00
module test_apply() {
assert(approx(apply(affine3d_xrot(90),2*UP),2*FRONT));
assert(approx(apply(affine3d_yrot(90),2*UP),2*RIGHT));
assert(approx(apply(affine3d_zrot(90),2*UP),2*UP));
assert(approx(apply(affine3d_zrot(90),2*RIGHT),2*BACK));
assert(approx(apply(affine3d_zrot(90),2*BACK+2*RIGHT),2*BACK+2*LEFT));
assert(approx(apply(affine3d_xrot(135),2*BACK+2*UP),2*sqrt(2)*FWD));
assert(approx(apply(affine3d_yrot(135),2*RIGHT+2*UP),2*sqrt(2)*DOWN));
assert(approx(apply(affine3d_zrot(45),2*BACK+2*RIGHT),2*sqrt(2)*BACK));
module check_path_apply(mat,path)
assert_approx(apply(mat,path),path3d([for (p=path) mat*concat(p,1)]));
2021-11-21 04:33:04 +00:00
check_path_apply(xrot(45), path3d(rect(100)));
check_path_apply(yrot(45), path3d(rect(100)));
check_path_apply(zrot(45), path3d(rect(100)));
check_path_apply(rot([20,30,40])*scale([0.9,1.1,1])*move([10,20,30]), path3d(rect(100)));
module check_patch_apply(mat,patch)
assert_approx(apply(mat,patch), [for (path=patch) path3d([for (p=path) mat*concat(p,1)])]);
flat = [for (x=[-50:25:50]) [for (y=[-50:25:50]) [x,y,0]]];
check_patch_apply(xrot(45), flat);
check_patch_apply(yrot(45), flat);
check_patch_apply(zrot(45), flat);
check_patch_apply(rot([20,30,40])*scale([0.9,1.1,1])*move([10,20,30]), flat);
}
test_apply();
module test_is_2d_transform() {
assert(!is_2d_transform(affine2d_identity()));
assert(!is_2d_transform(affine2d_translate([5,8])));
assert(!is_2d_transform(affine2d_scale([3,4])));
assert(!is_2d_transform(affine2d_zrot(30)));
assert(!is_2d_transform(affine2d_mirror([-1,1])));
assert(!is_2d_transform(affine2d_skew(30,15)));
assert(is_2d_transform(affine3d_identity()));
assert(is_2d_transform(affine3d_translate([30,40,0])));
assert(!is_2d_transform(affine3d_translate([30,40,50])));
assert(is_2d_transform(affine3d_scale([3,4,1])));
assert(!is_2d_transform(affine3d_xrot(30)));
assert(!is_2d_transform(affine3d_yrot(30)));
assert(is_2d_transform(affine3d_zrot(30)));
assert(is_2d_transform(affine3d_skew(sxy=2)));
assert(is_2d_transform(affine3d_skew(syx=2)));
assert(!is_2d_transform(affine3d_skew(szx=2)));
assert(!is_2d_transform(affine3d_skew(szy=2)));
}
test_is_2d_transform();
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap