<div dir="ltr"><div><div>To get help you need at least to provide all 6 planes and line definition and results you get.<br></div><div>Small compilable code would also help.<br><br></div><div>Guessing is not needed.<br><div>
Depending on the orientation of the cube and line it may intersect 2, 4 or 6 planes.<br></div><div>Keep in mind you are talking about planes , not faces.<br><br></div><div>Alex<br></div><br><br></div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 5:00 AM, Doug Hoppes <span dir="ltr"><<a href="mailto:dhoppes@mbfbioscience.com" target="_blank">dhoppes@mbfbioscience.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> I’m trying to use the vtkplane::IntersectWithLine() method and it seems to be giving me some issues (which, most likely is on my part). I have a cube that I’m sending a line through. I need to find the plane where the
line enters and the one where the line exits. The way that I do this is to create 6 vtkplanes using (coordinates defined appropriately for each plane):<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">pPoint1</span>[0] = 0; <span style="color:#010001">
pPoint1</span>[1] = 0; <span style="color:#010001">pPoint1</span>[2] = 0;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">pPoint2</span>[0] = 0; <span style="color:#010001">
pPoint2</span>[1] = <span style="color:#010001">dfYRange</span>; <span style="color:#010001">
pPoint2</span>[2] = 0;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">pPoint3</span>[0] = <span style="color:#010001">dfXRange</span>;
<span style="color:#010001">pPoint3</span>[1] = 0; <span style="color:#010001">
pPoint3</span>[2] = 0;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkPlane</span>>
<span style="color:#010001">pPlane1</span> = <span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkPlane</span>>::<span style="color:#010001">New</span>();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">pPlane1</span>-><span style="color:#010001">SetOrigin</span>(<span style="color:#010001">pPoint1</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkTriangle</span>::<span style="color:#010001">ComputeNormal</span>(<span style="color:#010001">pPoint1</span>,
<span style="color:#010001">pPoint2</span>, <span style="color:#010001">pPoint3</span>,
<span style="color:#010001">normals</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">pPlane1</span>-><span style="color:#010001">SetNormal</span>(<span style="color:#010001">normals</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">When I call,
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">int</span><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">icheck</span> = <span style="color:#010001">pIntersectionPlane</span>-><span style="color:#010001">IntersectWithLine</span>(<span style="color:#010001">pLineStart</span>,
<span style="color:#010001">pLineEnd</span>, <span style="color:#010001">lineCoordinate</span>,
<span style="color:#010001">pIntersectionPoint</span>);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">the value of icheck is > 0 for 4 of the 6 planes. I don’t get it. From the documentation, seems that it should be > 0 for any plane that it intersects.
So, I would always assume that it would intersect with only 2 of the 6 planes. <u></u>
<u></u></span></p>
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">Any idea what’s going on?<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p>
<span class="HOEnZb"><font color="#888888">
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">Doug<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>