mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-10 08:34:08 +02:00
Added path_length()
This commit is contained in:
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()
|
// Function: path2d_regular_ngon()
|
||||||
// Description:
|
// Description:
|
||||||
// Returns a 2D open counter-clockwise path of the vertices of a regular polygon of `n` sides.
|
// Returns a 2D open counter-clockwise path of the vertices of a regular polygon of `n` sides.
|
||||||
|
Reference in New Issue
Block a user