diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-06-02 15:00:26 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-06-02 15:00:26 -0400 |
commit | 8bbdf7f53b918857a09a9bee4a158f13834bfce6 (patch) | |
tree | 0af80a167c25af46eb21f285f5bca4647c0b7e5c /detectors | |
parent | d0825a136ff65b36069ff8b078b9fd97adeed0df (diff) | |
download | chroma-8bbdf7f53b918857a09a9bee4a158f13834bfce6.tar.gz chroma-8bbdf7f53b918857a09a9bee4a158f13834bfce6.tar.bz2 chroma-8bbdf7f53b918857a09a9bee4a158f13834bfce6.zip |
triangle mesh is now stored everywhere as a split list of vertices and triangles
Diffstat (limited to 'detectors')
-rw-r--r-- | detectors/lbne.py | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/detectors/lbne.py b/detectors/lbne.py index 81f5dd7..3c28c58 100644 --- a/detectors/lbne.py +++ b/detectors/lbne.py @@ -1,20 +1,16 @@ -import numpy as np -from copy import deepcopy -from itertools import product - 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 * -from transform import rotate +from mesh import mesh_from_stl from solid import Solid from geometry import Geometry -from materials import glass, h2o +from transform import rotate, make_rotation_matrix +from itertools import product endcap_spacing = .485 @@ -28,33 +24,35 @@ class LBNE(Geometry): def __init__(self): super(LBNE, self).__init__() - pmt_mesh = read_stl(models.dir + '/hamamatsu_12inch.stl')/1000.0 - pmt_solid = Solid(pmt_mesh, glass, h2o) + pmt_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch.stl') + pmt_mesh.vertices /= 1000.0 + + pmtid = 0 # construct the barrel for i in range(pmts_per_string): for j in range(nstrings): - pmt = deepcopy(pmt_solid) - pmt.mesh += (-radius,0,-height/2+i*height/(pmts_per_string-1)) - pmt.mesh = rotate(pmt.mesh, j*2*np.pi/nstrings, (0,0,1)) - self.add_solid(pmt) + rotation = make_rotation_matrix(j*2*np.pi/nstrings, (0,0,1)) + displacement = rotate((-radius,0,-height/2+i*height/(pmts_per_string-1)), j*2*np.pi/nstrings, (0,0,1)) + self.add_solid(Solid(pmtid, pmt_mesh, rotation, displacement)) + pmtid += 1 # construct the top endcap for x, y in np.array(tuple(product(\ np.arange(-radius+0.075, radius, endcap_spacing), np.arange(-radius+0.075, radius, endcap_spacing)))): if np.sqrt(x**2 + y**2) <= radius: - pmt = deepcopy(pmt_solid) - pmt.mesh = rotate(pmt.mesh, -np.pi/2, (0,1,0)) - pmt.mesh += (x,y,+height/2+height/(pmts_per_string-1)/2) - self.add_solid(pmt) + rotation = make_rotation_matrix(-np.pi/2, (0,1,0)) + displacement = (x,y,+height/2+height/(pmts_per_string-1)/2) + self.add_solid(Solid(pmtid, pmt_mesh, rotation, displacement)) + pmtid += 1 # construct the bottom endcap for x, y in np.array(tuple(product(\ np.arange(-radius+0.075, radius, endcap_spacing), np.arange(-radius+0.075, radius, endcap_spacing)))): if np.sqrt(x**2 + y**2) <= radius: - pmt = deepcopy(pmt_solid) - pmt.mesh = rotate(pmt.mesh, +np.pi/2, (0,1,0)) - pmt.mesh += (x,y,-height/2-height/(pmts_per_string-1)/2) - self.add_solid(pmt) + rotation = make_rotation_matrix(+np.pi/2, (0,1,0)) + displacement = (x,y,-height/2-height/(pmts_per_string-1)/2) + self.add_solid(Solid(pmtid, pmt_mesh, rotation, displacement)) + pmtid += 1 |