1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-16 21:58:26 +01:00
dotSCAD/test/test_line3d.scad

44 lines
968 B
OpenSCAD
Raw Permalink Normal View History

2022-06-06 13:11:46 +08:00
use <unittest.scad>
include <line3d.scad>
2017-06-05 15:40:59 +08:00
2020-01-28 09:44:36 +08:00
module test_line3d_butt(p, r, frags, length, angles) {
2017-06-05 15:40:59 +08:00
p1 = [0, 0, 0];
p2 = [10, 2, 10];
2021-02-19 11:17:15 +08:00
diameter = 1;
2017-06-05 15:40:59 +08:00
fn = 24;
2020-01-28 09:44:36 +08:00
assertEqualPoint(p1, p);
2021-02-19 11:17:15 +08:00
assertEqualNum(diameter / 2, r);
2020-01-28 09:44:36 +08:00
assertEqualNum(fn, frags);
assertEqualNum(14.2829, length);
assertEqualPoint([0, 45.5618, 11.3099], angles);
}
2017-06-05 15:40:59 +08:00
2020-01-28 09:44:36 +08:00
module test_line3d_cap(p, r, frags, cap_leng, angles) {
p1 = [0, 0, 0];
p2 = [10, 2, 10];
2021-02-19 11:17:15 +08:00
diameter = 1;
2020-01-28 09:44:36 +08:00
fn = 24;
assert(p == p1 || p == p2);
2021-02-19 11:17:15 +08:00
assertEqualNum(diameter / 2, r);
2020-01-28 09:44:36 +08:00
assertEqualNum(fn, frags);
assertEqualNum(0.3536, cap_leng);
assertEqualPoint([0, 45.5618, 11.3099], angles);
}
module test_line3d() {
p1 = [0, 0, 0];
p2 = [10, 2, 10];
2021-02-19 11:17:15 +08:00
diameter = 1;
2020-01-28 09:44:36 +08:00
fn = 24;
2017-06-05 15:40:59 +08:00
2020-01-28 09:44:36 +08:00
echo("==== test_line3d_default_caps ====");
2017-06-05 15:40:59 +08:00
2020-01-27 15:13:08 +08:00
line3d(
p1 = p1,
p2 = p2,
2021-02-19 11:17:15 +08:00
diameter = diameter,
2020-01-27 15:13:08 +08:00
$fn = fn
);
2017-06-05 15:40:59 +08:00
}
test_line3d();