[vtkusers] Re: mesh intersecting algorithms
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Tue Feb 19 12:59:18 EST 2008
Leila Baghdadi wrote:
> Hi everyone,
>
> I am just wondering is there any algorithms implemented in vtk which
> determine the intersecting points between meshes.
>
>
> Thanks
>
> Leila
Hi Leila,
Sounds like this filter would do the job (have a look at the right
figure).
http://www.bioengineering-research.com/vtk/vtkCollisionDetectionFilter.htm
From TestCollisionDetection1.cxx you can get the (poly)line of
intersection with:
vtkCollisionDetectionFilter *collide =
vtkCollisionDetectionFilter::New();
collide->SetInputConnection(0, sphere0->GetOutputPort());
collide->SetMatrix(0, matrix0);
collide->SetInputConnection(1, sphere1->GetOutputPort());
collide->SetMatrix(1, matrix1);
collide->SetBoxTolerance(0.0);
collide->SetCellTolerance(0.0);
collide->SetNumberOfCellsPerBucket(2);
collide->SetCollisionModeToAllContacts();
collide->GenerateScalarsOn();
vtkCleanPolyData *clean = vtkCleanPolyData::New();
clean->SetInputConnection(collide->GetContactsOutputPort());
vtkStripper *stripper = vtkStripper::New();
stripper->SetInputConnection(clean->GetOutputPort());
stripper->Update();
Have a look at the full code of the test if you want to clip the meshes...
hth
Goodwin
More information about the vtkusers
mailing list