[vtk-developers] Adding IntersectWithRay function to CellLocator?

Biddiscombe, John A. biddisco at cscs.ch
Mon Feb 1 16:15:13 EST 2010


Rereading my reply makes me think that the method I usually use - which is to take the bounding diagonal of the data times 2 as the furthest point, would probably suffice. Don't use Infinity, just find the bounds of the locator data and add this onto the ray start.

JB

From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] On Behalf Of Biddiscombe, John A.
Sent: 01 February 2010 18:44
To: David Doria; VTK Developers
Subject: Re: [vtk-developers] Adding IntersectWithRay function to CellLocator?

Using a very large arbitrary number for the end of the ray may lead to errors in accuracy, because the intersection is based upon t=0 for start and t=1 for end of ray. The intersection routines use the t value of the intersection to compute the ipoint. It's better to let the user set his own ray ends to allow fine control of the kind of tolerances of error. A value of 1E6 for data with range of 1E-6 may lead to floating point rounding issues....

Adding a native intersect  with ray which does the calculation differently is another story

JB

From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] On Behalf Of David Doria
Sent: 01 February 2010 17:54
To: VTK Developers
Subject: Re: [vtk-developers] Adding IntersectWithRay function to CellLocator?

On Thu, Jan 21, 2010 at 7:35 PM, David Doria <daviddoria+vtk at gmail.com<mailto:daviddoria%2Bvtk at gmail.com>> wrote:
Often I use the IntersectWithLine function when I really want to intersect an infinite ray. I'll do something like this:

P2 = P1 + 1e5 * V (unit vector)
IntersectWithLine(..., P1, P2, ....)

Can we hide this "hack" from users with something like:

IntersectWithRay(P1, V)
{
double inf = std::numeric_limits<double>::infinity();
//clearly not actually infinity, but some very large number
//or we could compute the maximum projection along the line of the object to be intersected, and use this value + epsilon
P2 = P1 + inf * V (unit vector)
IntersectWithLine(P1, P2)
}

Thoughts?

David

Any thoughts on this?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100201/357dbfe8/attachment.html>


More information about the vtk-developers mailing list