<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>JB<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> vtk-developers-bounces@vtk.org
[mailto:vtk-developers-bounces@vtk.org] <b>On Behalf Of </b>Biddiscombe, John
A.<br>
<b>Sent:</b> 01 February 2010 18:44<br>
<b>To:</b> David Doria; VTK Developers<br>
<b>Subject:</b> Re: [vtk-developers] Adding IntersectWithRay function to
CellLocator?<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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....<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Adding a native intersect  with ray which does the
calculation differently is another story<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>JB<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> vtk-developers-bounces@vtk.org
[mailto:vtk-developers-bounces@vtk.org] <b>On Behalf Of </b>David Doria<br>
<b>Sent:</b> 01 February 2010 17:54<br>
<b>To:</b> VTK Developers<br>
<b>Subject:</b> Re: [vtk-developers] Adding IntersectWithRay function to
CellLocator?<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<div>

<p class=MsoNormal>On Thu, Jan 21, 2010 at 7:35 PM, David Doria <<a
href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>>
wrote:<o:p></o:p></p>

<div>

<p class=MsoNormal>Often I use the IntersectWithLine function when I really
want to intersect an infinite ray. I'll do something like this:<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>P2 = P1 + 1e5 * V (unit vector)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>IntersectWithLine(..., P1, P2, ....)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Can we hide this "hack" from users with something
like:<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>IntersectWithRay(P1, V)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>{<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>double inf
= std::numeric_limits<double>::infinity(); <o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>//clearly not actually infinity, but some very large number<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>//or we could compute the maximum projection along the line
of the object to be intersected, and use this value + epsilon<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>P2 = P1 + inf * V (unit vector)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>IntersectWithLine(P1, P2)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>}<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Thoughts?<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p> </o:p></p>

<div>

<p class=MsoNormal>David<o:p></o:p></p>

</div>

</div>

</div>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<p class=MsoNormal>Any thoughts on this?<o:p></o:p></p>

<div>

<p class=MsoNormal><br clear=all>
Thanks,<br>
<br>
David<o:p></o:p></p>

</div>

</div>

</div>

</div>

</body>

</html>