mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-06-02 19:05:35 +02:00
refactor deps
This commit is contained in:
parent
6a0694b81f
commit
69e8910c1b
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <util/__comm__/__reverse.scad>;
|
use <util/reverse.scad>;
|
||||||
|
|
||||||
module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
|
module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
|
||||||
|
|
||||||
@ -75,12 +75,12 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
|
|||||||
offset_v = [leng_pts, leng_pts, leng_pts];
|
offset_v = [leng_pts, leng_pts, leng_pts];
|
||||||
base_tri_faces1 = [
|
base_tri_faces1 = [
|
||||||
for(face = top_tri_faces1)
|
for(face = top_tri_faces1)
|
||||||
__reverse(face) + offset_v
|
reverse(face) + offset_v
|
||||||
];
|
];
|
||||||
|
|
||||||
base_tri_faces2 = [
|
base_tri_faces2 = [
|
||||||
for(face = top_tri_faces2)
|
for(face = top_tri_faces2)
|
||||||
__reverse(face) + offset_v
|
reverse(face) + offset_v
|
||||||
];
|
];
|
||||||
|
|
||||||
side_faces1 = [
|
side_faces1 = [
|
||||||
|
@ -2,12 +2,40 @@ include <unittest.scad>;
|
|||||||
include <line3d.scad>;
|
include <line3d.scad>;
|
||||||
include <polyline3d.scad>;
|
include <polyline3d.scad>;
|
||||||
include <hull_polyline3d.scad>;
|
include <hull_polyline3d.scad>;
|
||||||
|
include <function_grapher.scad>;
|
||||||
|
|
||||||
|
module test_function_grapher_faces(points, faces) {
|
||||||
|
pts = [
|
||||||
|
[[0, 0, 1], [1, 0, 2], [2, 0, 2], [3, 0, 3]],
|
||||||
|
[[0, 1, 1], [1, 1, 4], [2, 1, 0], [3, 1, 3]],
|
||||||
|
[[0, 2, 1], [1, 2, 3], [2, 2, 1], [3, 2, 3]],
|
||||||
|
[[0, 3, 1], [1, 3, 3], [2, 3, 1], [3, 3, 3]]
|
||||||
|
];
|
||||||
|
|
||||||
|
thickness = 0.5;
|
||||||
|
|
||||||
|
expected_pts = concat([
|
||||||
|
for(row = pts)
|
||||||
|
for(pt = row)
|
||||||
|
pt
|
||||||
|
], [
|
||||||
|
for(row = pts)
|
||||||
|
for(pt = row)
|
||||||
|
pt + [0, 0, -thickness]
|
||||||
|
]);
|
||||||
|
|
||||||
|
assertEqualPoints(expected_pts, points);
|
||||||
|
|
||||||
|
expected_faces = [[0, 5, 1], [1, 6, 2], [2, 7, 3], [4, 9, 5], [5, 10, 6], [6, 11, 7], [8, 13, 9], [9, 14, 10], [10, 15, 11], [0, 4, 5], [1, 5, 6], [2, 6, 7], [4, 8, 9], [5, 9, 10], [6, 10, 11], [8, 12, 13], [9, 13, 14], [10, 14, 15], [17, 21, 16], [18, 22, 17], [19, 23, 18], [21, 25, 20], [22, 26, 21], [23, 27, 22], [25, 29, 24], [26, 30, 25], [27, 31, 26], [21, 20, 16], [22, 21, 17], [23, 22, 18], [25, 24, 20], [26, 25, 21], [27, 26, 22], [29, 28, 24], [30, 29, 25], [31, 30, 26], [0, 1, 17, 16], [1, 2, 18, 17], [2, 3, 19, 18], [3, 7, 23, 19], [7, 11, 27, 23], [11, 15, 31, 27], [13, 12, 28, 29], [14, 13, 29, 30], [15, 14, 30, 31], [4, 0, 16, 20], [8, 4, 20, 24], [12, 8, 24, 28]];
|
||||||
|
|
||||||
|
for(i = [0:len(expected_faces) - 1]) {
|
||||||
|
assert(expected_faces[i] == faces[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module test_function_grapher_default() {
|
module test_function_grapher_default() {
|
||||||
echo("==== test_function_grapher_default ====");
|
echo("==== test_function_grapher_default ====");
|
||||||
|
|
||||||
include <function_grapher.scad>;
|
|
||||||
|
|
||||||
pts = [
|
pts = [
|
||||||
[[0, 0, 1], [1, 0, 2], [2, 0, 2], [3, 0, 3]],
|
[[0, 0, 1], [1, 0, 2], [2, 0, 2], [3, 0, 3]],
|
||||||
[[0, 1, 1], [1, 1, 4], [2, 1, 0], [3, 1, 3]],
|
[[0, 1, 1], [1, 1, 4], [2, 1, 0], [3, 1, 3]],
|
||||||
@ -17,26 +45,6 @@ module test_function_grapher_default() {
|
|||||||
|
|
||||||
thickness = 0.5;
|
thickness = 0.5;
|
||||||
|
|
||||||
module test_function_grapher_faces(points, faces) {
|
|
||||||
expected_pts = concat([
|
|
||||||
for(row = pts)
|
|
||||||
for(pt = row)
|
|
||||||
pt
|
|
||||||
], [
|
|
||||||
for(row = pts)
|
|
||||||
for(pt = row)
|
|
||||||
pt + [0, 0, -thickness]
|
|
||||||
]);
|
|
||||||
|
|
||||||
assertEqualPoints(expected_pts, points);
|
|
||||||
|
|
||||||
expected_faces = [[0, 5, 1], [1, 6, 2], [2, 7, 3], [4, 9, 5], [5, 10, 6], [6, 11, 7], [8, 13, 9], [9, 14, 10], [10, 15, 11], [0, 4, 5], [1, 5, 6], [2, 6, 7], [4, 8, 9], [5, 9, 10], [6, 10, 11], [8, 12, 13], [9, 13, 14], [10, 14, 15], [17, 21, 16], [18, 22, 17], [19, 23, 18], [21, 25, 20], [22, 26, 21], [23, 27, 22], [25, 29, 24], [26, 30, 25], [27, 31, 26], [21, 20, 16], [22, 21, 17], [23, 22, 18], [25, 24, 20], [26, 25, 21], [27, 26, 22], [29, 28, 24], [30, 29, 25], [31, 30, 26], [0, 1, 17, 16], [1, 2, 18, 17], [2, 3, 19, 18], [3, 7, 23, 19], [7, 11, 27, 23], [11, 15, 31, 27], [13, 12, 28, 29], [14, 13, 29, 30], [15, 14, 30, 31], [4, 0, 16, 20], [8, 4, 20, 24], [12, 8, 24, 28]];
|
|
||||||
|
|
||||||
for(i = [0:len(expected_faces) - 1]) {
|
|
||||||
assert(expected_faces[i] == faces[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function_grapher(pts, thickness);
|
function_grapher(pts, thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user