diff options
author | Stan Seibert <stan@mtrr.org> | 2011-09-16 14:27:46 -0400 |
---|---|---|
committer | Stan Seibert <stan@mtrr.org> | 2011-09-16 14:27:46 -0400 |
commit | 084dfd08b714faefaea77cb7dc04d2e93dc04b1d (patch) | |
tree | 5be8c1f1d30dc52d74c70c4964ec54f66294c265 /project.py | |
parent | cfecff941fc619eb7269128afc62d9c11ae78aff (diff) | |
download | chroma-084dfd08b714faefaea77cb7dc04d2e93dc04b1d.tar.gz chroma-084dfd08b714faefaea77cb7dc04d2e93dc04b1d.tar.bz2 chroma-084dfd08b714faefaea77cb7dc04d2e93dc04b1d.zip |
File reorganization to move toward standard python package layout
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/project.py b/project.py deleted file mode 100644 index 7d9cabe..0000000 --- a/project.py +++ /dev/null @@ -1,37 +0,0 @@ -import numpy as np -from itertools import repeat -from chroma.transform import rotate, normalize - -def from_film(position=(0,0,0), axis1=(0,0,1), axis2=(1,0,0), size=(800,600), - width=0.035, focal_length=0.018): - """Project rays from a piece of film located at whose focal point is - located at `position`. `axis1` and `axis2` specify the vectors pointing - along the length and height of the film respectively. - """ - - height = width*(size[1]/float(size[0])) - - axis1 = normalize(axis1) - axis2 = normalize(axis2) - - dx0 = width/size[0] - dx1 = height/size[1] - - # for i in range(size[0]): - # for j in range(size[1]): - # grid[i*size[1]+j] = axis1*dx1*j - axis2*dx0*i - - x = np.arange(size[0]) - y = np.arange(size[1]) - - yy, xx = np.meshgrid(y,x) - - n = size[0]*size[1] - - grid = -np.tile(axis2, (n,1))*xx.ravel()[:,np.newaxis]*dx0 + \ - np.tile(axis1, (n,1))*yy.ravel()[:,np.newaxis]*dx1 - - grid += axis2*width/2 - axis1*height/2 - grid -= np.cross(axis1,axis2)*focal_length - - return grid+position, normalize(-grid) |