Hello all,<br><br>The IntersectWithLine() routine in vtkPlane returns 0, i.e., no intersection, whenever the plane and line are parallel.<br>Specifically, this occurs in lines 171-20, copied below:<br><br> num = vtkMath::Dot(n,p0) - ( n[0]*p1[0] + n[1]*p1[1] + n[2]*p1[2] ) ;<br>
den = n[0]*p21[0] + n[1]*p21[1] + n[2]*p21[2];<br> //<br> // If denominator with respect to numerator is "zero", then the line and<br> // plane are considered parallel. <br> //<br><br> // trying to avoid an expensive call to fabs()<br>
if (den < 0.0)<br> {<br> fabsden = -den;<br> }<br> else<br> {<br> fabsden = den;<br> }<br> if (num < 0.0)<br> {<br> fabstolerance = -num*VTK_PLANE_TOL;<br> }<br> else<br> {<br> fabstolerance = num*VTK_PLANE_TOL;<br>
}<br> if ( fabsden <= fabstolerance )<br> {<br> t = VTK_DOUBLE_MAX;<br> return 0;<br> }<br><br>Nevertheless, a line may be parallel to a plane and yet be contained inside said plane. In this case, the routine will return 0 just as if the line was parallel and outside of the plane, as the calculation does not consider the plane-to-line distance.<br>
<br>It might have been intended to be like this. However, this becomes a problem in the implementation of vtkTriangle's implementation of IntersectWithLine(), which first calls vtkPlane::IntersectWithLine(): as a result, a line which goes through a vtkTriangle, while being contained in the plane of this triangle, will be considered as NOT intersecting the triangle, which is clearly an error.<br>
<br>I am therefore wondering whether this behavior of vtkPlane::IntersectWithLine is a feature, or a bug.<br><br>If it is not a bug, then I would submit that the implementation of vtkTriangle::IntersectWithLine() should be modified, by checking, for lines that ARE parallel to the triangle, whether they are contained in the same plane.<br>
<br>Please let me know what you think. Thank you,<br>Philippe<br><br><br>
<br clear="all"><br>-- <br><font color="#888888">Philippe Pébay<br>Directeur de la Visualisation et du Calcul Haute Performance<br>
Kitware SAS<br>
20 rue de la Villette<br>
69328 Lyon cedex 03, France<br>
<a value="+33426685003">+33 (0)4.26.68.50.03</a><br>
<a href="http://www.kitware.fr/" target="_blank">http://www.kitware.fr</a></font><br>