From f6e553ca1b96f00f8b58756e60c6a1f9612f3ccb Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 7 Jan 2021 16:30:57 +0800 Subject: [PATCH] elaborate saddle points --- src/_impl/_contours_impl.scad | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/_impl/_contours_impl.scad b/src/_impl/_contours_impl.scad index 225e79c5..0391238c 100644 --- a/src/_impl/_contours_impl.scad +++ b/src/_impl/_contours_impl.scad @@ -50,16 +50,16 @@ function _case4_isolines(cell_pts, threshold) = [ ]; function _case5_isolines(cell_pts, threshold) = - let(center_p_z = (cell_pts[0][2] + cell_pts[1][2] + cell_pts[2][2] + cell_pts[3][2]) / 4) - center_p_z >= threshold ? + let(center_p = (cell_pts[0] + cell_pts[1] + cell_pts[2] + cell_pts[3]) / 4) + center_p[2] >= threshold ? [ - [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[1], cell_pts[2], threshold)], - [interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] + [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[1], center_p, threshold), interpolated_pt(cell_pts[1], cell_pts[2], threshold)], + [interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[3], center_p, threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] ] : [ - [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[0], cell_pts[3], threshold)], - [interpolated_pt(cell_pts[1], cell_pts[2], threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] + [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[0], center_p, threshold), interpolated_pt(cell_pts[0], cell_pts[3], threshold)], + [interpolated_pt(cell_pts[1], cell_pts[2], threshold), interpolated_pt(cell_pts[2], center_p, threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] ]; function _case6_isolines(cell_pts, threshold) = [ @@ -75,16 +75,16 @@ function _case8_isolines(cell_pts, threshold) = _case7_isolines(cell_pts, thresh function _case9_isolines(cell_pts, threshold) = _case6_isolines(cell_pts, threshold); function _case10_isolines(cell_pts, threshold) = - let(center_p_z = (cell_pts[0][2] + cell_pts[1][2] + cell_pts[2][2] + cell_pts[3][2]) / 4) - center_p_z >= threshold ? + let(center_p = (cell_pts[0] + cell_pts[1] + cell_pts[2] + cell_pts[3]) / 4) + center_p[2] >= threshold ? [ - [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[0], cell_pts[3], threshold)], - [interpolated_pt(cell_pts[1], cell_pts[2], threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] + [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[1], center_p, threshold), interpolated_pt(cell_pts[0], cell_pts[3], threshold)], + [interpolated_pt(cell_pts[1], cell_pts[2], threshold), interpolated_pt(cell_pts[2], center_p, threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] ] : [ - [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[1], cell_pts[2], threshold)], - [interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] + [interpolated_pt(cell_pts[0], cell_pts[1], threshold), interpolated_pt(cell_pts[1], center_p, threshold), interpolated_pt(cell_pts[1], cell_pts[2], threshold)], + [interpolated_pt(cell_pts[0], cell_pts[3], threshold), interpolated_pt(cell_pts[3], center_p, threshold), interpolated_pt(cell_pts[2], cell_pts[3], threshold)] ]; function _case11_isolines(cell_pts, threshold) = _case4_isolines(cell_pts, threshold);