View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014143VTK(No Category)public2013-06-24 07:482014-01-03 08:51
ReporterDavid Doria 
Assigned ToWill Schroeder 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0014143: vtkClipPolyData with implicit function produces NANs
DescriptionIn this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/PolyData/ImplicitDataSetClipping [^]

I create a sphere (vtkPolyData) and clip it with an implicit cube
(vtkBox). The visual result of the clipping looks correct (the portion
of the sphere that is inside the box remains), but there are 68 cells
reported in the resulting clipped data (clipped->GetNumberOfCells()),
but I only count 20 (2 columns of 10 triangles).

The cells seem to be well formed, but there are tons of NAN points
that I guess the cells are referencing. At line 250ish in
vtkClipPolyData.cxx:

    // evaluate implicit cutting function
    for ( i=0; i < numberOfPoints; i++ )
      {
      s = clipScalars->GetComponent(cellIds->GetId(i),0);
      cellScalars->InsertTuple(i, &s);
      }

's' is getting set to -inf for many of the cells, which is my best
quick guess at what is causing the NANs.
TagsNo tags attached.
ProjectTBD
Typeincorrect functionality
Attached Filespng file icon ClipPolyData.png [^] (24,079 bytes) 2014-01-03 08:50


cxx file icon ImplicitDataSetClipping.cxx [^] (6,131 bytes) 2014-01-03 08:50

 Relationships

  Notes
(0032123)
Will Schroeder (manager)
2014-01-03 07:02
edited on: 2014-01-03 08:48

Investigating now.
There is definitely a problem, lots of bad points and scalars. Diving in now.

Okay this is user error, a very bad example of using a box to clip a sphere. Here is the litany of errors:
1. Using vtkImplicitDataSet -> You really need to set the OutValue. By default it is a very large number which resulted in the NaNs.
2. Having said that, it is difficult in this case to choose any reasonable out value. Using large, negative numbers causes the clipped triangles on the edge to be "squashed" into little slivers. So although only 20 triangles were counted by eye, there were actually many more, most of which were squashed.
3. Using a cube source and then using Delaunay3D to create a 3D dataset which is then used as an implicit function is way overkill. It's better just to use the implicit function vtkBox.
4. Doing so fixes the problem. I have uploaded a final image and the working code.

(0032124)
Will Schroeder (manager)
2014-01-03 08:51

User error. Test program modified and fixed.

 Issue History
Date Modified Username Field Change
2013-06-24 07:48 David Doria New Issue
2014-01-03 07:02 Will Schroeder Note Added: 0032123
2014-01-03 07:02 Will Schroeder Assigned To => Will Schroeder
2014-01-03 07:02 Will Schroeder Status backlog => active development
2014-01-03 07:54 Will Schroeder Note Edited: 0032123
2014-01-03 08:48 Will Schroeder Note Edited: 0032123
2014-01-03 08:50 Will Schroeder File Added: 0014143-ClipPolyData.png
2014-01-03 08:50 Will Schroeder File Added: ImplicitDataSetClipping.cxx
2014-01-03 08:51 Will Schroeder Note Added: 0032124
2014-01-03 08:51 Will Schroeder Status active development => closed
2014-01-03 08:51 Will Schroeder Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team