The cg3d.h and cg3d.C files were my attempt at creating a set of generic shape-intersection routines. They've largely failed, due to the numerical difficulties outlined below; we now use the Magic Software routines in the "mgc" directory. ------------------- Numerical Difficulties: ------------------ src->src works fine (error identically 0) make OPTS=-g test_transfer && gdb ./test_transfer r test_transfer_dir/src.noboite test_transfer_dir/dest.noboite Problem: True volume 3.124847, but total is only 3.115913 (err -0.008934) tet 284: 82 97 9 122 (-0.052, -0.052, -4.500) (-0.052, 2.465, -5.017) (-0.052, -0.052, -7.500) (-2.535, -0.052, -5.017) ----------- Reason: Blatant non-manifold shape: s=9, srcMesh=@0xbffff970, d=246, destMesh=@0xbffff950, dest=0xbffff1a0 Corner volume: 1.5844484919394499 (-1,0,0) volume: -2.8493726524263607 Source Tetrahedral mesh: 15 tets, 11 points Destination Tetrahedral mesh: 479 tets, 130 points Volume3dDest: swept volume is not manifold (1.584448 vs -2.849373) dest tet 246: tet 246: 127 35 128 76 (-0.052, -0.052, 4.500) (-0.052, -0.052, 7.500) (2.465, -0.052, 4.983) (-0.052, 2.465, 4.983) src tet 9: tet 9: 2 10 9 4 (7.500, 7.500, -7.500) (7.500, -0.052, -0.052) (-0.052, -0.052, 7.500) (-0.052, -0.052, -7.500) -> This is *not* a symmetry-breaking problem (swapping src and dest has no effect). It does appears to be roundoff-related, since it appears for epsilon e-12 through e-8, but not e-7 through e-4. Running with e-8 epsilon causes one huge non-manifold shape, but it doesn't appear to matter in the end. Running with e-7 epsilon causes no errors. Running with e-6 epsilon causes numerous tiny non-manifold shapes and volume errors. -> Roundoff is a significant problem. Changing the halfspace definition from (n dot p) + d for a scalar d to n dot (p-o) for a vector o significantly improves roundoff: with the friendly halfspace, epsilon can be made as small as e-11 without any problems. e-12 still causes big nonmanifold errors. With OPTS="-O", we still get problems, even at e-8 (e-7 happens to work, tho').