1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

added shape_ellipse

This commit is contained in:
Justin Lin
2017-05-06 14:01:34 +08:00
parent 3dc1877dbd
commit 7fccc9218b

16
src/shape_ellipse.scad Normal file
View File

@@ -0,0 +1,16 @@
function shape_ellipse(axes) =
let(
frags = $fn > 0 ?
($fn >= 3 ? $fn : 3) :
max(min(360 / $fa, axes[0] * 6.28318 / $fs), 5),
step_a = 360 / frags,
shape_pts = [
for(a = [0:step_a:360 - step_a])
[axes[0] * cos(a), axes[1] * sin(a)]
],
triangles = [for(i = [1:len(shape_pts) - 2]) [0, i, i + 1]]
)
[
shape_pts,
triangles
];