Fixed trace_bezier_patch to correct fatal error and modified it so it

only calculates the vnf when needed, as this can be slow.
This commit is contained in:
Adrian Mariano 2020-05-21 15:52:44 -04:00
parent 30c63fd165
commit 83ed788ac6

View file

@ -1262,11 +1262,6 @@ module trace_bezier_patches(patches=[], size, splinesteps=16, showcps=true, show
assert(is_bool(showdots));
assert(is_bool(showpatch));
assert(is_int(convexity) && convexity>0);
vnfs = [
for (patch = patches)
bezier_patch(patch, splinesteps=splinesteps, style=style)
];
if (showcps || showdots) {
for (patch = patches) {
size = is_num(size)? size :
let( bounds = pointlist_bounds(flatten(patch)) )
@ -1288,16 +1283,13 @@ module trace_bezier_patches(patches=[], size, splinesteps=16, showcps=true, show
}
}
}
if (showdots){
color("blue") move_copies(vnfs[i][0]) sphere(d=size);
if (showpatch || showdots){
vnf = bezier_patch(patch, splinesteps=splinesteps, style=style);
if (showpatch) vnf_polyhedron(vnf, convexity=convexity);
if (showdots) color("blue") move_copies(vnf[0]) sphere(d=size);
}
}
}
if (showpatch) {
vnf_polyhedron(vnfs, convexity=convexity);
}
}
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap