<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
I wonder about the fiability of this class to determine whether a point lies inside a closed surface.<br>The implemented is based on ray casting, with a curious system of votes (vote=1 if a ray intersects the surface, 0 otherwise) which seems to mean that the ray-surface intersection test is not reliable.<br>So my question is: in which respect is the test reliable?<br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Fri, 8 Jun 2012 09:42:42 -0700<br>From: jochen.kling@email.de<br>To: vtkusers@vtk.org<br>Subject: Re: [vtkusers] vtkSelectEnclosedPoints without an input<br><br>Hello Federico,<br><br>
after some research and trial and error I found a solution for that. Here is a complete example (without rendering anything):<br><br>
<pre><span style="color:Green">/*
This is a backdoor that can be used to test many points for containment.
First initialize the instance, then repeated calls to IsInsideSurface()
can be used without rebuilding the search structures.
The complete method releases memory.
<br>In other words, you do have to feed the vtkSelectEnclosedPoints object
neither with polydata as the input nor with a surface.
*/</span>
#<span style="color:Blue">include</span> <vtkSphereSource.h>
#<span style="color:Blue">include</span> <vtkSmartPointer.h>
#<span style="color:Blue">include</span> <vtkPolyData.h>
#<span style="color:Blue">include</span> <vtkSelectEnclosedPoints.h>
<span style="color:Blue">int</span> main()
{
vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
sphereSource->SetCenter(<span style="color:Maroon">0</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>);
sphereSource->SetRadius(<span style="color:Maroon">1</span><span style="color:Maroon">.0</span>);
sphereSource->Update();
vtkPolyData* sphere = sphereSource->GetOutput();
<span style="color:Blue">double</span> testInside[<span style="color:Maroon">3</span>] = {<span style="color:Maroon">0</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>};
<span style="color:Blue">double</span> testOutside[<span style="color:Maroon">3</span>] = {<span style="color:Maroon">10</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>, <span style="color:Maroon">0</span><span style="color:Maroon">.0</span>};
vtkSmartPointer<vtkSelectEnclosedPoints> selectEnclosedPoints =
vtkSmartPointer<vtkSelectEnclosedPoints>::New();
selectEnclosedPoints->Initialize(sphere);
<span style="color:Blue">std</span>::<span style="color:Blue">cout</span> << selectEnclosedPoints->IsInsideSurface(testInside) << <span style="color:Blue">std</span>::<span style="color:Blue">endl</span>;
<span style="color:Blue">std</span>::<span style="color:Blue">cout</span> << selectEnclosedPoints->IsInsideSurface(testOutside) << <span style="color:Blue">std</span>::<span style="color:Blue">endl</span>;
<span style="color:Blue">return</span> EXIT_SUCCESS;
}
</pre>
<br><br>
with kind regards<br>
Jochen
        
<br><hr align="left" width="300">
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/vtkSelectEnclosedPoints-without-an-input-tp5713685p5713686.html" target="_blank">Re: vtkSelectEnclosedPoints without an input</a><br>
Sent from the <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" target="_blank">VTK - Users mailing list archive</a> at Nabble.com.<br><br>_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers</div>                                            </div></body>
</html>