mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 08:19:43 +00:00
Fixed some docs formatting errors.
This commit is contained in:
parent
c05b6bfa5c
commit
8f63ce43ad
3 changed files with 15 additions and 18 deletions
|
@ -943,8 +943,9 @@ function polygon_shift_to_closest_point(path, pt) =
|
|||
) select(path,segnum,segnum+len(path)-1);
|
||||
|
||||
|
||||
// Function: reindex_polygon(reference, poly)
|
||||
//
|
||||
// Function: reindex_polygon()
|
||||
// Usage:
|
||||
// newpoly = reindex_polygon(reference, poly);
|
||||
// Description:
|
||||
// Rotates the point order and possibly reverses the point order of a polygon path to optimize its pairwise its
|
||||
// point association with a reference polygon. The two polygons must have the same number of vertices.
|
||||
|
@ -953,11 +954,9 @@ function polygon_shift_to_closest_point(path, pt) =
|
|||
// small as possible. Returns the reindexed polygon. Note that the geometry of the polygon is not changed by
|
||||
// this operation, just the labeling of its vertices. If the input polygon is oriented opposite
|
||||
// the reference then its point order is flipped.
|
||||
//
|
||||
// Arguments:
|
||||
// reference = reference polygon path
|
||||
// poly = input polygon to reindex
|
||||
//
|
||||
// Example(2D): The red dots show the 0th entry in the two input path lists. Note that the red dots are not near each other. The blue dot shows the 0th entry in the output polygon
|
||||
// pent = subdivide_path([for(i=[0:4])[sin(72*i),cos(72*i)]],30);
|
||||
// circ = circle($fn=30,r=2.2);
|
||||
|
@ -987,20 +986,19 @@ function reindex_polygon(reference, poly, return_error=false) =
|
|||
return_error ? [optimal_poly, min(sums)] : optimal_poly;
|
||||
|
||||
|
||||
// Function: align_polygon(reference, poly, angles, [cp])
|
||||
//
|
||||
// Function: align_polygon()
|
||||
// Usage:
|
||||
// newpoly = align_polygon(reference, poly, angles, [cp]);
|
||||
// Description:
|
||||
// Tries the list or range of angles to find a rotation of the specified polygon that best aligns
|
||||
// with the reference polygon. For each angle, the polygon is reindexed, which is a costly operation
|
||||
// so if run time is a problem, use a smaller sampling of angles. Returns the rotated and reindexed
|
||||
// polygon.
|
||||
//
|
||||
// Arguments:
|
||||
// reference = reference polygon
|
||||
// poly = polygon to rotate into alignment with the reference
|
||||
// angles = list or range of angles to test
|
||||
// cp = centerpoint for rotations
|
||||
//
|
||||
// Example(2D): The original hexagon in yellow is not well aligned with the pentagon. Turning it so the faces line up gives an optimal alignment, shown in red.
|
||||
// $fn=32;
|
||||
// pentagon = subdivide_path(pentagon(side=2),60);
|
||||
|
|
17
paths.scad
17
paths.scad
|
@ -702,8 +702,9 @@ function _sum_preserving_round(data, index=0) =
|
|||
_sum_preserving_round(list_set(data, [index,index+1], [newval, data[index+1]-error]), index+1);
|
||||
|
||||
|
||||
// Function: subdivide_path(path, N, method)
|
||||
//
|
||||
// Function: subdivide_path()
|
||||
// Usage:
|
||||
// newpath = subdivide_path(path, N, method);
|
||||
// Description:
|
||||
// Takes a path as input (closed or open) and subdivides the path to produce a more
|
||||
// finely sampled path. The new points can be distributed proportional to length
|
||||
|
@ -720,13 +721,11 @@ function _sum_preserving_round(data, index=0) =
|
|||
// double counting the endpoints, which are shared by pairs of segments, so that for
|
||||
// a closed polygon the total number of points will be sum(N). Note that with an open
|
||||
// path there is an extra point at the end, so the number of points will be sum(N)+1.
|
||||
//
|
||||
// Arguments:
|
||||
// path = path to subdivide
|
||||
// N = scalar total number of points desired or with `method="segment"` can be a vector requesting `N[i]-1` points on segment i.
|
||||
// closed = set to false if the path is open. Default: True
|
||||
// exact = if true return exactly the requested number of points, possibly sacrificing uniformity. If false, return uniform point sample that may not match the number of points requested. Default: True
|
||||
//
|
||||
// path = path to subdivide
|
||||
// N = scalar total number of points desired or with `method="segment"` can be a vector requesting `N[i]-1` points on segment i.
|
||||
// closed = set to false if the path is open. Default: True
|
||||
// exact = if true return exactly the requested number of points, possibly sacrificing uniformity. If false, return uniform point sample that may not match the number of points requested. Default: True
|
||||
// Example(2D):
|
||||
// mypath = subdivide_path(square([2,2],center=true), 12);
|
||||
// place_copies(mypath)circle(r=.1,$fn=32);
|
||||
|
@ -737,7 +736,7 @@ function _sum_preserving_round(data, index=0) =
|
|||
// mypath = subdivide_path(square([8,2],center=true), 12, method="segment");
|
||||
// place_copies(mypath)circle(r=.1,$fn=32);
|
||||
// Example(2D):
|
||||
// mypath = subdivide_path(square([2,2],center=true), 17, closed=false);
|
||||
// mypath = subdivide_path(square([2,2],center=true), 17, closed=false);
|
||||
// place_copies(mypath)circle(r=.1,$fn=32);
|
||||
// Example(2D): Specifying different numbers of points on each segment
|
||||
// mypath = subdivide_path(hexagon(side=2), [2,3,4,5,6,7], method="segment");
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,44];
|
||||
BOSL_VERSION = [2,0,45];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue