BelfrySCAD / BOSL2

The Belfry OpenScad Library, v2.0. An OpenSCAD library of shapes, masks, and manipulators to make working with OpenSCAD easier. BETA
https://github.com/BelfrySCAD/BOSL2/wiki
BSD 2-Clause "Simplified" License
1.01k stars 115 forks source link

deduplicate does not remove a repeated start and end point #1413

Closed roguesmo closed 7 months ago

roguesmo commented 7 months ago

Describe the bug Deduplicate doesn't remove a repeat point if it is the first and last point in the array. It would be great if it would do this!

Code To Reproduce Bug

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>
include <BOSL2/comparisons.scad>

orig_path = [[0, 0], [0, 5], [5, 0], [0, 0]];

new_path = deduplicate(deduplicate(orig_path));

// debug output showing array unchanged
echo (new_path);

// this fails due to duplicate point
offset_sweep(new_path, height=3, top=os_circle(r=1), bottom=os_circle(r=0), steps=15);

Expected behavior The repeated origin/end point should be removed, preventing the "repeated points" error caused by offset_sweep

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

roguesmo commented 7 months ago

Found the "closed" option for the function, not sure how to delete bug report...