[vtkusers] Small bug in vtkPolygon::IntersectPolygonWithPolygon

Goodwin Lawlor goodwin.lawlor at ucd.ie
Tue May 6 15:34:15 EDT 2003


Hi all,
Attached is a small example in C++ (the method isn't accessible in tcl) to
illustrate that in certain circumstances
vtkPolygon::IntersectPolygonWithPolygon() incorrectly denies that two
triangles are intersecting. The circumstance is  two triangles intersecting
each other exactly at their edges... see the rendering from the example (I
wont post an image to the list!).

The "fix" for this is in vtkTriangle::PointInTriangle(). At the moment
vtkTriangle::PointInTriangle returns true if a point is inside but not on
the edge of the triangle. So line 958 of vtkTriangle.cxx changes to:

 if ( (vtkMath::Dot(n1,n2) >= 0.0) && (vtkMath::Dot(n2,n3) >= 0.0) )

to include the edges. Is this a good fix though? Is a point on the edge, in
the triangle? vtkTriangle::PointInTriangle() is only called from
vtkPolygon::IntersectPolygonWithPolygon() in the VTK source...

Thanks,

Goodwin
University College Dublin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestIntersectPolygons.cxx
Type: application/octet-stream
Size: 3191 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030506/ae73b0b3/attachment.obj>


More information about the vtkusers mailing list