mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-05 14:27:45 +02:00
refactor testcase
This commit is contained in:
@@ -1,4 +1,20 @@
|
|||||||
include <unittest.scad>;
|
use <unittest.scad>;
|
||||||
|
use <hull_polyline3d.scad>;
|
||||||
|
|
||||||
|
module test_hull_polyline3d_line_segment(index, point1, point2, radius) {
|
||||||
|
points = [
|
||||||
|
[1, 2, 3],
|
||||||
|
[4, -5, -6],
|
||||||
|
[-1, -3, -5],
|
||||||
|
[0, 0, 0]
|
||||||
|
];
|
||||||
|
|
||||||
|
thickness = 1;
|
||||||
|
|
||||||
|
assertEqualPoint(points[index - 1], point1);
|
||||||
|
assertEqualPoint(points[index], point2);
|
||||||
|
assertEqualNum(thickness, radius * 2);
|
||||||
|
}
|
||||||
|
|
||||||
module test_hull_polyline3d() {
|
module test_hull_polyline3d() {
|
||||||
echo("==== test_hull_polyline3d ====");
|
echo("==== test_hull_polyline3d ====");
|
||||||
@@ -12,14 +28,6 @@ module test_hull_polyline3d() {
|
|||||||
|
|
||||||
thickness = 1;
|
thickness = 1;
|
||||||
|
|
||||||
include <hull_polyline3d.scad>;
|
|
||||||
|
|
||||||
module test_hull_polyline3d_line_segment(index, point1, point2, radius) {
|
|
||||||
assertEqualPoint(points[index - 1], point1);
|
|
||||||
assertEqualPoint(points[index], point2);
|
|
||||||
assertEqualNum(thickness, radius * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
hull_polyline3d(
|
hull_polyline3d(
|
||||||
points = points,
|
points = points,
|
||||||
thickness = thickness,
|
thickness = thickness,
|
||||||
@@ -27,35 +35,4 @@ module test_hull_polyline3d() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module test_hull_polyline3d_helix() {
|
|
||||||
echo("==== test_hull_polyline3d_helix ====");
|
|
||||||
|
|
||||||
r = 50;
|
|
||||||
points = [
|
|
||||||
for(a = [0:180])
|
|
||||||
[
|
|
||||||
r * cos(-90 + a) * cos(a),
|
|
||||||
r * cos(-90 + a) * sin(a),
|
|
||||||
r * sin(-90 + a)
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
thickness = 12;
|
|
||||||
|
|
||||||
include <hull_polyline3d.scad>;
|
|
||||||
|
|
||||||
module test_hull_polyline3d_line_segment(index, point1, point2, radius) {
|
|
||||||
assertEqualPoint(points[index - 1], point1);
|
|
||||||
assertEqualPoint(points[index], point2);
|
|
||||||
assertEqualNum(thickness, radius * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = [0:7]) {
|
|
||||||
rotate(45 * i)
|
|
||||||
hull_polyline3d(points, thickness, $fn = 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
test_hull_polyline3d();
|
test_hull_polyline3d();
|
||||||
test_hull_polyline3d_helix();
|
|
Reference in New Issue
Block a user