Merge pull request #1491 from adrianVmariano/master

egg fix
This commit is contained in:
Revar Desmera 2024-10-14 22:39:12 -07:00 committed by GitHub
commit 7266323b92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 30 deletions

View file

@ -908,7 +908,7 @@ function _make_anchor_legal(anchor,geom) =
// rmax = is_vector(r) ? r[1] : r; // rmax = is_vector(r) ? r[1] : r;
// layers = [for(z=[0:steps]) // layers = [for(z=[0:steps])
// let( // let(
// r=rmin+(rmax-rmin)/2*(cos(z*360*cycles/steps)+1),ff=echo(r=r) // r=rmin+(rmax-rmin)/2*(cos(z*360*cycles/steps)+1)
// ) // )
// path3d( concat([[0,0]], // path3d( concat([[0,0]],
// arc(corner=path2d([BACK,CTR,RIGHT]), n=n, r=r)), // arc(corner=path2d([BACK,CTR,RIGHT]), n=n, r=r)),
@ -3991,29 +3991,6 @@ function _find_anchor(anchor, geom)=
) )
assert(len(final[1])==2, "invalid!") assert(len(final[1])==2, "invalid!")
final, final,
/*[column(facelists,0), column(facelists
face1 = _vnf_find_edge_faces(vnf,[match1[0],match2[0]]),
face2 = _vnf_find_edge_faces(vnf,[match1[0],match2[1]]),
face1a = _vnf_find_edge_faces(vnf,[match1[1],match2[0]]),
face2a = _vnf_find_edge_faces(vnf,[match1[1],match2[1]]),
feet= echo(facelist1 =select(vnf[1],face1a), facelist2=select(vnf[1],face2a)),
edge1 = [match1[0], face1==[] ? match2[1] : match2[0]],
edge2 = list_remove_values(idxs,edge1),
fee=echo(edxs=idxs, edge1=edge1, edge2=edge2,alt=[match1[1],match2[0]],[match1[1],match2[1]],
edgefaces = _vnf_find_edge_faces(vnf,edge1),_vnf_find_edge_faces(vnf,edge2) ),
face3 = _vnf_find_edge_faces(vnf,edge2),
allfaces = concat(face1,face2,face3),
f=echo(pts=pts,matchind=matchind,match1=match1,match2=match2,face1=face1,face2=face2,face3=face3,edge1=edge1,edge2=edge2,face1a=face1a,face2a=face2a)
)
assert(len(allfaces)==2, str("Invalid polyhedron encountered while computing VNF anchor",len(allfaces)))
[[edge1,edge2], allfaces],*/
// fe=echo(edge_faces=edges_faces),
dir = len(idxs)>2 && edges_faces==[] ? [anchor,oang] dir = len(idxs)>2 && edges_faces==[] ? [anchor,oang]
: edges_faces!=[] ? : edges_faces!=[] ?
let( let(
@ -4024,7 +4001,6 @@ feet= echo(facelist1 =select(vnf[1],face1a), faceli
projnormals = project_plane(point4d(cross(facenormals[0],facenormals[1])), facenormals), projnormals = project_plane(point4d(cross(facenormals[0],facenormals[1])), facenormals),
ang = 180- posmod(v_theta(projnormals[1])-v_theta(projnormals[0]),360), ang = 180- posmod(v_theta(projnormals[1])-v_theta(projnormals[0]),360),
horiz_face = [for(i=[0:1]) if (approx(v_abs(facenormals[i]),UP)) i], horiz_face = [for(i=[0:1]) if (approx(v_abs(facenormals[i]),UP)) i],
fda= echo(horiz=horiz_face),
spin = horiz_face==[] ? spin = horiz_face==[] ?
let( let(
edgedir = edge[1]-edge[0], edgedir = edge[1]-edge[0],

View file

@ -817,7 +817,7 @@ function _point_dist(path,pathseg_unit,pathseg_len,pt) =
// When `closed=true` (the default), the input is treated as a polygon. If the input is a region it is treated as a collection // When `closed=true` (the default), the input is treated as a polygon. If the input is a region it is treated as a collection
// of polygons. In this case, positive offset values make the shape larger. If you set `closed=false` then the input is treated as a path // of polygons. In this case, positive offset values make the shape larger. If you set `closed=false` then the input is treated as a path
// with distinct start and end points. For paths, positive offsets shifts the path to the left, relative to the direction of the path. // with distinct start and end points. For paths, positive offsets shifts the path to the left, relative to the direction of the path.
// Note that a path that happens to end at its starting point is not the same as a polygon and the offset result may differ. // Note that a path that happens to end at its starting point is not the same as a polygon and the offset result may differ and the ends.
// . // .
// If you use `delta` without chamfers, the path must not include any 180 degree turns, where the path // If you use `delta` without chamfers, the path must not include any 180 degree turns, where the path
// reverses direction. Such reversals result in an offset with two parallel segments, so they cannot be // reverses direction. Such reversals result in an offset with two parallel segments, so they cannot be

View file

@ -2095,9 +2095,9 @@ function _rp_compute_patches(top, bot, rtop, rsides, ktop, ksides, concave) =
// top = 2d or 3d path describing top polygon (must be the same dimension as bottom) // top = 2d or 3d path describing top polygon (must be the same dimension as bottom)
// --- // ---
// height/length/h/l = height of the shape when you give 2d bottom // height/length/h/l = height of the shape when you give 2d bottom
// joint_top = rounding length for top (number or 2-vector). Default: 0 // joint_top = joint distance or [joint,k] pair for top roundover (number or 2-vector). Default: 0
// joint_bot = rounding length for bottom (number or 2-vector). Default: 0 // joint_bot = joint distance or [joint,k] for bottom roundover (number or 2-vector). Default: 0
// joint_sides = rounding length for side edges, a number/2-vector or list of them. Default: 0 // joint_sides = joint distance or [joint,k] for rounding of side edges, a number/2-vector or list of them. Default: 0
// k = continuous curvature rounding parameter for all edges. Default: 0.5 // k = continuous curvature rounding parameter for all edges. Default: 0.5
// k_top = continuous curvature rounding parameter for top // k_top = continuous curvature rounding parameter for top
// k_bot = continuous curvature rounding parameter for bottom // k_bot = continuous curvature rounding parameter for bottom

View file

@ -1472,7 +1472,7 @@ function egg(length, r1, r2, R, d1, d2, D, anchor=CENTER, spin=0) =
let( let(
r1 = get_radius(r1=r1,d1=d1), r1 = get_radius(r1=r1,d1=d1),
r2 = get_radius(r1=r2,d1=d2), r2 = get_radius(r1=r2,d1=d2),
D = get_radius(r1=R, d1=D) R = get_radius(r1=R, d1=D)
) )
assert(length>0) assert(length>0)
assert(R>length/2, "Side radius R must be larger than length/2") assert(R>length/2, "Side radius R must be larger than length/2")
@ -1500,6 +1500,8 @@ function egg(length, r1, r2, R, d1, d2, D, anchor=CENTER, spin=0) =
module egg(length,r1,r2,R,d1,d2,D,anchor=CENTER, spin=0) module egg(length,r1,r2,R,d1,d2,D,anchor=CENTER, spin=0)
{ {
path = egg(length,r1,r2,R,d1,d2,D); path = egg(length,r1,r2,R,d1,d2,D);
r1 = get_radius(r1=r1,d1=d1);
r2 = get_radius(r1=r2,d1=d2);
anchors = [named_anchor("left", [-length/2+r1,0], BACK, 0), anchors = [named_anchor("left", [-length/2+r1,0], BACK, 0),
named_anchor("right", [length/2-r2,0], BACK, 0)]; named_anchor("right", [length/2-r2,0], BACK, 0)];
attachable(anchor, spin, two_d=true, path=path, extent=true, anchors=anchors){ attachable(anchor, spin, two_d=true, path=path, extent=true, anchors=anchors){