mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 22:28:16 +01:00
23 lines
941 B
OpenSCAD
23 lines
941 B
OpenSCAD
use <unittest.scad>;
|
|
use <bezier_curve.scad>;
|
|
|
|
module test_bezier_curve() {
|
|
echo("==== test_bezier_curve ====");
|
|
|
|
t_step = 0.05;
|
|
width = 2;
|
|
|
|
p0 = [0, 0, 0];
|
|
p1 = [40, 60, 35];
|
|
p2 = [-50, 90, 0];
|
|
p3 = [0, 200, -35];
|
|
|
|
expected = [[0, 0, 0], [5.05875, 8.78875, 4.73375], [8.37, 17.21, 8.47], [10.1363, 25.3463, 11.2613], [10.56, 33.28, 13.16], [9.84375, 41.0938, 14.2188], [8.19, 48.87, 14.49], [5.80125, 56.6912, 14.0262], [2.88, 64.64, 12.88], [-0.37125, 72.7988, 11.1038], [-3.75, 81.25, 8.75], [-7.05375, 90.0763, 5.87125], [-10.08, 99.36, 2.52], [-12.6263, 109.184, -1.25125], [-14.49, 119.63, -5.39], [-15.4688, 130.781, -9.84375], [-15.36, 142.72, -14.56], [-13.9612, 155.529, -19.4863], [-11.07, 169.29, -24.57], [-6.48375, 184.086, -29.7588], [0, 200, -35]];
|
|
actual = bezier_curve(t_step,
|
|
[p0, p1, p2, p3]
|
|
);
|
|
|
|
assertEqualPoints(expected, actual, 0.0005);
|
|
}
|
|
|
|
test_bezier_curve(); |