I have a set of points that belong to the surface of an object. I would like to approximate a surface to which I can compute the distance. of other points. With the nice code of this post, I was able to reconstruct a RegionBoundary
that already looks quite good and to which I can compute distances using the function RegionDistance
. However, I would like to smooth the surface prior to that a little to get rid of the triangulation effect. Is that possible in Mathematica?
Here is my code so far:
points={{332.503, 164.196, 141.151}, {348.923, 51.3424,
313.257}, {490.391,
392.449, 467.328}, {363.68, 708.575, 494.249}, {243.736, 650.65,
605.863}, {167.854, 502.522, 289.97}, {395.992, 673.63,
412.396}, {442.32, 161.375, 243.053}, {390.402, 565.375,
335.89}, {358.569, 511.312, 623.592}, {365.236, 589.126,
331.892}, {429.451, 717.615, 532.707}, {413.034, 710.258,
586.691}, {417.364, 718.47, 533.964}, {213.105, 390.563,
111.511}, {464.4, 496.675, 611.62}, {413.343, 167.916,
198.667}, {376.796, 122.681, 407.362}, {522.351, 541.699,
596.626}, {125.383, 119.593, 201.679}, {126.66, 624.233,
492.103}, {482.833, 221.833, 369.833}, {323.5, 490.5,
601.5}, {326.623, 487.503, 203.405}, {85.1852, 408.238,
227.059}, {164.74, 128.175, 150.482}, {199.011, 163.751,
400.412}, {346.473, 358.464, 134.96}, {417.547, 386.164,
211.435}, {188.618, 121.412, 360.212}, {435.274, 250.289,
175.814}, {428.463, 412.995, 548.872}, {186.597, 102.459,
336.316}, {522.096, 552.907, 483.329}, {337.035, 175.359,
449.416}, {471.617, 197.544, 370.303}, {163.591, 459.144,
472.713}, {419.946, 513.294, 463.35}, {324.831, 652.026,
617.843}, {184.788, 85.4434, 321.505}, {548.535, 580.905,
576.198}, {134.656, 128.965, 172.655}, {237.601, 660.164,
590.487}, {284.022, 524.141, 353.107}, {98.8513, 261.728,
371.092}, {190.68, 72.2024, 248.625}, {161.724, 263.452,
98.6433}, {262.144, 484.765, 187.801}, {162.9, 96.6219,
200.596}, {132., 530.5, 455.5}, {507.442, 668.656,
486.154}, {274.478, 52.2563, 244.109}, {134.926, 116.117,
303.853}, {306.965, 400.445, 125.187}, {324.457, 149.309,
419.615}, {399.676, 493.375, 315.875}, {179.869, 253.322,
436.796}, {533.897, 546.518, 581.324}, {295.663, 202.435,
102.079}, {376.439, 698.222, 580.886}, {449.935, 516.316,
368.132}, {459.096, 152.561, 324.066}, {470.669, 620.348,
678.3}, {462.584, 464.429, 314.114}, {282.712, 713.11,
562.706}, {152.318, 92.9758, 274.162}, {271.539, 583.09,
301.286}, {268.328, 249.024, 88.3681}, {216.507, 431.065,
130.987}, {423.833, 615.5, 665.}, {380.322, 67.781,
320.736}, {318.34, 644.74, 372.886}, {469.088, 247.028,
445.556}, {540.019, 663.612, 550.982}, {473.462, 220.243,
406.216}, {454.349, 722.933, 522.013}, {66.3225, 346.62,
305.46}, {533.978, 597.711, 660.508}, {530.985, 664.202,
654.597}, {309.46, 195.999, 108.85}, {340.974, 340.319,
552.639}, {422.508, 377.664, 531.371}, {176.511, 76.1966,
258.702}, {316.864, 539.726, 250.176}, {452.391, 332.543,
217.13}, {77.5253, 291.832, 344.741}, {65.3084, 219.931,
261.025}, {492.609, 282.219, 421.681}, {423.923, 541.281,
654.475}, {396.524, 271.286, 514.397}, {199.764, 465.467,
164.648}, {483.527, 684.076, 669.594}, {334.622, 83.9542,
367.422}, {447.46, 517.391, 320.083}, {313.744, 476.67,
288.196}, {456.043, 372.201, 497.113}, {452.812, 717.343,
639.122}, {182.871, 129.579, 366.947}, {512.744, 708.845,
570.144}, {398.484, 643.825, 389.497}, {338.041, 397.561,
148.824}, {430.163, 449.935, 271.511}, {178.483, 230.622,
429.226}, {133.231, 439.313, 178.045}, {291.368, 37.5505,
281.138}, {228.961, 619.735, 356.996}, {255.153, 252.441,
90.1935}, {177.16, 262.151, 93.7874}, {435.71, 409.946,
536.079}, {291.048, 710.772, 536.598}, {128.35, 160.9,
329.05}, {217.215, 158.286, 416.479}, {98.3773, 353.148,
395.072}, {161.267, 151.325, 132.306}, {299.199, 704.953,
483.595}, {208.218, 89.8083, 171.227}, {155.932, 360.6,
113.962}, {377.542, 329.434, 139.294}, {133.498, 289.179,
115.104}, {144.267, 209.748, 384.628}, {337.605, 95.1021,
195.829}, {398.332, 526.418, 282.529}, {129.582, 195.206,
343.11}, {384.721, 155.192, 431.878}, {502.508, 372.431,
437.695}, {183.25, 372.725, 105.853}, {79.5506, 309.299,
177.712}, {271.535, 599.345, 322.607}, {484.1, 563.99,
659.884}, {380.897, 62.2556, 306.81}, {332.349, 452.716,
178.931}, {321.748, 281.535, 533.936}, {486.052, 478.483,
558.862}, {73.247, 335.451, 357.876}, {129.021, 461.992,
323.019}, {456.977, 541.183, 343.661}, {204.329, 445.22,
140.278}, {64.0611, 333.507, 222.09}, {182.534, 455.538,
165.295}, {409.577, 541.794, 458.832}, {305.333, 389.861,
122.394}, {114.483, 213.57, 355.812}, {419.16, 94.7074,
290.175}, {492.161, 671.952, 468.522}, {491., 340.5,
375.5}, {190.721, 473.554, 174.632}, {136.751, 312.101,
112.785}, {459.361, 161.687, 315.93}, {407.247, 653.559,
403.558}, {186.03, 602.83, 562.473}, {334.885, 108.839,
174.74}, {246.925, 474.024, 166.894}, {281.17, 149.913,
418.593}, {397.248, 95.3347, 356.886}, {394.297, 696.328,
453.213}, {500.71, 705.105, 508.737}, {412.611, 694.597,
448.127}, {294.526, 594.958, 626.525}, {64.4193, 256.905,
315.282}, {452.617, 355.839, 491.916}, {341.5, 277.5,
339.5}, {178.243, 513.525, 304.626}, {422.617, 431.838,
246.101}, {166.68, 204.558, 98.5556}, {493.511, 334.357,
398.033}, {535.079, 573.321, 528.362}, {99.2974, 228.613,
355.421}, {479.43, 304.942, 377.161}, {74.7139, 264.505,
332.803}, {215.939, 687.911, 552.374}, {126.787, 360.173,
138.291}, {237.003, 463.761, 157.922}, {220.743, 275.657,
478.56}, {540.747, 590.994, 617.299}, {457.626, 690.456,
668.88}, {346.502, 563.064, 631.524}, {371.636, 604.184,
326.928}, {387.425, 365.146, 331.925}, {157.388, 436.461,
465.652}, {254.299, 625.72, 616.211}, {208.19, 59.1733,
260.456}, {431.631, 236.662, 175.146}, {505.25, 714.826,
561.175}, {343.983, 108.241, 186.74}, {191.833, 341.325,
101.09}, {398.674, 520.09, 639.57}, {464.716, 487.783,
317.067}, {281.041, 469.01, 565.012}, {142.306, 360.143,
438.263}, {351.655, 247.073, 519.403}, {170.277, 88.3455,
216.392}, {413.748, 402.202, 549.435}, {458.967, 206.176,
274.538}, {416.928, 215.009, 173.625}, {537.722, 558.167,
569.611}, {315.152, 106.21, 164.028}, {533.505, 689.304,
600.623}, {479.376, 222.006, 389.264}, {264.487, 425.758,
131.793}, {225.421, 328.948, 99.5791}, {261.952, 673.365,
413.775}, {195.493, 103.461, 355.152}, {231.74, 572.119,
594.118}, {140.627, 475.714, 449.734}, {359.23, 710.85,
507.043}, {262.531, 444.415, 546.021}, {185.498, 323.012,
96.9038}, {224.533, 203.809, 85.3744}, {437.381, 324.328,
491.04}, {480.57, 433.744, 362.794}, {355.361, 67.347,
336.442}, {217.99, 391.647, 515.415}, {540.946, 617.038,
567.645}, {502.332, 573.604, 659.474}, {374.332, 432.322,
587.396}, {463.168, 480.326, 590.313}, {394.63, 467.399,
603.823}, {264.35, 403.419, 117.151}, {346.891, 597.698,
313.165}, {169.98, 672.394, 528.013}, {362.997, 558.273,
286.68}, {476.326, 449.697, 528.007}, {413.973, 145.108,
412.639}, {409.848, 594.467, 665.}, {450.982, 442.75,
288.465}, {301.072, 434.966, 155.1}, {285.826, 699.773,
478.549}, {252.641, 669.257, 594.078}, {125.053, 533.84,
399.501}, {396.53, 364.873, 177.542}, {230.073, 537.97,
580.132}, {206.656, 244.125, 446.061}, {375.37, 593.391,
350.296}, {74.0148, 236.789, 182.9}, {291.077, 490.511,
193.363}, {286.015, 291.667, 97.3073}, {149.436, 544.798,
499.933}, {323.634, 684.378, 593.344}, {368.638, 519.239,
256.217}, {242.973, 504.349, 555.061}, {301.526, 326.531,
545.819}, {378.5, 250.5, 517.5}, {160.564, 93.2396,
236.522}, {303.995, 217.386, 487.886}, {226.711, 329.956,
504.41}, {426.731, 146.269, 388.805}, {294.901, 514.185,
593.423}, {398.014, 213.422, 162.224}, {136.987, 309.181,
424.141}, {485.625, 434.403, 506.073}, {230.109, 170.578,
96.7482}, {465.5, 332.026, 278.395}, {336.793, 412.442,
164.347}, {202.985, 150.554, 116.793}, {351.931, 545.145,
413.645}, {343.885, 211.189, 485.308}, {122.871, 588.535,
433.515}, {187.455, 91.3415, 184.823}, {166.521, 416.539,
470.903}, {204.11, 593.06, 574.68}, {265.075, 594.426,
619.541}, {452.063, 246., 201.813}, {465.412, 237.152,
297.139}, {240.944, 106.154, 381.972}, {353.572, 447.899,
586.648}, {522.052, 557.929, 493.308}, {311.55, 429.929,
357.58}, {319.981, 241.79, 511.625}, {476.672, 319.88,
347.519}, {238.982, 559.259, 596.398}, {399.093, 69.3107,
291.765}, {169.397, 549.109, 521.505}, {470.536, 193.502,
352.944}, {317.966, 47.6604, 322.474}, {143.012, 486.259,
350.939}, {420.848, 227.378, 472.659}, {404.146, 369.319,
540.621}, {64.1053, 355.509, 246.877}, {147.585, 489.587,
476.16}, {458.526, 352.185, 248.103}, {206.466, 320.92,
89.4909}, {434.343, 481.018, 296.823}, {526.201, 698.731,
589.809}, {411.551, 553.276, 457.865}, {291.794, 192.563,
99.4244}, {203.358, 221.116, 83.4906}, {440.474, 163.383,
386.538}, {263.945, 625.913, 622.092}, {489.832, 285.927,
405.232}, {382.544, 117.677, 199.491}, {428.025, 184.286,
442.893}, {120.932, 415.094, 172.843}, {481.989, 613.07,
411.532}, {168.744, 675.017, 464.142}, {114.266, 578.017,
436.803}, {69.718, 336.308, 336.153}, {91.5466, 356.125,
381.752}, {142.674, 315.79, 434.314}, {384.731, 703.292,
568.911}, {289.231, 500.734, 585.946}, {207.223, 283.139,
81.2631}, {281.496, 254.194, 85.6419}, {355.967, 109.122,
394.74}, {136.192, 540.732, 383.402}, {316.21, 313.956,
540.89}, {470.587, 526.275, 634.853}, {412.395, 181.916,
452.023}, {426.78, 172.23, 211.919}, {507.751, 568.654,
426.941}, {149.569, 623.632, 521.702}, {522.053, 596.565,
504.43}, {445.641, 705.644, 649.868}, {500.051, 406.023,
475.83}, {105.289, 339.366, 139.709}, {222.8, 503.209,
545.567}, {297.5, 643.5, 376.5}, {463.572, 302.651,
294.815}, {415.034, 435.488, 575.195}, {498.5, 360.5,
400.}, {367.731, 76.8686, 228.275}, {436.326, 205.537,
203.732}, {108.407, 435.677, 301.792}, {387.129, 144.66,
425.169}, {148.846, 512.783, 363.248}, {294.524, 651.253,
615.102}, {276.824, 704.882, 511.993}, {508.925, 697.127,
510.355}, {141.179, 414.772, 152.592}, {150.37, 567.084,
509.542}, {84.3222, 302.445, 373.23}, {273.708, 41.1934,
279.497}, {485.783, 687.985, 472.139}, {418.472, 586.365,
350.806}, {386.808, 215.734, 488.399}, {126.574, 496.53,
407.109}, {303.003, 654.552, 404.317}, {388.631, 170.323,
178.592}, {60.4691, 336.622, 241.461}, {428.305, 674.971,
665.598}, {518.182, 700.236, 638.253}, {88.6092, 377.561,
191.29}, {423.423, 624.851, 666.516}, {240.297, 398.662,
532.676}, {523.881, 581.634, 492.541}, {449.386, 135.94,
284.265}, {439.936, 449.785, 566.978}, {414.277, 640.763,
387.472}, {398.379, 439.852, 302.649}, {484.849, 479.907,
424.759}, {440.677, 121.274, 295.239}, {416.527, 267.518,
156.597}, {401.412, 246.088, 496.816}, {100.868, 301.862,
145.398}, {164.918, 555.291, 338.842}, {226.951, 86.2575,
169.979}, {270.096, 429.629, 556.755}, {324.274, 302.205,
538.657}, {505.481, 638.917, 682.089}, {445.715, 307.064,
475.054}, {325.905, 527.296, 301.779}, {447.016, 549.909,
654.356}, {315.762, 262.642, 97.9202}, {465.574, 636.244,
424.755}, {322.15, 44.2332, 297.187}, {144.483, 569.34,
381.592}, {476.269, 435.466, 338.904}, {152.225, 250.834,
105.101}, {147.297, 646.674, 439.411}, {179.087, 75.9104,
234.857}, {200.5, 643.783, 581.387}, {398.5, 637.5,
660.5}, {317.109, 376.517, 122.095}, {279.5, 620.5,
331.5}, {450.519, 499.27, 620.204}, {328.457, 544.796,
407.331}, {182.109, 681.355, 535.461}, {493.527, 268.575,
406.779}, {82.5982, 257.48, 172.835}, {350.153, 338.745,
119.873}, {400.21, 550.948, 333.729}, {120.346, 465.473,
249.646}, {465.946, 654.168, 434.657}, {401.335, 80.3895,
269.898}, {538.983, 677.564, 597.956}, {58.3805, 232.11,
272.752}, {453.374, 382.883, 263.261}, {82.5445, 281.768,
359.469}, {446.729, 558.359, 374.242}, {410.445, 516.859,
334.516}, {176.856, 415.792, 482.154}, {436.088, 540.186,
324.808}, {196.898, 350.806, 488.46}, {396.196, 545.086,
649.558}, {123.005, 591.694, 479.867}, {457.174, 387.679,
504.738}, {153.219, 656.382, 523.696}, {59.2334, 295.899,
220.902}, {124.963, 121.402, 251.698}, {534.829, 526.5,
549.174}, {550.326, 665.396, 593.728}, {339.988, 130.166,
168.475}, {536.55, 571.686, 618.421}, {232.326, 59.1984,
314.72}, {380.804, 351.925, 547.686}, {276.004, 70.8784,
358.826}, {232.793, 123.093, 129.862}, {286.786, 190.997,
456.244}, {94.6846, 415.523, 322.478}, {105.193, 140.028,
250.066}, {237.678, 169.138, 421.162}, {378.5, 143.,
185.}, {161.642, 326.999, 444.955}, {482.498, 242.721,
379.422}, {224.029, 691.288, 449.137}, {477.435, 654.835,
450.421}, {94.5795, 306.593, 386.7}, {468.979, 408.487,
501.844}, {423.371, 100.292, 327.401}, {480.5, 465.,
346.5}, {323.585, 515.242, 230.547}, {459.792, 286.323,
260.46}, {62.7555, 308.083, 204.032}, {500.854, 401.473,
441.756}, {81.0766, 383.639, 240.022}, {328.847, 52.4033,
255.453}, {247.308, 529.708, 241.989}, {396.523, 329.156,
140.38}, {373.781, 697.713, 453.124}, {396.283, 510.121,
315.124}, {411.984, 672.331, 652.537}, {221.641, 420.895,
520.734}, {482.596, 312.939, 354.171}, {343.149, 414.295,
435.363}, {298.648, 39.1472, 294.322}, {343.22, 299.867,
542.947}, {182.697, 152.604, 117.336}, {138.374, 250.48,
112.115}, {375.778, 76.5993, 336.997}, {448.296, 558.052,
341.102}, {128.403, 484.19, 394.699}, {438.29, 263.278,
471.922}, {344.64, 377.915, 148.744}, {484.255, 711.123,
508.443}, {77.4254, 354.931, 194.897}, {168.573, 675.309,
484.661}, {93.4348, 263.235, 153.051}, {186.112, 501.935,
263.001}, {388.68, 450.638, 293.253}, {229.242, 384.352,
523.155}, {323.999, 74.537, 207.705}, {411.458, 388.617,
196.079}, {191.506, 216.82, 430.611}, {53.8916, 299.694,
281.102}, {126., 457., 330.}, {504.341, 658.829, 575.953}, {293.63,
227.978, 498.81}, {300.635, 471.031, 296.168}, {145.753, 195.687,
106.72}, {322.311, 406.461, 346.703}, {197.173, 686.613,
466.436}, {459., 294.5, 232.}, {78.3771, 182.069, 215.053}, {316.42,
573.076, 315.042}, {209.413, 612.93, 598.49}, {428.847, 385.819,
536.264}, {83.2919, 180.975, 183.579}, {125.706, 275.496,
114.538}, {385.373, 166.013, 443.243}, {357.619, 178.287,
147.039}, {136.611, 235.835, 390.861}, {191.367, 331.207,
470.341}, {85.4225, 403.602, 327.865}, {325.667, 693.033,
583.098}, {514.3, 508.9, 468.5}, {379.964, 302.471,
136.966}, {425.161, 665.836, 411.877}, {322.001, 493.219,
424.654}, {462.658, 176.053, 324.446}, {228.608, 401.169,
522.613}, {146.677, 393.634, 135.842}, {390.875, 498.59,
626.572}, {489.97, 665.369, 673.809}, {520.1, 457.953,
480.554}, {84.5, 386.5, 345.5}, {138.649, 258.408,
406.563}, {371.64, 212.815, 494.77}, {307.122, 675.18,
597.133}, {247.109, 46.5854, 278.052}, {264.061, 679.727,
438.011}, {271.048, 489.114, 570.545}, {216.598, 641.574,
369.696}, {499.699, 390.046, 441.895}, {208.416, 402.902,
505.952}, {263.147, 713.229, 523.117}, {513.056, 562.495,
455.919}, {229.306, 534.749, 294.441}, {499.753, 479.377,
428.603}, {104.833, 355.833, 148.5}, {416.21, 487.907,
616.249}, {161.197, 101.501, 319.324}};
Then I approximate a surface using the code for alpha shapes:
surface = RegionBoundary @ alphaShapes[points, 150]
I checked for BSplineSurface
, but the function needs a structured array of control points which I do not have. Any ideas how to smooth the surface? Or is there a way to use the function BSplineSurface
for that?
alphaShapes
$\endgroup$surface
seems to still have interior components:Show[surface, Axes -> True, ClipPlanes -> {{1, 1, 0, -500}}]
. -- If you want it merely to look smoother, considerVertexNormals
. $\endgroup$