summaryrefslogtreecommitdiff
path: root/make.py
diff options
context:
space:
mode:
Diffstat (limited to 'make.py')
-rw-r--r--make.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/make.py b/make.py
index f30042a..8f07b05 100644
--- a/make.py
+++ b/make.py
@@ -47,6 +47,17 @@ def cylinder(radius1=1, radius2=1, height=2, theta=np.pi/32):
y = [-height/2.0, -height/2.0, height/2.0, height/2.0]
return rotate_extrude(x, y, theta)
+def segmented_cylinder(radius, height=2, theta=np.pi/32, n=50):
+ x = np.concatenate((np.linspace(0, radius, n, endpoint=False),
+ [radius] * n,
+ np.linspace(radius, 0, n, endpoint=False),
+ [0.0]))
+ y = np.concatenate(([-height/2.0] * n,
+ np.linspace(-height/2.0, height/2.0, n, endpoint=False),
+ [height/2.0] * (n+1)))
+ #return x,y
+ return rotate_extrude(x, y, theta, remove_duplicate_vertices=False)
+
def sphere(radius=1, theta=np.pi/32):
profile_angles = np.arange(-np.pi/2, np.pi/2+theta, theta)
return rotate_extrude(radius*np.cos(profile_angles), radius*np.sin(profile_angles), theta)