misc bugfixes

This commit is contained in:
Adrian Mariano 2021-10-06 21:53:46 -04:00
parent bb77faa0c9
commit 33484f2c4b
4 changed files with 12 additions and 10 deletions

View file

@ -977,15 +977,12 @@ module trace_bezier(bez, width=1, N=3) {
stroke(bezier_path(bez, N=N), width=width, color="cyan");
color("green")
if (N!=3)
stroke(path3d(path), width=size);
stroke(path3d(path), width=width);
else
for(i=[1:3:len(bez)]) stroke(select(bez,max(0,i-2), min(len(bez)-1,i)), width=width);
twodim = len(bez[0])==2;
move_copies(bez)
if ($idx % N ==0)
color("blue") if (twodim) circle(d=width*2.5); else sphere(d=width*2.5);
else
color("red")
color("red") move_copies(bez)
if ($idx % N !=0)
if (twodim){
rect([width/2, width*3],center=true);
rect([width*3, width/2],center=true);
@ -994,6 +991,11 @@ module trace_bezier(bez, width=1, N=3) {
xcyl(d=width/2, h=width*3);
ycyl(d=width/2, h=width*3);
}
color("blue") move_copies(bez)
if ($idx % N ==0)
if (twodim) circle(d=width*2.25); else sphere(d=width*2.25);
if (twodim) color("red") move_copies(bez)
if ($idx % N !=0) circle(d=width/2);
}

View file

@ -211,7 +211,7 @@ function path_length_fractions(path, closed=false) =
/// // isects == [[[-33.3333, 0], 0, 0.666667, 4, 0.333333], [[33.3333, 0], 1, 0.333333, 3, 0.666667]]
/// stroke(path, closed=true, width=1);
/// for (isect=isects) translate(isect[0]) color("blue") sphere(d=10);
function _path_self_intersections5(path, closed=true, eps=EPSILON) =
function _path_self_intersections(path, closed=true, eps=EPSILON) =
let(
path = closed ? close_path(path,eps=eps) : path,
plen = len(path)

View file

@ -265,7 +265,7 @@ function split_path_at_region_crossings(path, region, closed=true, eps=EPSILON)
// components intersect each other.
// Example(2D,NoAxes):
// R = [for(i=[1:7]) square(i,center=true)];
// region_list = split_nested_region(R);
// region_list = region_parts(R);
// rainbow(region_list) region($item);
// Example(2D,NoAxes):
// R = [back(7,square(3,center=true)),
@ -273,7 +273,7 @@ function split_path_at_region_crossings(path, region, closed=true, eps=EPSILON)
// left(5,square(8,center=true)),
// for(i=[4:2:8])
// right(5,square(i,center=true))];
// region_list = split_nested_region(R);
// region_list = region_parts(R);
// rainbow(region_list) region($item);
function region_parts(region) =
let(

View file

@ -1105,7 +1105,7 @@ function sweep(shape, transforms, closed=false, caps, style="min_edge") =
assert(capsOK, "caps must be boolean or a list of two booleans")
assert(!closed || !caps, "Cannot make closed shape with caps")
is_region(shape)? let(
regions = split_nested_region(shape),
regions = region_parts(shape),
rtrans = reverse(transforms),
vnfs = [
for (rgn=regions) each [