From 7e61bfbe7df445ff43abfc802df9471cf66b55ca Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Mon, 9 May 2011 13:58:12 -0400 Subject: improve triangle intersection algorithm by allowing it to terminate early --- test.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'test.py') diff --git a/test.py b/test.py index 5c7c234..ec7c954 100644 --- a/test.py +++ b/test.py @@ -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)) -- cgit