1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 22:05:27 +02:00

elaborate saddle 2121

This commit is contained in:
Justin Lin
2021-01-08 09:10:13 +08:00
parent 7d333ea247
commit d7fddc3a0b

View File

@@ -21,7 +21,7 @@ function interpolated_pt(p0, p1, threshold) =
function _isolines_pn_label(pts, threshold) = function _isolines_pn_label(pts, threshold) =
[ [
for(row = pts) for(row = pts)
[for(p = row) [p[0], p[1], p[2], p[2] - threshold >= 0]] [for(p = row) [p[0], p[1], p[2], p[2] >= threshold]]
]; ];
function _isolines_corner_value(cell_pts) = function _isolines_corner_value(cell_pts) =
@@ -587,7 +587,7 @@ function _case2020_isobands(cell_pts, lower, upper) =
interpolated_pt(cell_pts[3], center_p, lower) interpolated_pt(cell_pts[3], center_p, lower)
] ]
] : ] :
center_p_z >= lower && center_p_z < upper ? [ center_p_z >= lower && center_p_z <= upper ? [
[ [
interpolated_pt(cell_pts[0], cell_pts[1], lower), interpolated_pt(cell_pts[0], cell_pts[1], lower),
interpolated_pt(cell_pts[0], center_p, lower), interpolated_pt(cell_pts[0], center_p, lower),
@@ -644,7 +644,7 @@ function _case0202_isobands(cell_pts, lower, upper) =
interpolated_pt(cell_pts[1], cell_pts[2], upper) interpolated_pt(cell_pts[1], cell_pts[2], upper)
] ]
] : ] :
center_p_z >= lower && center_p_z < upper ? [ center_p_z >= lower && center_p_z <= upper ? [
[ [
interpolated_pt(cell_pts[0], cell_pts[1], upper), interpolated_pt(cell_pts[0], cell_pts[1], upper),
interpolated_pt(cell_pts[0], center_p, upper), interpolated_pt(cell_pts[0], center_p, upper),
@@ -697,7 +697,7 @@ function _case0101_isobands(cell_pts, lower, upper) =
interpolated_pt(cell_pts[1], cell_pts[2], lower) interpolated_pt(cell_pts[1], cell_pts[2], lower)
] ]
] : ] :
center_p_z >= lower && center_p_z < upper ? [ center_p_z >= lower && center_p_z <= upper ? [
[ [
[cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]], [cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]],
interpolated_pt(cell_pts[0], cell_pts[3], lower), interpolated_pt(cell_pts[0], cell_pts[3], lower),
@@ -750,7 +750,7 @@ function _case1010_isobands(cell_pts, lower, upper) =
interpolated_pt(cell_pts[2], cell_pts[3], lower) interpolated_pt(cell_pts[2], cell_pts[3], lower)
] ]
] : ] :
center_p_z >= lower && center_p_z < upper ? [ center_p_z >= lower && center_p_z <= upper ? [
[ [
interpolated_pt(cell_pts[0], center_p, lower), interpolated_pt(cell_pts[0], center_p, lower),
interpolated_pt(cell_pts[0], cell_pts[3], lower), interpolated_pt(cell_pts[0], cell_pts[3], lower),
@@ -784,30 +784,56 @@ function _case1010_isobands(cell_pts, lower, upper) =
] ]
]; ];
function _case2121_isobands(cell_pts, threshold) = function _case2121_isobands(cell_pts, lower, upper) =
let( let(
center_p = (cell_pts[0] + cell_pts[1] + cell_pts[2] + cell_pts[3]) / 4, center_p = (cell_pts[0] + cell_pts[1] + cell_pts[2] + cell_pts[3]) / 4,
center_p_z = center_p[2] center_p_z = center_p[2]
) )
center_p_z < threshold ? [ center_p_z < lower ? [
[
interpolated_pt(cell_pts[1], cell_pts[2], upper),
interpolated_pt(cell_pts[1], center_p, upper),
interpolated_pt(cell_pts[1], center_p, lower),
interpolated_pt(cell_pts[2], center_p, lower),
interpolated_pt(cell_pts[3], center_p, lower),
interpolated_pt(cell_pts[3], center_p, upper),
interpolated_pt(cell_pts[2], cell_pts[3], upper),
[cell_pts[2][0], cell_pts[2][1], cell_pts[2][2]]
],
[
interpolated_pt(cell_pts[1], center_p, upper),
interpolated_pt(cell_pts[0], cell_pts[1], upper),
[cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]],
interpolated_pt(cell_pts[0], cell_pts[3], upper),
interpolated_pt(cell_pts[3], center_p, upper),
interpolated_pt(cell_pts[3], center_p, lower),
interpolated_pt(cell_pts[0], center_p, lower),
interpolated_pt(cell_pts[1], center_p, lower)
]
] :
center_p_z >= lower && center_p_z <= upper ? [
[ [
[cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]], [cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]],
interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[0], cell_pts[3], upper),
interpolated_pt(cell_pts[2], cell_pts[3], threshold), interpolated_pt(cell_pts[0], center_p, upper),
interpolated_pt(cell_pts[2], cell_pts[3], upper),
[cell_pts[2][0], cell_pts[2][1], cell_pts[2][2]], [cell_pts[2][0], cell_pts[2][1], cell_pts[2][2]],
interpolated_pt(cell_pts[1], cell_pts[2], threshold), interpolated_pt(cell_pts[1], cell_pts[2], upper),
interpolated_pt(cell_pts[0], cell_pts[1], threshold) interpolated_pt(cell_pts[1], center_p, upper),
interpolated_pt(cell_pts[0], cell_pts[1], upper)
] ]
] : [ ] : [
[ [
[cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]], [cell_pts[0][0], cell_pts[0][1], cell_pts[0][2]],
interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[0], cell_pts[3], upper),
interpolated_pt(cell_pts[0], cell_pts[1], threshold) interpolated_pt(cell_pts[0], center_p, upper),
interpolated_pt(cell_pts[0], cell_pts[1], upper)
], ],
[ [
interpolated_pt(cell_pts[2], cell_pts[3], threshold), interpolated_pt(cell_pts[2], cell_pts[3], upper),
[cell_pts[2][0], cell_pts[2][1], cell_pts[2][2]], [cell_pts[2][0], cell_pts[2][1], cell_pts[2][2]],
interpolated_pt(cell_pts[1], cell_pts[2], threshold) interpolated_pt(cell_pts[1], cell_pts[2], upper),
interpolated_pt(cell_pts[2], center_p, upper)
] ]
]; ];
@@ -1150,7 +1176,7 @@ function _isobands_of(cell_pts, lower, upper) =
cv == "0202" ? _case0202_isobands(cell_pts, lower, upper) : cv == "0202" ? _case0202_isobands(cell_pts, lower, upper) :
cv == "0101" ? _case0101_isobands(cell_pts, lower, upper) : cv == "0101" ? _case0101_isobands(cell_pts, lower, upper) :
cv == "1010" ? _case1010_isobands(cell_pts, lower, upper) : cv == "1010" ? _case1010_isobands(cell_pts, lower, upper) :
cv == "2121" ? _case2121_isobands(cell_pts, upper) : cv == "2121" ? _case2121_isobands(cell_pts, lower, upper) :
cv == "1212" ? _case1212_isobands(cell_pts, upper) : cv == "1212" ? _case1212_isobands(cell_pts, upper) :
cv == "2120" ? _case2120_isobands(cell_pts, lower, upper) : cv == "2120" ? _case2120_isobands(cell_pts, lower, upper) :
cv == "0102" ? _case0102_isobands(cell_pts, lower, upper) : cv == "0102" ? _case0102_isobands(cell_pts, lower, upper) :