From: Sebastian M. <seb...@gm...> - 2009-01-15 13:24:38
|
Hello, I'm currently using gmtl a lot for intersection testing. I've spotted some strange things in Intersection.h, where instead of DATA_TYPE float was used when returning intersection parameters (like tangent space for triangle/ray-intersection). When using double type Tri and Ray I had some numerical instabilities, which lead to artifacts in my routines. Changing the return values (e.g. u,v,t to DATA_TYPE& instead of float&) solved those problems. The second question regards the triangle/linesegment intersection itself. It is stated, it will only work for CCW-oriented triangles, it however doesn't state, that intersection can only be done from one side. Assume a correctly assembled triangle: If intersection is done with a ray of direction (0,0,-1) it returns a correct result. Using a origin below the triangle and reversing the ray direction results in not hitting the triangle. There are two possible solutions to this: 1. Make the triangle intersection use a slightly other method (like moeller trumbore original does with precalculating the inverse determinant), which works excellent for me. 2. Make a second function using the latter method. Another thing I've come across is the mData members in most of the class used in gmtl. This make life a lot easier regarding serialization (I'm using non-intrusive serialization offered by boost), but it is not done consequently in all classes. For instance Tri<DATA_TYPE> doesn't declare its vertices public. So should this be done the same way for every class? I'd really like to submit the changes I've made so far, if you folks tell me how to provide you the sources. cheers Sebastian |