[vtkusers] How to use the method "vtkCellLocator::IntersectWithLine()" ?

Luca Pallozzi Lavorante lplavorante at gmail.com
Tue Nov 21 05:37:40 EST 2006


Hi Che,
I have succesfully used vtkCellLocator::IntersectWithLine, although I don´t
know the meaning of all its arguments:
I have done the following:

if (locator->IntersectWithLine(p1, p2, 0.001, t, pline, pcoords, subId,
cellid, cell) != 0) {
  // Enters here if there is intersection
}

where:

  p1 and p2 are the intersecting line´s endpoints,
  double t = 0.0;
  double pline[3] = { 0, 0, 0};
  double pcoords[3] = { 0, 0, 0};
   int subId = 0;
   int cellid = -1;
   vtkGenericCell *cell = vtkGenericCell::New();

Using the 'cell' instance you can get interesting informations about the
triangle involved in the intersection, but I haven´t  used this feature.

Also, don´t forget to do sometthing like this before invoking the
IntersectWithLine method:

vtkCellLocator *locator = vtkCellLocator::New();
   locator->SetDataSet(vtkPolyData* data);
   locator->BuildLocator();

Hope this help

    Luca


On 11/20/06, Chavdar Papazov <chenkaz at yahoo.com> wrote:
>
> Dear VTK Users,
>
> would you explain to me how to use the method 'IntersectWithLine()' of the
> class vtkCellLocator.
> There are three versions of this method. The first one is:
>
> virtual vtkCellLocator::IntersectWithLine(double a0[3],
>                                                           double a1[3],
>                                                           double toi,
>                                                           double& t,
>                                                           double x[3],
>                                                           double
> pcoords[3],
>                                                           int& subid)
>
>
> In the html-doc there is no explanation of the parameters of the method,
> so I don't know how to call it.
> I have a vtkPolyData object and two points in 3D which define the line.
> And I want to check whether the line intersects the vtkPolyData object.
>
> Do you have any ideas?
> Thanks!
>
> Che
>
> ------------------------------
> Sponsored Link
>
> Degrees for working adults in as fast as 1 year. Bachelors, Masters,
> Associates. Top schools<http://forms.nextag.com/goto.jsp?url=/serv/main/buyer/education.jsp?doSearch=n&tm=y&search=wrkg_adults_1yr&s=3968&p=5036>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061121/76299ad3/attachment.htm>


More information about the vtkusers mailing list