vtkDataSetTriangleFilter simply inserts faces into a hash table and counts uses of the faces. This is strictly not speaking consistent with the topology of the cell/dataset hence the different results.
Also, vtkDataSetTriangleFilter is now slower than vtkGeometryFilter (especially when building VTK threaded) and uses much more memory. At some point PV will switch to using vtkGeometryFilter - this switch is harder than it might seem because vtkDataSetTriangleFilter produces different/incorrect output in some situations. However, vtkDataSetSurfaceFilter handles certain types of higher order cells (e.g., Bezier) while vtkGeometryFilter currently does not.
I’m wondering if we should place some links from the documentation in the C++ header files pointing to the examples (including examples-related resources like VTK file formats). I’m a little leery about adding this kind of dependency, but with VTK examples now in great shape, maybe it’s time to think about doing so. Comments?
What do you think @ben.boeckel@sankhesh? Would it be easy to parse this JSON file to produce a list of relevant VTK Examples for each VTK class? It would be a largish file as it would contain the links to the vtk class and the vtk examples classes. Of course some cells will be empty.
@amaclean The cross-reference between the doxygen documentation and vtk-examples would be a great addition. Currently, the perl script doc_class2example.pl does the cross-referencing between in-source examples and classes in doxygen documentation. We could modify it to include parsing of this new JSON file as well. I am not adept at perl and if required, we can make it a python script.
Ok here is a json file vtk_vtk-examples_xref.zip (118.0 KB) containing the VTK class and corresponding example by language. Just unzip it and you can play around with it using xref.py (1021 Bytes). If you think it is acceptable and easy to use from the VTK end, I’ll commit it.
Data layout:
Columns are the VTK classes.
Indexes are the languages: CSharp, Cxx, Java, Python; for these rows, each cell contains the comma separated list of relevant examples or None.
The index VTKLink contains the relevant link to the VTK class description.
In each cell the links are in the usual markdown format:
Been thinking about this, a better json file is this vtk_vtk-examples_xref.zip (225.2 KB) the data layout is the same as above however the markdown has been replaced by (key, value) pairs and all classes used in the examples are included now so the file is a bit larger. The markdown format is easily created, namely [key](value).
This layout makes it easier to get statistics from the file like this:
Number of classes with examples 868
Number of classes with examples by language:
CSharp 188
Cxx 860
Java 264
Python 403
Largest number of examples by language and class
CSharp Cxx Java Python
vtkRenderWindow 102 vtkNew 985 vtkRenderWindowInteractor 183 vtkNamedColors 316
vtkRenderer 101 vtkRenderWindow 854 vtkRenderer 177 vtkRenderer 303
vtkActor 83 vtkRenderer 850 vtkRenderWindow 177 vtkRenderWindowInteractor 302
vtkPolyDataMapper 72 vtkNamedColors 843 vtkNamedColors 164 vtkRenderWindow 295
vtkPolyData 35 vtkRenderWindowInteractor 842 vtkActor 157 vtkActor 280
vtkSphereSource 31 vtkActor 682 vtkPolyDataMapper 140 vtkPolyDataMapper 239
vtkPoints 29 vtkProperty 643 vtkSphereSource 76 vtkSphereSource 83
vtkCellArray 18 vtkPolyDataMapper 580 vtkPoints 35 vtkPoints 76
vtkDataSetMapper 14 vtkPolyData 471 vtkPolyData 33 vtkPolyData 62
vtkImageViewer2 11 vtkCamera 408 vtkDataSetMapper 18 vtkDataSetMapper 59
@sankesh The JSON file is now on the web: vtk_vtk-examples_xref.json. This will be automatically updated whenever the vtk-examples web pages are updated.
This program xref.py (4.3 KB), when run with no parameters will automatically download the file from the web. It will produce the statistics as above. I hope you will find it useful both as a check of the file and it also how to download the url. It is a bit kludgy but it works!
When thinking about the examples and given that some classes (e.g. VTKNew) have over 900 examples, it is essential to limit the examples to say just five or less for each language. It might be nice to randomly select five examples when there are more than five for a given class. Thus the examples will change whenever the documentation is updated. What do you and others think?
@sankesh Here is an update to xref.py (5.9 KB) , I have added a function to randomly select five examples for a given VTK class and language see:
def ramdom_sample(d, vtk_class, lang, num=5):
"""
For the given keys provide a random sample of examples.
:param d: The dictionary.
:param vtk_class: The VTK Class e.g. vtkActor.
:param lang: The language, e.g. Cxx.
:param num: The number of values.
:return: A markdown formatted list of examples or None.
"""
Actually this JSON file is really useful (to me at least), so I will put a Python script into vtk_examples for users to query on VTK Class and language.