[vtkusers] Line Intersection with Plane: Seems to return almost all of the plane

Doug Hoppes dhoppes at mbfbioscience.com
Tue Sep 10 08:00:29 EDT 2013


Hi all,

                I'm trying to use the vtkplane::IntersectWithLine() method and it seems to be giving me some issues (which, most likely is on my part).  I have a cube that I'm sending a line through.  I need to find the plane where the line enters and the one where the line exits.  The way that I do this is to create 6 vtkplanes using (coordinates defined appropriately for each plane):

      pPoint1[0] = 0;               pPoint1[1] = 0;         pPoint1[2] = 0;
      pPoint2[0] = 0;               pPoint2[1] = dfYRange;  pPoint2[2] = 0;
      pPoint3[0] = dfXRange;  pPoint3[1] = 0;               pPoint3[2] = 0;

      vtkSmartPointer<vtkPlane> pPlane1 = vtkSmartPointer<vtkPlane>::New();
      pPlane1->SetOrigin(pPoint1);
      vtkTriangle::ComputeNormal(pPoint1, pPoint2, pPoint3, normals);
      pPlane1->SetNormal(normals);

When I call,

int icheck = pIntersectionPlane->IntersectWithLine(pLineStart, pLineEnd, lineCoordinate, pIntersectionPoint);

the value of icheck is > 0 for 4 of the 6 planes.  I don't get it.  From the documentation, seems that it should be > 0 for any plane that it intersects.  So, I would always assume that it would intersect with only 2 of the 6 planes.

Any idea what's going on?

Doug


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130910/bd9bc73d/attachment.htm>


More information about the vtkusers mailing list