mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-05 20:27:53 +02:00
Merge pull request #186 from adrianVmariano/master
round_corners tweak to move $fn deeper into calls add refine option to subdivide_path
This commit is contained in:
@@ -1167,7 +1167,7 @@ function _sum_preserving_round(data, index=0) =
|
|||||||
|
|
||||||
// Function: subdivide_path()
|
// Function: subdivide_path()
|
||||||
// Usage:
|
// Usage:
|
||||||
// newpath = subdivide_path(path, N, method);
|
// newpath = subdivifde_path(path, [N|refine], method);
|
||||||
// Description:
|
// Description:
|
||||||
// Takes a path as input (closed or open) and subdivides the path to produce a more
|
// 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
|
// finely sampled path. The new points can be distributed proportional to length
|
||||||
@@ -1220,9 +1220,11 @@ function _sum_preserving_round(data, index=0) =
|
|||||||
// Example(FlatSpin): Three-dimensional paths also work
|
// Example(FlatSpin): Three-dimensional paths also work
|
||||||
// mypath = subdivide_path([[0,0,0],[2,0,1],[2,3,2]], 12);
|
// mypath = subdivide_path([[0,0,0],[2,0,1],[2,3,2]], 12);
|
||||||
// move_copies(mypath)sphere(r=.1,$fn=32);
|
// move_copies(mypath)sphere(r=.1,$fn=32);
|
||||||
function subdivide_path(path, N, closed=true, exact=true, method="length") =
|
function subdivide_path(path, N, refine, closed=true, exact=true, method="length") =
|
||||||
assert(is_path(path))
|
assert(is_path(path))
|
||||||
assert(method=="length" || method=="segment")
|
assert(method=="length" || method=="segment")
|
||||||
|
assert(num_defined([N,refine]),"Must give exactly one of N and refine")
|
||||||
|
let(N = first_defined([N,len(path)*refine]))
|
||||||
assert((is_num(N) && N>0) || is_vector(N),"Parameter N to subdivide_path must be postive number or vector")
|
assert((is_num(N) && N>0) || is_vector(N),"Parameter N to subdivide_path must be postive number or vector")
|
||||||
let(
|
let(
|
||||||
count = len(path) - (closed?0:1),
|
count = len(path) - (closed?0:1),
|
||||||
|
@@ -94,10 +94,11 @@ include <structs.scad>
|
|||||||
// verbose = if true display rounding scale factors that show how close roundovers are to overlapping. Default: false
|
// verbose = if true display rounding scale factors that show how close roundovers are to overlapping. Default: false
|
||||||
//
|
//
|
||||||
// Example(Med2D): Standard circular roundover with radius the same at every point. Compare results at the different corners.
|
// Example(Med2D): Standard circular roundover with radius the same at every point. Compare results at the different corners.
|
||||||
// $fn=36;
|
include<BOSL2/std.scad>
|
||||||
// shape = [[0,0], [10,0], [15,12], [6,6], [6, 12], [-3,7]];
|
$fn=36;
|
||||||
// polygon(round_corners(shape, radius=1));
|
shape = [[0,0], [10,0], [15,12], [6,6], [6, 12], [-3,7]];
|
||||||
// color("red") down(.1) polygon(shape);
|
polygon(round_corners(shape, radius=1));
|
||||||
|
color("red") down(.1) polygon(shape);
|
||||||
// Example(Med2D): Circular roundover using the "cut" specification, the same at every corner.
|
// Example(Med2D): Circular roundover using the "cut" specification, the same at every corner.
|
||||||
// $fn=36;
|
// $fn=36;
|
||||||
// shape = [[0,0], [10,0], [15,12], [6,6], [6, 12], [-3,7]];
|
// shape = [[0,0], [10,0], [15,12], [6,6], [6, 12], [-3,7]];
|
||||||
|
Reference in New Issue
Block a user