[vtkusers] Frustum Culling
Michael Knopke
Michael.Knopke at gmx.de
Thu Mar 8 04:45:26 EST 2007
Thanks a lot Dave,
I actually already found the codepiece before but didn't believe the
function
EvaluateFunction would do the trick. Now it works but very slow of course.
Since I only work with pointdata (vtkImageData) I can't really use your
advice to speed up the process. Or am I wrong and should test cells?
First I'll try to use vtkThreadedImageAlgorithm instead of vtkImageAlgorithm
to use multicores.
Then I think I need something like octree to exclude a lot of points from
calculation.
I've seen there already exist: vtkHyperOctree hope I can use it for the
task.
Btw: Why does posting to the forum always opens up a new thread? I click on
the email-address of the last poster in the thread, it opens Office and
should
Have gotten information "in-reply-to ." but still it doesn't work.
Regards and thanks again
Michael
To answer your original question: look at line 557. This tests a point
against the plane equations that define the frustum (when this->ExactTest is
off).
If you decide to backport ExtractSelectedFrustum this explanation may help.
The algorithm it uses (when this->ExactTest is on) comes from Ned Greene,
Graphics Gems IV, 1994, p 74-82. What it does is, instead of testing each
vertex of a cell against all six plane equations that define the frustum,
you can determine which vertex is nearest and farthest to each of the
planes. By testing just those two vertices against the plane equations you
can quickly reject the cells that are completely outside of the frustum and
quickly accept the cells that are completely inside the frustum. The cells
that are neither completely in or out are then clipped to determine if they
really do intersect.
In either case when the PassThrough flag is on, it runs through each cell,
uses one of the above options to determine if it is in or not and then puts
that result into the vtkInsidedness array.
To test if a dataset has that array just do:
vtkDataArray *insidedness = ds->GetCellData()->GetArray("vtkInsidedNess);
//or GetPointData as the case may be
if (insidedness == NULL)
{
cerr << "It doesn't have it."
}
cheers,
Dave DeMarle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070308/cdb740c6/attachment.htm>
More information about the vtkusers
mailing list