Пример #1
0
 def _scene(self):
     '''
     A cached version of the pyembree scene.
     '''
     scene = rtcore_scene.EmbreeScene()
     mesh = TriangleMesh(scene, self._geometry.triangles)
     return scene
Пример #2
0
 def _scene(self):
     """
     A cached version of the pyembree scene.
     """
     scene = rtcore_scene.EmbreeScene()
     mesh = TriangleMesh(scene=scene,
                         vertices=self.mesh.vertices.astype(_embree_dtype),
                         indices=self.mesh.faces.astype(_embree_dtype))
     return scene
Пример #3
0
    def __init__(self, vertices, faces, scale):
        scaled = np.asanyarray(vertices, dtype=np.float64)
        self.origin = scaled.min(axis=0)
        self.scale = float(scale)
        scaled = (scaled - self.origin) * self.scale

        self.scene = rtcore_scene.EmbreeScene()
        mesh = TriangleMesh(scene=self.scene,
                            vertices=scaled.astype(_embree_dtype),
                            indices=faces.astype(np.int32))
Пример #4
0
    def __init__(self, vertices, faces, scale):
        scaled = np.array(vertices, dtype=np.float64)
        self.origin = scaled.min(axis=0)
        self.scale = float(scale)
        scaled = (scaled - self.origin) * self.scale

        self.scene = rtcore_scene.EmbreeScene()
        # assign the geometry to the scene
        TriangleMesh(scene=self.scene,
                     vertices=scaled.astype(_embree_dtype),
                     indices=faces.view(np.ndarray).astype(np.int32))
Пример #5
0
    def setUp(self):
        """Initialisation"""
        triangles = xplane(7.0)
        triangles = np.array(triangles, 'float32')

        self.embreeDevice = rtc.EmbreeDevice()
        self.scene = rtcs.EmbreeScene(self.embreeDevice)
        mesh = TriangleMesh(self.scene, triangles)

        origins, dirs = define_rays_origins_and_directions()
        self.origins = origins
        self.dirs = dirs
Пример #6
0
    def setUp(self):
        """Initialisation"""
        points = xplane_only_points(7.0)
        points = np.array(points, 'float32')
        indices = np.array([[0, 1, 2], [1, 3, 2]], 'uint32')

        self.embreeDevice = rtc.EmbreeDevice()
        self.scene = rtcs.EmbreeScene(self.embreeDevice)
        mesh = TriangleMesh(self.scene, points, indices)

        origins, dirs = define_rays_origins_and_directions()
        self.origins = origins
        self.dirs = dirs
Пример #7
0
N = (4 * 256)**2
R = 3
sigmas = [0.5, 2.0, 4.0]


def xplane(x):
    return [[[x, -1.0, -1.0], [x, -1.0, 1.0], [x, 1.0, -1.0]],
            [[x, -1.0, 1.0], [x, 1.0, -1.0], [x, 1.0, 1.0]]]


triangles = xplane(0.0) + xplane(1.0) + xplane(2.0) + xplane(3.0)
triangles = np.array(triangles, 'float32')

scene = rtcs.EmbreeScene()
mesh = TriangleMesh(scene, triangles)
xgrid = np.linspace(0.0, 3.0, 100)
tally = np.zeros(len(xgrid), dtype=int)

origins = np.zeros((N, 3), dtype='float64')
origins[:, 0] += 1e-8
dirs = np.zeros((N, 3))
dirs[:, 0] = 1.0

maxdist = np.empty(N, dtype='float32')
exists = np.arange(N)


def transport_region(r, origins, maxdist, exist):
    n = len(origins)
    u = np.random.random(n)
Пример #8
0
 def add_component(self, component):
     self.components = self.components + [component
                                          ]  # Force traitlet update
     self.meshes.append(TriangleMesh(self.embree_scene,
                                     component.triangles))
Пример #9
0
 def _scene(self):
     # set up the embree scene
     scene = rtcore_scene.EmbreeScene()
     mesh = TriangleMesh(scene, self._geometry.triangles)
     return scene