diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-18 00:12:09 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-18 00:12:09 -0400 |
commit | ab54917bceb4943f6750f589ffe6a032b2770fb1 (patch) | |
tree | e76ede76a1344820c424f2c07bc44ef22201864c /solids | |
parent | 34ff4d6c734e5adf3aa8a0e7ca89031effdb1489 (diff) | |
download | chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.tar.gz chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.tar.bz2 chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.zip |
moved class definitions for Solid, Mesh, Material, and Surface into geometry.py and moved instances of these classes into separate folders. the Solid object no longer contains a rotation, displacement, or id variable; instead, they are passed to a geometry object when calling add_solid().
Diffstat (limited to 'solids')
-rw-r--r-- | solids/__init__.py | 1 | ||||
-rw-r--r-- | solids/r7081.py | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/solids/__init__.py b/solids/__init__.py new file mode 100644 index 0000000..f01d97f --- /dev/null +++ b/solids/__init__.py @@ -0,0 +1 @@ +from r7081 import r7081 diff --git a/solids/r7081.py b/solids/r7081.py new file mode 100644 index 0000000..f91c2ab --- /dev/null +++ b/solids/r7081.py @@ -0,0 +1,29 @@ +import os +import sys +import numpy as np + +dir = os.path.split(os.path.realpath(__file__))[0] +sys.path.append(dir + '/..') + +import models +from mesh import mesh_from_stl +from geometry import * +from materials import * + +r7081_outer_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_outer.stl') +r7081_inner_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_inner.stl') + +photocathode_triangles = np.mean(r7081_inner_mesh[:], axis=1)[:,1] > 0 + +inner_color = np.empty(len(r7081_inner_mesh.triangles), np.uint32) +inner_color[photocathode_triangles] = 0xff0000 +inner_color[~photocathode_triangles] = 0x00ff00 + +inner_surface = np.empty(len(r7081_inner_mesh.triangles), np.object) +inner_surface[photocathode_triangles] = black_surface +inner_surface[~photocathode_triangles] = shiny_surface + +r7081_inner_solid = Solid(r7081_inner_mesh, vacuum, glass, inner_surface, color=inner_color) +r7081_outer_solid = Solid(r7081_outer_mesh, glass, lightwater_sno) + +r7081 = r7081_inner_solid + r7081_outer_solid |