mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-16 03:34:42 +02:00
add lemniscate_curve
This commit is contained in:
45
src/lemniscate_curve.scad
Normal file
45
src/lemniscate_curve.scad
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
use <lemniscate_curve.scad>;
|
||||
use <path_extrude.scad>;
|
||||
use <shape_star.scad>;
|
||||
|
||||
shape_pts = [
|
||||
[3, -1.5],
|
||||
[3, 1.5],
|
||||
[2, 1.5],
|
||||
[2, 0.5],
|
||||
[-2, 0.5],
|
||||
[-2, 1.5],
|
||||
[-3, 1.5],
|
||||
[-3, -1.5],
|
||||
[-2, -1.5],
|
||||
[-2, -0.5],
|
||||
[2, -0.5],
|
||||
[2, -1.5]
|
||||
];
|
||||
|
||||
path_pts = lemniscate_curve(2, 1, .75, .075) * 20;
|
||||
path_extrude(
|
||||
shape_pts,
|
||||
concat(path_pts, [path_pts[0]]),
|
||||
method = "EULER_ANGLE"
|
||||
);
|
||||
|
||||
path_pts2 = lemniscate_curve(2, 1, .75, .2) * 20;
|
||||
translate([0, 30, 0])
|
||||
path_extrude(shape_star() * 3,
|
||||
concat(path_pts2, [path_pts2[0]]),
|
||||
method = "EULER_ANGLE"
|
||||
);
|
||||
|
||||
|
||||
*/
|
||||
function lemniscate_curve(t_step, a = 1, b = 1, c = 1) =
|
||||
[
|
||||
for(t = [0:t_step:360 - t_step])
|
||||
let(
|
||||
sint = sin(t),
|
||||
cost = cos(t)
|
||||
)
|
||||
[a * sint, b * sint * cost, c * cost]
|
||||
];
|
Reference in New Issue
Block a user