Ok.

Hello Dirk.

Since a week, I start becoming mad with strange values from the
IntersectAction::getNormal() method...  It seem there is a bug, this
method does'nt return the normal of the Hit triandle, but a vector
which is the cross product of the ray direction and one once the edges
of the triangle.

I think the return value should be  qvec instead of pvec, but I'm not
sure.. (see the above code)

Instead, I'm using this code wich is not optimized but wirks great, so
there should be a problem :

TriangleIterator it(act->getHitObject());
it.seek( act->getHitTriangle() );
Vec3f v1 =  it.getPosition(1)-it.getPosition(0);
Vec3f v2 =  it.getPosition(2)-it.getPosition(0);
Vec3f norm = v1.cross(v2);
norm.normalize();


So I think there is something.... or maybe we undersdant "Nomal" in a
different way.

Look at the code (OpenSG1.8-Dailybuild  20/06).
OSGLine.cpp

Raphaël Ducom.

00692 bool Line::intersect(const Pnt3f  &v0,
00693                      const Pnt3f  &v1,
00694                      const Pnt3f  &v2,
00695                            Real32 &t,
00696                            Vec3f  *norm) const
00697 {
00698     // Eps (1E-6f) didn't work with very small geometries!
00699     static const Real32 sEps = 1E-10f;
00700
00701     // find vectors for two edges sharing v0.
00702     Vec3f edge1 = v1 - v0;
00703     Vec3f edge2 = v2 - v0;
00704
00705     // begin calculating determinant - also used to calculate U parameter.
00706     Vec3f pvec = _dir.cross(edge2);
00707
00708     // if determinant is near zero, ray lies in plane of triangle.
00709     Real32 det = edge1.dot(pvec);
00710     Vec3f qvec;
00711
00712     if(det > sEps)
00713     {
00714         // calculate distance from v0 to ray origin.
00715         Vec3f tvec = _pos - v0;
00716
00717         // calculate U parameter and test bounds.
00718         Real32 u = tvec.dot(pvec);
00719
00720         if(u < 0.0 || u > det)
00721             return false;
00722
00723         // prepare to test V parameter.
00724         qvec = tvec.cross(edge1);
00725
00726         // calculate V parameter and test bounds.
00727         Real32 v = _dir.dot(qvec);
00728
00729         if(v < 0.0 || u + v > det)
00730             return false;
00731     }
00732     else if(det < -sEps)
00733     {
00734         // calculate distance from v0 to ray origin.
00735         Vec3f tvec = _pos - v0;
00736
00737         // calculate U parameter and test bounds.
00738         Real32 u = tvec.dot(pvec);
00739
00740         if(u > 0.0 || u < det)
00741             return false;
00742
00743         // prepare to test V parameter.
00744         qvec = tvec.cross(edge1);
00745
00746         // calculate V parameter and test bounds.
00747         Real32 v = _dir.dot(qvec);
00748
00749         if(v > 0.0 || u + v < det)
00750             return false;
00751     }
00752     else
00753         return false;  // ray is parallel to the plane of the triangle.
00754
00755     Real32 inv_det = 1.0 / det;
00756
00757     // calculate t, ray intersects triangle.
00758     t = edge2.dot(qvec) * inv_det;
00759
00760     if(norm != NULL)
00761         *norm = pvec;
00762
00763     return true;
00764 }



2007/6/22, Dirk Reiners <[EMAIL PROTECTED]>:
>
>         Dear Users,
>
> we're in the process of (finally!) finishing 1.8. it's feature-frozen and 
> we're
> fixing the last bugs before release and diving full force in OpenSG 2. To do
> that we need some help from all of you, to make sure that things are working 
> the
> way they're supposed to.
>
> The first part is of course to make sure that your code works with the current
> source base. So please download one of the current dailybuilds from
> http://www.opensg.org/dailybuild_logs and test it with your application. If 
> you
> have any problems, please open a ticket on the Trac system at
> http://opensg.vrsource.org/trac/newticket (don't forgot to set the milestone 
> to
> 1.8 Release and the version to 1.8).
>
> In addition to making sure that the code is working, we need to make sure that
> the distributions are working. So we would appreciate if you could download 
> the
> distribution for your environment from the dailybuilds page, install it, and 
> run
> a quick test if it works. That includes the installation itself, running the
> precompiled example programs, rebuilding the precompiled example programs, and
> rebuilding the actual OpenSG library from source on your platform. Especially
> the last part can take a while, so if you don't have time to do all of these,
> every single one would be helpful.
>
> If you do try one of these, please let us know if you had a problem (by 
> opening
> a ticket), or if just worked. For the latter, please note that on the 1.8
> release planning page at 
> http://opensg.vrsource.org/trac/wiki/Planning1_8release .
>
> I would like to get 1.8 out quickly, so please check if you find a little time
> for doing this over the next couple days. Every little bit helps!
>
> Thanks for your support and for making OpenSG the best it can be!
>
> Yours
>
>         The OpenSG Team
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to