Personnally on the CVS version vtkExtractSelectedFrustum return always nothing. It seems the normal of the planes are inversed. I changed this line of this function :<br><div class="gmail_quote"><pre>void vtkExtractSelectedFrustum::ComputePlane(int idx, <br>
double v0[3], <br> double v1[3], <br> double v2[3], <br> vtkPoints *points, <br>
vtkDoubleArray *norms)</pre>
{<br>[...]<br><pre>vtkMath::Cross(e0,e1,n);</pre>
[...]<br>}<br><br><font size="2">by <br></font><pre><font size="2">vtkMath::Cross(e1,e0,n);<br><br>And it seems to work for me. I don't know if i'm using this class bad. This is an example of <br>program i maded to test this class and it works with my trick and not with the CVS version<br>
(could someone read this program and say me if i'm wrong or not ?) :<br></font><br></pre>package org.jcae.vtk.test;<br><br>import javax.swing.JFrame;<br>import vtk.vtkActor;<br>import vtk.vtkCanvas;<br>import vtk.vtkConeSource;<br>
import vtk.vtkDataSetMapper;<br>import vtk.vtkExtractSelectedFrustum;<br>import vtk.vtkPolyDataMapper;<br>
<br>public class BugFrustum {<br><br> public static void main(String[] args)<br> { <br> JFrame frame = new JFrame();<br> frame.setDefaultCloseOperation<div>(JFrame.EXIT_ON_CLOSE);<br>
vtkCanvas canvas = new vtkCanvas();<br>
vtkExtractSelectedFrustum selector = new vtkExtractSelectedFrustum();<br> <br> // create sphere geometry<br> vtkConeSource cone = new vtkConeSource();<br> cone.SetHeight(3.0);<br> cone.SetRadius(1.0);<br>
cone.SetResolution(10);<br> // map to graphics objects<br> vtkPolyDataMapper map = new vtkPolyDataMapper();<br> map.SetInput(cone.GetOutput());<br><br> // actor coordinates geometry, properties, transformation<br>
vtkActor aSphere = new vtkActor();<br> aSphere.SetMapper(map);<br> aSphere.GetProperty().SetColor(0, 0, 1); // color blue<br> aSphere.GetProperty().SetRepresentationToWireframe();<br> canvas.GetRenderer().AddActor(aSphere);<br>
<br> frame.add(canvas);<br> frame.setSize(800, 600);<br> frame.setVisible(true);<br> <br> selector.CreateFrustum(new double[] {<br> -10.,-10.,-10.,1.0,<br> -10.,-10.,10.,1.0,<br>
-10.,10.,-10.,1.0,<br> -10.,10.,10.,1.0,<br> 10.,-10.,-10.,1.0,<br> 10.,-10.,10.,1.0,<br> 10.,10.,-10.,1.0,<br> 10.,10.,10.,1.0,<br> });<br> <br>
selector.SetInput(cone.GetOutput());<br> //UNCOMMENT TO CHECK THE BOUNDARIES<br> //selector.ShowBoundsOn(); <br> // UNCOMMENT TO SEE THAT THE frustum extractor doesn't work inside and outside the boundaries<br>
//selector.InsideOutOn();<br> selector.Update();<br> vtkActor actorFrustum = new vtkActor();<br> vtkDataSetMapper mapFrustum = new vtkDataSetMapper();<br> mapFrustum.SetInputConnection(selector.GetOutputPort());<br>
actorFrustum.SetMapper(mapFrustum);<br> canvas.GetRenderer().AddActor(actorFrustum);<br><br> canvas.lock();<br> canvas.GetRenderer().ResetCamera();<br> canvas.unlock();<br> //UNCOMMENT TO SEE THAT THE CONE IS IN THE BOUNDARIES<br>
//canvas.GetRenderer().RemoveActor(aSphere); <br> }<br>}</div><br><br><div class="gmail_quote">2008/5/30 Will Schroeder <<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a>>:<div>
<div></div><div class="Wj3C7c"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It is deliberate. a 1D cell has no edges. A 2D cell has no faces. The
mind set is that edges and faces are (n-1)-dimensional boundary
entities of a n-dimensional cell. There are other ways to address this;
changing this behavior at this point is not a good idea.<br>
<br>
W<div><div></div><div><br><br><div class="gmail_quote">On Fri, May 30, 2008 at 11:53 AM, Wilson, Andrew T <<a href="mailto:atwilso@sandia.gov" target="_blank">atwilso@sandia.gov</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm working on an application where I'm trying to select parts of a<br>
wireframe using vtkExtractSelectedFrustum. After some chasing, I've found<br>
the following strange behavior:<br>
<br>
The GetNumberOfEdges() method on vtkLine and vtkPolyLine returns 0. The<br>
GetEdge(int id) method returns NULL. This seems counterintuitive: those<br>
cells are nothing *but* edges. Is this deliberate?<br>
<br>
The downstream effect of this is that it's not possible for me to select in<br>
the middle of an edge because of the following bit of code. This is from<br>
vtkExtractSelectedFrustum.cxx around line 882:<br>
<br>
if (nedges < 1 &&)<br>
{<br>
delete[] vertbuffer;<br>
return this->IsectDegenerateCell(cell);<br>
}<br>
<br>
IsectDegenerateCell test cells for being in or out by examining the points.<br>
For line and polyline cells that's not sufficient -- we need to test the<br>
lines as well.<br>
<br>
The natural solution to this seems to be to have vtkLine and vtkPolyLine<br>
return something reasonable for GetNumberOfEdges() and GetEdge(). If that<br>
happens, there's code later in the method that will check the line segments<br>
against the frustum one by one, which is the right thing.<br>
<br>
Is there a reason not to do it this way? If I don't hear any objections<br>
I'll implement it and see if anything in the test cases breaks.<br>
<br>
-- Andy<br>
<br>
<br>
_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
</blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>518-371-3971 (phone and fax)
</font><br>_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br></blockquote></div></div></div><br><br clear="all"><br>-- <br><font color="#888888">Julian Ibarz
</font></div><br><br clear="all"><br>-- <br>Julian Ibarz