Game Development Community

Bug to confirm ??

by Jean-louis Amadi · in Torque 3D Professional · 10/27/2013 (6:41 am) · 5 replies

All T3D version.

In the file : Engine/source/math/mRect.h

In the method : inline bool RectF::intersectTriangle(...)

We have near of the beginning :

if(contains(a) || contains(b) || contains(b))

But shouldn't it be such as this ?:

if(contains(a) || contains(b) || contains(c))
where the last test takes account the third vertex "C" of the concerned triangle instead of "B" again.

#1
10/27/2013 (1:50 pm)
I haven't looked at the code, but you'r right, at the very least it should read:-
if(contains(a) || contains(b))
but your probably right about contains[c], funny this hasn't been spotted before.
#2
10/27/2013 (4:19 pm)
Yep, that looks like a bug for sure.
#3
10/27/2013 (6:51 pm)
that bug was spotted by alfio and was added in CE version.
but never was remembered again to post for others.

// Check each triangle point to see if it's in us.
#ifdef AS_OPTIMIZATIONS_STAGE2
   if(contains(a) || contains(b) || contains(c))
#else
   if(contains(a) || contains(b) || contains(b))
#endif
      return true;
#4
10/27/2013 (10:20 pm)
Quote:
that bug was spotted by alfio and was added in CE version.
but never was remembered again to post for others.
Since Alfio never acknowledged (that I know of) the open source software agreement anything within the CE that was authored by him could not be utilized for the MIT version of T3D. But now that someone else has independently noticed this error what say you that we fix it for the 3.5 release -- preferably without the #ifdef garbage.
#5
11/06/2013 (11:25 am)
Fixed in the development branch in preparation for the v3.5 release.

github.com/GarageGames/Torque3D/pull/526

- Dave