MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0001629 | VTK | (No Category) | public | 2005-03-01 13:49 | 2016-08-12 09:54 |
| Reporter | Mathieu Malaterre | ||||
| Assigned To | Dave DeMarle | ||||
| Priority | low | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Project | |||||
| Type | |||||
| Summary | 0001629: vtkOBBTree Inside | ||||
| Description | http://public.kitware.com/pipermail/vtkusers/2003-May/067563.html [^] import vtk.*; // Program to test that vtkOBBTree.InserOrOutside has a bug, because when I create // some points and test if they are inside a surface, sometimes it says that it is // true, but if you draw the points then it seems not is true. public class InsideOutsideTest { static { System.loadLibrary("vtkCommonJava"); System.loadLibrary("vtkIOJava"); System.loadLibrary("vtkGraphicsJava"); System.loadLibrary("vtkRenderingJava"); }; public static void main(String[] args) { if (args.length > 0) { int n = 100; if (args.length > 1) { try { n = Integer.valueOf(args[1]).intValue(); } catch (NumberFormatException e) {} } // Read the surface vtkPolyDataReader reader = new vtkPolyDataReader(); reader.SetFileName(args[0]); reader.Update(); vtkPolyData surface = reader.GetOutput(); // vtkConeSource source = new vtkConeSource(); // vtkSphereSource source = new vtkSphereSource(); // vtkCubeSource source = new vtkCubeSource(); // vtkCylinderSource source = new vtkCylinderSource(); // source.Update(); // vtkPolyData surface = source.GetOutput(); // Build the OBBTree to test random points vtkOBBTree obbTree = new vtkOBBTree(); obbTree.SetDataSet(surface); obbTree.SetMaxLevel(10); obbTree.BuildLocator(); // Create the points polydata vtkPolyData points = new vtkPolyData(); points.SetPoints(new vtkPoints()); points.SetVerts(new vtkCellArray()); // Points are located inside surface bounds double[] bb = surface.GetBounds(); for (int i = 0; i < n; i++) { // Get a new random point double[] point = new double[3]; point[0] = bb[0] + Math.random() * (bb[1] - bb[0]); point[1] = bb[2] + Math.random() * (bb[3] - bb[2]); point[2] = bb[4] + Math.random() * (bb[5] - bb[4]); // Get new random points while they are not inside the surface while (obbTree.InsideOrOutside(point) != -1) { point[0] = bb[0] + Math.random() * (bb[1] - bb[0]); point[1] = bb[2] + Math.random() * (bb[3] - bb[2]); point[2] = bb[4] + Math.random() * (bb[5] - bb[4]); } // Add the point to the polydata points.GetPoints().InsertNextPoint(point); points.GetVerts().InsertNextCell(1); points.GetVerts().InsertCellPoint(i); } // Create the surface actor vtkPolyDataMapper surfaceMapper = new vtkPolyDataMapper(); surfaceMapper.SetInput(surface); vtkLODActor surfaceActor = new vtkLODActor(); surfaceActor.SetMapper(surfaceMapper); // Create the OBBTree actor vtkPolyData obb = new vtkPolyData(); obbTree.GenerateRepresentation(5, obb); vtkPolyDataMapper obbMapper = new vtkPolyDataMapper(); obbMapper.SetInput(obb); vtkActor obbActor = new vtkActor(); obbActor.SetMapper(obbMapper); obbActor.GetProperty().SetColor(1.0, 0.0, 0.0); obbActor.GetProperty().SetRepresentationToWireframe(); // Create the points actor (using glyphs) vtkSphereSource glyph = new vtkSphereSource(); glyph.SetRadius(0.1); glyph.SetPhiResolution(3); glyph.SetThetaResolution(3); vtkGlyph3D glyphs = new vtkGlyph3D(); glyphs.SetInput(points); glyphs.SetSource(glyph.GetOutput()); glyphs.Update(); vtkPolyDataMapper pointsMapper = new vtkPolyDataMapper(); pointsMapper.SetInput(points); // pointsMapper.SetInput(glyphs.GetOutput()); vtkLODActor pointsActor = new vtkLODActor(); pointsActor.SetMapper(pointsMapper); pointsActor.GetProperty().SetColor(1.0, 1.0, 0.0); // Create the renderer and add the actors vtkRenderer renderer = new vtkRenderer(); renderer.AddActor(surfaceActor); renderer.AddActor(obbActor); renderer.AddActor(pointsActor); // Create the window vtkRenderWindow window = new vtkRenderWindow(); window.AddRenderer(renderer); window.SetSize(500, 500); // Create the interactor vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow(window); iren.Initialize(); iren.Start(); } else { System.out.println("Error: \"InsideOutsideTest <filename (byu files)> [npoints]\""); } } } | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2008-11-30 09:22 | Mathieu Malaterre | Assigned To | Mathieu Malaterre => David Cole | ||
| 2011-01-19 10:14 | David Cole | Assigned To | David Cole => | ||
| 2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) | ||
| 2013-06-05 17:07 | Jean-Christophe Fillion-Robin | Note Added: 0030937 | |||
| 2013-07-22 19:05 | Dave DeMarle | Note Added: 0031209 | |||
| 2013-07-22 19:05 | Dave DeMarle | Status | backlog => expired | ||
| 2013-07-22 19:05 | Dave DeMarle | Assigned To | => Dave DeMarle | ||
| 2016-08-12 09:54 | Kitware Robot | Note Added: 0036772 | |||
| 2016-08-12 09:54 | Kitware Robot | Status | expired => closed | ||
| 2016-08-12 09:54 | Kitware Robot | Resolution | open => moved | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||