mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 13:50:23 +01:00
Added path_length()
This commit is contained in:
parent
3564b5c487
commit
48140e507f
15
paths.scad
15
paths.scad
@ -91,6 +91,21 @@ function simplify3d_path(path, eps=1e-6) = concat(
|
||||
);
|
||||
|
||||
|
||||
// Function: path_length()
|
||||
// Usage:
|
||||
// path3d_length(path)
|
||||
// Description:
|
||||
// Returns the length of the path.
|
||||
// Arguments:
|
||||
// path = The list of points of the path to measure.
|
||||
// Example:
|
||||
// path = [[0,0], [5,35], [60,-25], [80,0]];
|
||||
// echo(path_length(path));
|
||||
function path_length(path) =
|
||||
len(path)<2? 0 :
|
||||
sum([for (i = [0:len(path)-2]) norm(path[i+1]-path[i])]);
|
||||
|
||||
|
||||
// Function: path2d_regular_ngon()
|
||||
// Description:
|
||||
// Returns a 2D open counter-clockwise path of the vertices of a regular polygon of `n` sides.
|
||||
|
Loading…
x
Reference in New Issue
Block a user