1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-14 10:44:48 +02:00
This commit is contained in:
Justin Lin
2020-03-03 09:01:19 +08:00
parent 5f38d3fc1f
commit 42650a7a19

View File

@@ -162,10 +162,8 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
test_function_grapher_faces(pts, face_idxs); test_function_grapher_faces(pts, face_idxs);
} }
module tri_to_lines(tri1, tri2) { module tri_to_slash_lines(tri1, tri2) {
polyline3d(concat(tri1, [tri1[0]]), thickness); polyline3d(concat(tri1, [tri1[0]]), thickness);
if(slicing == "SLASH") {
if(tri2[0][0] == points[0][0][0]) { if(tri2[0][0] == points[0][0][0]) {
polyline3d([tri2[0], tri2[2]], thickness); polyline3d([tri2[0], tri2[2]], thickness);
} }
@@ -174,7 +172,9 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
polyline3d([tri2[1], tri2[2]], thickness); polyline3d([tri2[1], tri2[2]], thickness);
} }
} }
else {
module tri_to_backslash_lines(tri1, tri2) {
polyline3d(concat(tri1, [tri1[0]]), thickness);
if(tri2[1][0] == points[0][columns - 1][0]) { if(tri2[1][0] == points[0][columns - 1][0]) {
polyline3d([tri2[1], tri2[2]], thickness); polyline3d([tri2[1], tri2[2]], thickness);
} }
@@ -183,12 +183,10 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
polyline3d([tri2[0], tri2[2]], thickness); polyline3d([tri2[0], tri2[2]], thickness);
} }
} }
}
module tri_to_hull_lines(tri1, tri2) { module tri_to_slash_hull_lines(tri1, tri2) {
hull_polyline3d(concat(tri1, [tri1[0]]), thickness); hull_polyline3d(concat(tri1, [tri1[0]]), thickness);
if(slicing == "SLASH") {
if(tri2[0][0] == points[0][0][0]) { if(tri2[0][0] == points[0][0][0]) {
hull_polyline3d([tri2[0], tri2[2]], thickness); hull_polyline3d([tri2[0], tri2[2]], thickness);
} }
@@ -197,7 +195,10 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
hull_polyline3d([tri2[1], tri2[2]], thickness); hull_polyline3d([tri2[1], tri2[2]], thickness);
} }
} }
else {
module tri_to_backslash_hull_lines(tri1, tri2) {
hull_polyline3d(concat(tri1, [tri1[0]]), thickness);
if(tri2[1][0] == points[0][columns - 1][0]) { if(tri2[1][0] == points[0][columns - 1][0]) {
hull_polyline3d([tri2[1], tri2[2]], thickness); hull_polyline3d([tri2[1], tri2[2]], thickness);
} }
@@ -206,7 +207,6 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
hull_polyline3d([tri2[0], tri2[2]], thickness); hull_polyline3d([tri2[0], tri2[2]], thickness);
} }
} }
}
module hull_pts(tri) { module hull_pts(tri) {
half_thickness = thickness / 2; half_thickness = thickness / 2;
@@ -224,11 +224,21 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") {
module tri_to_graph(tri1, tri2) { module tri_to_graph(tri1, tri2) {
if(style == "LINES") { if(style == "LINES") {
tri_to_lines(tri1, tri2); if(slicing == "SLASH") {
tri_to_slash_lines(tri1, tri2);
}
else {
tri_to_backslash_lines(tri1, tri2);
}
} else if(style == "HULL_FACES") { // Warning: May be very slow!! } else if(style == "HULL_FACES") { // Warning: May be very slow!!
tri_to_hull_faces(tri1, tri2); tri_to_hull_faces(tri1, tri2);
} else if(style == "HULL_LINES") { // Warning: very very slow!! } else if(style == "HULL_LINES") { // Warning: very very slow!!
tri_to_hull_lines(tri1, tri2); if(slicing == "SLASH") {
tri_to_slash_hull_lines(tri1, tri2);
}
else {
tri_to_backslash_hull_lines(tri1, tri2);
}
} }
} }