mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-10 16:54:23 +02:00
refactor deps
This commit is contained in:
@@ -8,8 +8,8 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__comm__/__frags.scad>;
|
use <__comm__/__frags.scad>;
|
||||||
include <__comm__/__nearest_multiple_of_4.scad>;
|
use <__comm__/__nearest_multiple_of_4.scad>;
|
||||||
|
|
||||||
module rounded_cube(size, corner_r, center = false) {
|
module rounded_cube(size, corner_r, center = false) {
|
||||||
is_flt = is_num(size);
|
is_flt = is_num(size);
|
||||||
|
@@ -1,83 +1,29 @@
|
|||||||
include <unittest.scad>;
|
use <unittest.scad>;
|
||||||
|
use <rounded_cube.scad>;
|
||||||
|
|
||||||
|
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
||||||
|
size = 20;
|
||||||
|
half_size = size / 2;
|
||||||
|
|
||||||
|
assert(corner_frags % 4 == 0);
|
||||||
|
|
||||||
|
expected_corners = [[5.0961, 5.0961, 5.0961], [-5.0961, 5.0961, 5.0961], [5.0961, -5.0961, 5.0961], [-5.0961, -5.0961, 5.0961], [5.0961, 5.0961, -5.0961], [-5.0961, 5.0961, -5.0961], [5.0961, -5.0961, -5.0961], [-5.0961, -5.0961, -5.0961]];
|
||||||
|
|
||||||
|
assertEqualPoints(expected_corners, corners);
|
||||||
|
|
||||||
|
assertEqualPoint(
|
||||||
|
[half_size, half_size, half_size],
|
||||||
|
center_pts
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
module test_rounded_cube_size_corner() {
|
module test_rounded_cube_size_corner() {
|
||||||
echo("==== test_rounded_cube_size_corner ====");
|
echo("==== test_rounded_cube_size_corner ====");
|
||||||
|
|
||||||
size = 20;
|
size = 20;
|
||||||
corner_r = 5;
|
corner_r = 5;
|
||||||
|
|
||||||
include <rounded_cube.scad>;
|
|
||||||
|
|
||||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
|
||||||
half_size = size / 2;
|
|
||||||
|
|
||||||
assert(corner_frags % 4 == 0);
|
|
||||||
|
|
||||||
expected_corners = [[5.0961, 5.0961, 5.0961], [-5.0961, 5.0961, 5.0961], [5.0961, -5.0961, 5.0961], [-5.0961, -5.0961, 5.0961], [5.0961, 5.0961, -5.0961], [-5.0961, 5.0961, -5.0961], [5.0961, -5.0961, -5.0961], [-5.0961, -5.0961, -5.0961]];
|
|
||||||
|
|
||||||
assertEqualPoints(expected_corners, corners);
|
|
||||||
|
|
||||||
assertEqualPoint(
|
|
||||||
[half_size, half_size, half_size],
|
|
||||||
center_pts
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
rounded_cube(size, corner_r);
|
rounded_cube(size, corner_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
module test_rounded_cube_size_center() {
|
test_rounded_cube_size_corner();
|
||||||
echo("==== test_rounded_cube_size_corner ====");
|
|
||||||
|
|
||||||
size = [50, 25, 15];
|
|
||||||
corner_r = 5;
|
|
||||||
|
|
||||||
include <rounded_cube.scad>;
|
|
||||||
|
|
||||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
|
||||||
|
|
||||||
assert(corner_frags % 4 == 0);
|
|
||||||
|
|
||||||
expected_corners = [[20.0961, 7.5961, 2.5961], [-20.0961, 7.5961, 2.5961], [20.0961, -7.5961, 2.5961], [-20.0961, -7.5961, 2.5961], [20.0961, 7.5961, -2.5961], [-20.0961, 7.5961, -2.5961], [20.0961, -7.5961, -2.5961], [-20.0961, -7.5961, -2.5961]];
|
|
||||||
|
|
||||||
assertEqualPoints(expected_corners, corners);
|
|
||||||
|
|
||||||
assertEqualPoint(
|
|
||||||
[0, 0, 0],
|
|
||||||
center_pts
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
rounded_cube(size, corner_r, center = true);
|
|
||||||
}
|
|
||||||
|
|
||||||
module test_rounded_cube_size_center_fn() {
|
|
||||||
echo("==== test_rounded_cube_size_center_fn ====");
|
|
||||||
|
|
||||||
$fn = 8;
|
|
||||||
|
|
||||||
size = [50, 25, 15];
|
|
||||||
corner_r = 5;
|
|
||||||
|
|
||||||
include <rounded_cube.scad>;
|
|
||||||
|
|
||||||
module test_rounded_edge_corner_center(corner_frags, corners, center_pts) {
|
|
||||||
|
|
||||||
assert(corner_frags == $fn);
|
|
||||||
|
|
||||||
expected_corners = [[20.3806, 7.8806, 2.8806], [-20.3806, 7.8806, 2.8806], [20.3806, -7.8806, 2.8806], [-20.3806, -7.8806, 2.8806], [20.3806, 7.8806, -2.8806], [-20.3806, 7.8806, -2.8806], [20.3806, -7.8806, -2.8806], [-20.3806, -7.8806, -2.8806]];
|
|
||||||
|
|
||||||
assertEqualPoints(expected_corners, corners);
|
|
||||||
|
|
||||||
assertEqualPoint(
|
|
||||||
[0, 0, 0],
|
|
||||||
center_pts
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
rounded_cube(size, corner_r, center = true);
|
|
||||||
}
|
|
||||||
|
|
||||||
test_rounded_cube_size_corner();
|
|
||||||
test_rounded_cube_size_center();
|
|
||||||
test_rounded_cube_size_center_fn();
|
|
Reference in New Issue
Block a user