Merge pull request #391 from adrianVmariano/master

path_spread bug fix and affine_frame_map doc tweak for affine_frame_map
This commit is contained in:
Revar Desmera 2021-01-20 18:05:29 -08:00 committed by GitHub
commit 03ccb3ea16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -266,10 +266,10 @@ function affine3d_rot_from_to(from, to) =
// Function: affine3d_frame_map() // Function: affine3d_frame_map()
// Usage: // Usage:
// map = affine3d_frame_map(v1, v2, v3); // map = affine3d_frame_map(v1, v2, v3, <reverse>);
// map = affine3d_frame_map(x=VECTOR1, y=VECTOR2, <reverse>); // map = affine3d_frame_map(x=VECTOR1, y=VECTOR2, <reverse>);
// map = affine3d_frame_map(x=VECTOR1, z=VECTOR2, <reverse>); // map = affine3d_frame_map(x=VECTOR1, z=VECTOR2, <reverse>);
// map = affine3d_frame_map(y=VECTOR1, y=VECTOR2, <reverse>); // map = affine3d_frame_map(y=VECTOR1, z=VECTOR2, <reverse>);
// Description: // Description:
// Returns a transformation that maps one coordinate frame to another. You must specify two or // Returns a transformation that maps one coordinate frame to another. You must specify two or
// three of `x`, `y`, and `z`. The specified axes are mapped to the vectors you supplied. If you // three of `x`, `y`, and `z`. The specified axes are mapped to the vectors you supplied. If you

View file

@ -1172,7 +1172,7 @@ module path_spread(path, n, spacing, sp=undef, rotate_children=true, closed=fals
sort([for(entry=ptlist) posmod(entry-listcenter,length)]) : sort([for(entry=ptlist) posmod(entry-listcenter,length)]) :
[for(entry=ptlist) entry + length/2-listcenter ] [for(entry=ptlist) entry + length/2-listcenter ]
); );
distOK = min(distances)>=0 && max(distances)<=length; distOK = is_def(n) || (min(distances)>=0 && max(distances)<=length);
assert(distOK,"Cannot fit all of the copies"); assert(distOK,"Cannot fit all of the copies");
cutlist = path_cut(path, distances, closed, direction=true); cutlist = path_cut(path, distances, closed, direction=true);
planar = len(path[0])==2; planar = len(path[0])==2;
@ -1186,7 +1186,7 @@ module path_spread(path, n, spacing, sp=undef, rotate_children=true, closed=fals
if(planar) { if(planar) {
rot(from=[0,1],to=cutlist[i][3]) children(); rot(from=[0,1],to=cutlist[i][3]) children();
} else { } else {
multmatrix(affine2d_to_3d(transpose([cutlist[i][2],cross(cutlist[i][3],cutlist[i][2]), cutlist[i][3]]))) multmatrix(affine3d_frame_map(x=cutlist[i][2], z=cutlist[i][3]))
children(); children();
} }
} else { } else {