diff -Naurw ../../irrlicht-spintz-0.12/source/Irrlicht/include/triangle3d.h Irrlicht/include/triangle3d.h --- ../../irrlicht-spintz-0.12/source/Irrlicht/include/triangle3d.h 2005-09-16 13:15:50.000000000 +0200 +++ Irrlicht/include/triangle3d.h 2005-11-27 00:05:02.000000000 +0100 @@ -60,7 +60,7 @@ bool isPointInside(const vector3d& p) const { return (isOnSameSide(p, pointA, pointB, pointC) && - isOnSameSide(p, pointB, pointA, pointC) && + isOnSameSide(p, pointB, pointC, pointA) && isOnSameSide(p, pointC, pointA, pointB)); } @@ -103,8 +103,7 @@ //! Returns an intersection with a 3d line. - //! \param lineVect: Vector of the line to intersect with. - //! \param linePoint: Point of the line to intersect with. + //! \param line: Line to intersect with. //! \param outIntersection: Place to store the intersection point, if there is one. //! \return Returns true if there was an intersection, false if there was not. bool getIntersectionWithLimitedLine(const line3d& line, @@ -129,7 +128,7 @@ const vector3d& lineVect, vector3d& outIntersection) const { if (getIntersectionOfPlaneWithLine(linePoint, lineVect, outIntersection)) - return isPointInside(outIntersection); + return isPointInsideFast( outIntersection ); return false; } @@ -151,8 +148,12 @@ if (t2 == 0.0f) return false; - T d = pointA.dotProduct(normal); - T t =- (normal.dotProduct(linePoint) - d) / t2; + core::vector3d midPoint; + midPoint.X = ( pointA.X + pointB.X + pointC.X ) / 3.0f; + midPoint.Y = ( pointA.Y + pointB.Y + pointC.Y ) / 3.0f; + midPoint.Z = ( pointA.Z + pointB.Z + pointC.Z ) / 3.0f; + T d = - midPoint.dotProduct( normal ); + T t = -(( normal.dotProduct( linePoint ) + d ) / t2); outIntersection = linePoint + (lineVect * t); return true; }