mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-16 13:50:05 +01:00
22 lines
5.8 KiB
OpenSCAD
22 lines
5.8 KiB
OpenSCAD
use <unittest.scad>
|
|
use <shape_superformula.scad>
|
|
|
|
module test_shape_superformula() {
|
|
echo("==== test_shape_superformula ====");
|
|
|
|
phi_step = 0.05;
|
|
|
|
|
|
assertEqualPoints(
|
|
[[1, 0], [1.00031, 0.0500573], [1.00125, 0.10046], [1.0028, 0.151559], [1.00497, 0.203718], [1.00774, 0.257319], [1.0111, 0.31277], [1.01503, 0.370514], [1.01949, 0.431035], [1.02447, 0.494873], [1.02989, 0.562631], [1.03569, 0.634988], [1.04176, 0.712707], [1.04791, 0.796625], [1.05382, 0.887618], [1.05891, 0.986477], [1.06212, 1.09359], [1.06143, 1.20826], [1.05327, 1.32729], [1.03183, 1.4429], [0.989681, 1.54134], [0.921341, 1.60619], [0.828655, 1.62811], [0.721278, 1.61169], [0.61053, 1.57037], [0.50409, 1.51709], [0.405381, 1.46023], [0.315158, 1.4041], [0.232947, 1.3506], [0.157848, 1.30036], [0.0888879, 1.25345], [0.0251604, 1.20967], [-0.0341423, 1.16878], [-0.0897256, 1.13048], [-0.142206, 1.0945], [-0.192123, 1.06059], [-0.239956, 1.02851], [-0.286133, 0.998049], [-0.331044, 0.968998], [-0.375046, 0.941168], [-0.418473, 0.91438], [-0.461641, 0.888456], [-0.504856, 0.863226], [-0.548417, 0.838518], [-0.592622, 0.814157], [-0.637774, 0.789965], [-0.684186, 0.765751], [-0.732186, 0.741314], [-0.782123, 0.716436], [-0.834372, 0.690875], [-0.889346, 0.664361], [-0.947497, 0.63659], [-1.00933, 0.607209], [-1.0754, 0.575806], [-1.14631, 0.541894], [-1.22271, 0.504878], [-1.30517, 0.464026], [-1.39405, 0.418422], [-1.48905, 0.366911], [-1.58832, 0.30809], [-1.68684, 0.240453], [-1.77429, 0.162968], [-1.8345, 0.076346], [-1.85103, -0.0155626], [-1.81842, -0.10633], [-1.74702, -0.190135], [-1.6543, -0.264268], [-1.55469, -0.328782], [-1.45649, -0.384975], [-1.36344, -0.434355], [-1.27673, -0.478245], [-1.19637, -0.517714], [-1.12188, -0.553613], [-1.05267, -0.586621], [-0.988091, -0.617293], [-0.927557, -0.64609], [-0.870528, -0.673402], [-0.816518, -0.699563], [-0.765091, -0.724866], [-0.715846, -0.74957], [-0.668418, -0.773908], [-0.622465, -0.798093], [-0.577665, -0.822322], [-0.533711, -0.84678], [-0.490299, -0.871644], [-0.447134, -0.897088], [-0.403913, -0.923283], [-0.360329, -0.950402], [-0.316059, -0.978622], [-0.270764, -1.00813], [-0.224075, -1.03911], [-0.175591, -1.07178], [-0.124868, -1.10636], [-0.0714085, -1.14308], [-0.0146473, -1.18223], [0.0460598, -1.22406], [0.111452, -1.26886], [0.18237, -1.31688], [0.259752, -1.36824], [0.344568, -1.42274], [0.437631, -1.47942], [0.53912, -1.53573], [0.647576, -1.58617], [0.758281, -1.62073], [0.862053, -1.62552], [0.947326, -1.58897], [1.00661, -1.5112], [1.04098, -1.40513], [1.05716, -1.28714], [1.06228, -1.16898], [1.06135, -1.05666], [1.05734, -0.952316], [1.05189, -0.856175], [1.04585, -0.767657], [1.0397, -0.685922], [1.0337, -0.610096], [1.02802, -0.539367], [1.02274, -0.472999], [1.01793, -0.41034], [1.01364, -0.35081], [1.00991, -0.293889], [1.00674, -0.239108], [1.00417, -0.186036], [1.00221, -0.134275], [1.00086, -0.0834498], [1.00014, -0.0332021]],
|
|
shape_superformula(phi_step, 3, 3, 4.5, 10, 10)
|
|
);
|
|
|
|
assertEqualPoints(
|
|
[[1, 0], [1.00031, 0.0500574], [1.00125, 0.10046], [1.00283, 0.151562], [1.00505, 0.203733], [1.00793, 0.257366], [1.01149, 0.31289], [1.01576, 0.370781], [1.02077, 0.431575], [1.02656, 0.495886], [1.03317, 0.564426], [1.04064, 0.638021], [1.04887, 0.717569], [1.05724, 0.803717], [1.0628, 0.89518], [1.05482, 0.982667], [1.01242, 1.04243], [0.933118, 1.0622], [0.841354, 1.06024], [0.752593, 1.05241], [0.670333, 1.04398], [0.594371, 1.03618], [0.523835, 1.02921], [0.457858, 1.02308], [0.395681, 1.01775], [0.336652, 1.01318], [0.280204, 1.00932], [0.225839, 1.00616], [0.17311, 1.00367], [0.121609, 1.00183], [0.0709593, 1.00063], [0.0208004, 1.00005], [-0.0292151, 1.00011], [-0.079432, 1.00079], [-0.1302, 1.00209], [-0.18188, 1.00404], [-0.234854, 1.00665], [-0.289537, 1.00992], [-0.346382, 1.01389], [-0.405899, 1.01859], [-0.468666, 1.02405], [-0.535354, 1.03032], [-0.606739, 1.03743], [-0.683704, 1.04537], [-0.767083, 1.05384], [-0.856786, 1.06124], [-0.948011, 1.06103], [-1.02259, 1.03534], [-1.05797, 0.969119], [-1.06236, 0.879651], [-1.05589, 0.788775], [-1.04744, 0.703741], [-1.03932, 0.625254], [-1.032, 0.552572], [-1.02553, 0.484797], [-1.01987, 0.421124], [-1.01499, 0.360859], [-1.01084, 0.303402], [-1.0074, 0.248228], [-1.00463, 0.19487], [-1.00252, 0.142905], [-1.00105, 0.0919462], [-1.00022, 0.0416257], [-1.00001, -0.00840762], [-1.00043, -0.0584988], [-1.00147, -0.108994], [-1.00315, -0.16025], [-1.00548, -0.212638], [-1.00848, -0.266558], [-1.01216, -0.322445], [-1.01655, -0.380784], [-1.02169, -0.442124], [-1.02761, -0.507094], [-1.03437, -0.576423], [-1.04197, -0.650956], [-1.0503, -0.731587], [-1.05852, -0.818825], [-1.06289, -0.910641], [-1.05065, -0.995413], [-1.00113, -1.04829], [-0.917916, -1.06278], [-0.826033, -1.0591], [-0.738293, -1.05098], [-0.657142, -1.04261], [-0.582156, -1.03494], [-0.512444, -1.02812], [-0.447156, -1.02213], [-0.385551, -1.01693], [-0.326994, -1.01248], [-0.27093, -1.00874], [-0.21687, -1.0057], [-0.164375, -1.00332], [-0.113043, -1.00158], [-0.0625005, -1.00049], [-0.0123899, -1.00002], [0.0376354, -1.00018], [0.0879203, -1.00096], [0.138816, -1.00238], [0.190686, -1.00444], [0.243918, -1.00715], [0.298931, -1.01054], [0.356188, -1.01463], [0.416209, -1.01946], [0.479586, -1.02505], [0.547006, -1.03146], [0.619266, -1.03871], [0.697257, -1.04677], [0.78176, -1.05524], [0.872294, -1.06205], [0.962466, -1.05915], [1.03154, -1.02698], [1.06023, -0.95492], [1.06165, -0.864124], [1.0545, -0.774011], [1.04603, -0.6901], [1.03803, -0.612652], [1.03086, -0.540856], [1.02452, -0.473824], [1.019, -0.41077], [1.01424, -0.351017], [1.01021, -0.293978], [1.00688, -0.239141], [1.00423, -0.186045], [1.00223, -0.134277], [1.00087, -0.0834499], [1.00014, -0.0332021]],
|
|
shape_superformula(phi_step, 4, 4, 12, 15, 15)
|
|
);
|
|
}
|
|
|
|
test_shape_superformula();
|