JustinSDK / dotSCAD

Reduce the burden of mathematics when playing OpenSCAD
https://openhome.cc/zh-tw/openscad/
GNU Lesser General Public License v3.0
784 stars 107 forks source link

Remove excess point at the end of the bezier_curve() output #2

Closed lorf closed 6 years ago

lorf commented 6 years ago

bezier_curve() produces an excess point at the end of the output array. This may cause undesirable effects when the output is fed to e.g. path_extrude(): image

Proposed fix attached and seems to work: image

The code to reproduce:

include <../src/bezier_curve.scad>;

curve_pts = [[5,5,0],[10,10,10],[20,20,20]];
path_pts = bezier_curve(0.1,curve_pts);
echo(path_pts=path_pts); // See the output

include <../src/polysections.scad>;
include <../src/rotate_p.scad>;
include <../src/path_extrude.scad>;

shape_pts = [[5, -5], [5, 5], [-5, 5], [-5, -5]]; // 10mm square
path_extrude(shape_pts,path_pts,triangles="SOLID");