MantisBT - VTK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0013714 | VTK | (No Category) | public | 2012-12-07 16:29 | 2014-10-02 16:54 |
Reporter | David Doria | ||||
Assigned To | Andy Bauer | ||||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | 6.2.0 | |||
Project | TBD | ||||
Type | incorrect functionality | ||||
Summary | 0013714: vtkModifiedBSPTree IntersectWithLine does not work when VTK built in RELEASE mode | ||||
Description | The vtkModifiedBSPTree IntersectWithLine works if VTK is built in DEBUG mode, but not RELEASE mode. I have attached a screenshot of the scenario to show that the line clearly intersects the object. The demo code is: #include <vtkSmartPointer.h> #include <vtkPoints.h> #include <vtkPolyData.h> #include <vtkPointData.h> #include <vtkCellArray.h> #include <vtkMath.h> #include <vtkXMLPolyDataReader.h> #include <vtkModifiedBSPTree.h> #include <fstream> #include <limits> #include <sstream> int main(int, char *[]) { // Read the scene geometry vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New(); reader->SetFileName("corner.vtp"); reader->Update(); double p0[3] = {0, 0, 0}; double p1[3] = {22.2073, -15.8678, -96.2032}; vtkSmartPointer<vtkModifiedBSPTree> tree = vtkSmartPointer<vtkModifiedBSPTree>::New(); tree->SetDataSet(reader->GetOutput()); tree->BuildLocator(); float tolerance = .001; double t; double x[3]; double pcoords[3]; int subId = 0; vtkIdType cellId = 0; std::cout << "Casting ray between " << p0[0] << " " << p0[1] << " " << p0[2] << " and " << p1[0] << " " << p1[1] << " " << p1[2] << std::endl; // Perform the intersection using the tree int treeHit = tree->IntersectWithLine(p0, p1, tolerance, t, x, pcoords, subId, cellId); std::cout << "tree hit? " << treeHit << std::endl; if(treeHit) { std::cout << "tree intersection " << x[0] << " " << x[1] << " " << x[2] << std::endl; } // Do the intersection manually (not using the tree) unsigned int numberOfManualHits = 0; bool manualHit = false; for(vtkIdType cellIndex = 0; cellIndex < reader->GetOutput()->GetNumberOfCells(); ++cellIndex) { vtkIdType intersect = reader->GetOutput()->GetCell(cellIndex)->IntersectWithLine(p0, p1, tolerance, t, x, pcoords, cellId); if(intersect) { manualHit = true; break; } } if(manualHit) { std::cout << "manual intersection " << x[0] << " " << x[1] << " " << x[2] << std::endl; numberOfManualHits++; } std::cout << "manual hit? " << manualHit << std::endl; return EXIT_SUCCESS; } The output when VTK was built in DEBUG mode is (correctly): Casting ray between 0 0 0 and 22.2073 -15.8678 -96.2032 tree hit? 1 tree intersection 0.279686 -0.199844 -1.21162 manual intersection 0.279686 -0.199844 -1.21162 manual hit? 1 However, the output when VTK was built in RELEASE mode is (incorrectly): Casting ray between 0 0 0 and 22.2073 -15.8678 -96.2032 tree hit? 0 manual intersection 0.279686 -0.199844 -1.21162 manual hit? 1 We see here that the tree indicates that there was no intersection, when there should have been one. | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | demo.tar.gz (7,260) 2012-12-07 16:29 https://www.vtk.org/Bug/file/9364/demo.tar.gz | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2012-12-07 16:29 | David Doria | New Issue | |||
2012-12-07 16:29 | David Doria | File Added: demo.tar.gz | |||
2012-12-07 17:12 | David Doria | Note Added: 0029857 | |||
2012-12-08 09:23 | David Doria | Note Added: 0029858 | |||
2012-12-09 08:09 | David Doria | Note Added: 0029859 | |||
2012-12-09 08:15 | David Doria | Note Added: 0029860 | |||
2012-12-09 10:36 | David Doria | Note Added: 0029861 | |||
2014-10-02 16:14 | Andy Bauer | Assigned To | => Andy Bauer | ||
2014-10-02 16:54 | Andy Bauer | Note Added: 0033544 | |||
2014-10-02 16:54 | Andy Bauer | Status | backlog => closed | ||
2014-10-02 16:54 | Andy Bauer | Resolution | open => fixed | ||
2014-10-02 16:54 | Andy Bauer | Fixed in Version | => 6.2.0 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|