2010-07-25 11:39:52 -05:00
|
|
|
// Parametric curves, to be used as paths
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
// © 2010 by Elmo Mäntynen
|
2010-07-25 10:03:04 -05:00
|
|
|
use <math.scad>
|
2011-01-21 02:40:36 -06:00
|
|
|
include <constants.scad>
|
|
|
|
|
2010-07-25 10:03:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
/* A circular helix of radius a and pitch 2πb is described by the following parametrisation:
|
|
|
|
x(t) = a*cos(t),
|
|
|
|
y(t) = a*sin(t),
|
|
|
|
z(t) = b*t
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function b(pitch) = pitch/(TAU);
|
|
|
|
function t(pitch, z) = z/b(pitch);
|
|
|
|
|
|
|
|
function helix_curve(pitch, radius, z) =
|
|
|
|
[radius*cos(deg(t(pitch, z))), radius*sin(deg(t(pitch, z))), z];
|
|
|
|
|