[vtkusers] How to use the method "vtkCellLocator::IntersectWithLine()" ?
Chavdar Papazov
chenkaz at yahoo.com
Wed Nov 22 05:26:26 EST 2006
Hi Luca,
thanks for the reply. I've tried the method and it works fine.
But the problem is, that there is not just one intersection between a line and a vtkPolyData object. For example if we have a poly-sphere and a line, there could be two intersection points between the sphere and the line. And this method gives me only one point. It saves its coordinates in the "pline" argument (see below).
But how should I get all the intersection points?
Thanks!
Che
Luca Pallozzi Lavorante <lplavorante at gmail.com> wrote: 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
_______________________________________________
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
---------------------------------
Sponsored Link
Mortgage rates near historic lows: $150,000 loan as low as $579/mo. Intro-*Terms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061122/0e510409/attachment.htm>
More information about the vtkusers
mailing list