blob: f68172f129ccec64b7ede282e8c6b0d10577d27a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import pycuda.autoinit
import unittest
from chroma.bvh import make_simple_bvh, BVH
from chroma.bvh.bvh import node_areas
import chroma.models
import numpy as np
#from numpy.testing import assert_array_max_ulp, assert_array_equal, \
# assert_approx_equal
def build_simple_bvh(degree):
mesh = chroma.models.lionsolid()
bvh = make_simple_bvh(mesh, degree)
nodes = bvh.nodes
layer_bounds = np.append(bvh.layer_offsets, len(nodes))
world_coords = bvh.world_coords
for i, (layer_start, layer_end) in enumerate(zip(layer_bounds[:-1],
layer_bounds[1:])):
print i, node_areas(nodes[layer_start:layer_end]).sum() * world_coords.world_scale**2
assert isinstance(bvh, BVH)
def test_simple():
yield build_simple_bvh, 2
yield build_simple_bvh, 3
yield build_simple_bvh, 4
|