diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-10 03:15:17 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-10 03:15:17 -0400 |
commit | 842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9 (patch) | |
tree | eacf1304096bfb1d7c6597147bd1479ba84ba2e8 /make.py | |
parent | aa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d (diff) | |
download | chroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.tar.gz chroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.tar.bz2 chroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.zip |
added a hybrid monte carlo ray tracing rendering algorithm
Diffstat (limited to 'make.py')
-rw-r--r-- | make.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2,7 +2,7 @@ import numpy as np from geometry import Mesh from transform import rotate -def rotate_extrude(x, y, theta=np.pi/32): +def rotate_extrude(x, y, theta=np.pi/32, remove_duplicate_vertices=True): x, y, = np.asarray(x), np.asarray(y) if len(x.shape) != 1 or len(y.shape) != 1 or x.size != y.size: @@ -34,7 +34,7 @@ def rotate_extrude(x, y, theta=np.pi/32): triangles[start+step:start+2*step,2] = np.arange(this_slice+1, this_slice+len(points)) triangles[start+step:start+2*step,1] = np.arange(next_slice+1, next_slice+len(points)) - return Mesh(vertices, triangles, remove_duplicate_vertices=True) + return Mesh(vertices, triangles, remove_duplicate_vertices=remove_duplicate_vertices) def cube(size=1): a = np.sqrt(size**2/2.0) @@ -49,7 +49,7 @@ def cylinder(radius1=1, radius2=1, height=2, theta=np.pi/32): def sphere(radius=1, theta=np.pi/32): profile_angles = np.arange(-np.pi/2, np.pi/2+theta, theta) - return rotate_extrude(np.cos(profile_angles), np.sin(profile_angles), theta) + return rotate_extrude(radius*np.cos(profile_angles), radius*np.sin(profile_angles), theta) def torus(radius=1, offset=3, phi=np.pi/32, theta=np.pi/32): profile_angles = np.arange(0, 2*np.pi+phi, phi) |