MantisBT - VTK
View Issue Details
0015003VTK(No Category)public2014-09-19 06:132014-10-02 15:36
Jorge 
 
normalminoralways
closedno change required 
 
 
TBD
incorrect functionality
0015003: Wrong result from vtkImplicitPolyDataDistance + vtkSampleFunction
Attached is a test code to reproduce a bug with a combination of vtkImplicitPolyDataDistance + vtkSampleFunction.

In this test a triangle mesh of only one connected component is set as input to vtkImplicitPolyDataDistance then an implicit function is sampled with vtkSampleFunction. The result is contoured with vtkImageMarchingCubes and the vtkPolyData resulting from this last step shows more than one connected component.

Attached is also the snapshot of the result.

The test has being executed on reelease 6.1.
hackaton
? Bug_ImplicitPolyDataDistance_01.tcl (1,076) 2014-09-19 06:13
https://www.vtk.org/Bug/file/9718/Bug_ImplicitPolyDataDistance_01.tcl
? fix_mesh.vtk (2,026,553) 2014-09-19 06:14
https://www.vtk.org/Bug/file/9719/fix_mesh.vtk
? fix_mesh_contour.vtk (3,295,017) 2014-09-19 06:17
https://www.vtk.org/Bug/file/9720/fix_mesh_contour.vtk
png fix_mesh.png (61,349) 2014-09-19 06:18
https://www.vtk.org/Bug/file/9721/fix_mesh.png
png

png mesh_iso0_contour_after_SampleFunction.png (85,419) 2014-09-30 03:21
https://www.vtk.org/Bug/file/9730/mesh_iso0_contour_after_SampleFunction.png
png

cxx TestPolyDataDistance.cxx (1,533) 2014-09-30 03:30
https://www.vtk.org/Bug/file/9731/TestPolyDataDistance.cxx
Issue History
2014-09-19 06:13JorgeNew Issue
2014-09-19 06:13JorgeFile Added: Bug_ImplicitPolyDataDistance_01.tcl
2014-09-19 06:14JorgeFile Added: fix_mesh.vtk
2014-09-19 06:17JorgeFile Added: fix_mesh_contour.vtk
2014-09-19 06:18JorgeFile Added: fix_mesh.png
2014-09-30 03:21JorgeFile Added: mesh_iso0_contour_after_SampleFunction.png
2014-09-30 03:30JorgeFile Added: TestPolyDataDistance.cxx
2014-09-30 03:37JorgeNote Added: 0033381
2014-09-30 03:41JorgeTag Attached: hackaton
2014-10-02 15:32Shawn WaldonNote Added: 0033528
2014-10-02 15:36Shawn WaldonReproducibilityhave not tried => always
2014-10-02 15:36Shawn WaldonStatusbacklog => closed
2014-10-02 15:36Shawn WaldonResolutionopen => no change required

Notes
(0033381)
Jorge   
2014-09-30 03:37   
The file TestPolyDataDistance.cxx, attached to this report, reproduce the underlying bug. In this test it is evaluated the distance at two points which are clearly outside the body because they are both outside the bounding box. For both points the distances computed should have the same sign but the results are two distances with different sign:

bounds = [8.73729, 113.889, -24.3675, 160.521, 181.872, 243.717]
[20.149, 214.995, 204.775] ==> -75.4122
[3.61978, 205.145, 204.775] ==> 81.7696
(0033528)
Shawn Waldon   
2014-10-02 15:32   
Short answer: the dataset is bad.

Long answer: There is a face that hangs off the end of the tube and whose normal is back along the tube. This normal is corrupting the calculation when this face or a point on it is the closest point to the query point. Since the surface normals are used to calculate the sign.