[vtkusers] Possibly bug in vtkExtractSelectedFrustum ?
Julian Ibarz
julian.ibarz at gmail.com
Mon May 26 04:36:37 EDT 2008
Hello everyone,
I made a light program (in java but you could easily port it in C++ i think
and i need someone to try in C++ to be sure that it's not a Java binding
bug...) that use a vtkExtractSelectedFrustum but it does'nt work : the
output is always empty. Do you think the program is right ? If it is i think
it's a bug so i will make a report.
package org.jcae.vtk.test;
import javax.swing.JFrame;
import vtk.vtkActor;
import vtk.vtkCanvas;
import vtk.vtkConeSource;
import vtk.vtkDataSetMapper;
import vtk.vtkExtractSelectedFrustum;
import vtk.vtkPolyDataMapper;
public class BugFrustum {
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
vtkCanvas canvas = new vtkCanvas();
vtkExtractSelectedFrustum selector = new
vtkExtractSelectedFrustum();
// create sphere geometry
vtkConeSource cone = new vtkConeSource();
cone.SetHeight(3.0);
cone.SetRadius(1.0);
cone.SetResolution(10);
// map to graphics objects
vtkPolyDataMapper map = new vtkPolyDataMapper();
map.SetInput(cone.GetOutput());
// actor coordinates geometry, properties, transformation
vtkActor aSphere = new vtkActor();
aSphere.SetMapper(map);
aSphere.GetProperty().SetColor(0, 0, 1); // color blue
aSphere.GetProperty().SetRepresentationToWireframe();
canvas.GetRenderer().AddActor(aSphere);
frame.add(canvas);
frame.setSize(800, 600);
frame.setVisible(true);
selector.CreateFrustum(new double[] {
-10.,-10.,-10.,1.0,
-10.,-10.,10.,1.0,
-10.,10.,-10.,1.0,
-10.,10.,10.,1.0,
10.,-10.,-10.,1.0,
10.,-10.,10.,1.0,
10.,10.,-10.,1.0,
10.,10.,10.,1.0,
});
selector.SetInput(cone.GetOutput());
//UNCOMMENT TO CHECK THE BOUNDARIES
//selector.ShowBoundsOn();
// UNCOMMENT TO SEE THAT THE frustum extractor doesn't work inside
and outside the boundaries
//selector.InsideOutOn();
selector.Update();
vtkActor actorFrustum = new vtkActor();
vtkDataSetMapper mapFrustum = new vtkDataSetMapper();
mapFrustum.SetInputConnection(selector.GetOutputPort());
actorFrustum.SetMapper(mapFrustum);
canvas.GetRenderer().AddActor(actorFrustum);
canvas.lock();
canvas.GetRenderer().ResetCamera();
canvas.unlock();
//UNCOMMENT TO SEE THAT THE CONE IS IN THE BOUNDARIES
//canvas.GetRenderer().RemoveActor(aSphere);
}
}
--
Julian Ibarz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080526/498180be/attachment.htm>
More information about the vtkusers
mailing list