I was wondering if anyone has some good ideas as to a fast
way to find the intersection between a triangular surface and a plane
which goes through it?
Daphne,
Make your triangle PolyData (you can use UnstructuredGrid) and then just create a slice plane. Then you will get a line as the output polydata from the slicer.
The UGrid.cxx example in vtk/graphics.cxx shows how to do the UnstructuredGrid using VTK_TRIANGLE.
Heres how to slice (this is for a horizontal slice, for arbitrary dip
just set the normal to the plane and the rotation point differently):
// This you build as in the UGrid.cxx example
vtkUnstructuredGrid *uGrid;
float slicePoint[3],sliceNormal[3];
slicePoint[0] = X;
slicePoint[1] = Y;
slicePoint[2] = Z;
sliceNormal[0] = 0.0f;
sliceNormal[1] = 0.0f;
sliceNormal[2] = 1.0f;
vtkPlane *slicePlane = vtkPlane::New();
slicePlane->SetOrigin(slicePoint);
slicePlane->SetNormal(sliceNormal);
vtkCutter *cut = vtkCutter::New();
cut->SetInput(uGrid);
cut->SetCutFunction
(slicePlane);
regards,
john