diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-05-09 13:58:12 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-05-09 13:58:12 -0400 |
commit | 7e61bfbe7df445ff43abfc802df9471cf66b55ca (patch) | |
tree | be4dc6797a87b64db60c4d9d53c9e63e62e7145c /test.py | |
parent | bcaef46bb56feb2f92c4feae1bff9e041a4f84cf (diff) | |
download | chroma-7e61bfbe7df445ff43abfc802df9471cf66b55ca.tar.gz chroma-7e61bfbe7df445ff43abfc802df9471cf66b55ca.tar.bz2 chroma-7e61bfbe7df445ff43abfc802df9471cf66b55ca.zip |
improve triangle intersection algorithm by allowing it to terminate early
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -17,17 +17,6 @@ def array2float3(arr): return x -def array2float4(arr): - if len(arr.shape) != 2 or arr.shape[-1] != 3: - raise Exception('shape mismatch') - - x = np.empty(arr.shape[0], dtype=gpuarray.vec.float4) - x['x'] = arr[:,0] - x['y'] = arr[:,1] - x['z'] = arr[:,2] - - return x - print 'device %s' % autoinit.device.name() source = open('src/linalg.h').read() + open('src/matrix.h').read() + \ @@ -77,9 +66,9 @@ translate(np.int32(mesh.size), mesh_gpu, gpuarray.vec.make_float3(0,30,0), block for i in range(100): - rotate(np.int32(x.size), x_gpu, np.float32(np.pi/50), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) + rotate(np.int32(x.size), x_gpu, np.float32(np.pi/100), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) - rotate(np.int32(p.size), p_gpu, np.float32(np.pi/50), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) + rotate(np.int32(p.size), p_gpu, np.float32(np.pi/100), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) t0 = time.time() intersect(np.int32(x.size), x_gpu, p_gpu, np.int32(mesh.size//3), mesh_gpu, pixel_gpu, block=(256,1,1), grid=(width*height//256+1,1)) |