Tips and tricks category

It would be nice to have a place to host all tricks, hacks, best practices and maybe even dark arts type shenanigans possible in VTK C++. Very much like the one at

I’d envision it to contain code snippets/methodologies targeted to intermediate/advanced C++ developers new to VTK.

Some trivial but greatly helpful stuff I can think of when writing this post,

  1. Get pointer access to cell structure (w/o invoking a copy)
  2. Invoke CopyStructure on vtkDataSets when possible. (I didn’t know this existed until I poked around VTK’s source)
  3. Thread-safe cell traversal
  4. Thread-safe point retrieval
  5. Best practices - filter development
  6. Usage of SafeDownCast to develop generic apps (vtkAlgorithm/vtkXMLUnstructuredDataReader derived)
  7. Similar… FastDownCast for vtkDataArray when the data type is known.

I’m sure there are many more in the rendering side of things. Ideally, these posts could be limited to the core C++ VTK library and avoid general C++, wrappers to VTK


Tricks, hacks, and best practices tend to be quite specific and may even contain code snippets and so they all change as VTK evolves.

I like discourse very much and it has awesome convenience features that would be useful for creating a tips&tricks collection (e.g., direct copy-paste of images), but long-term sustainability would require versioning of the content, which discourse cannot do.

A git repository that mirrors VTK repository’s versioning (or the VTK repository itself) would be a more suitable home of such knowledge base in the long term.

Yes. Apart from that, a clear distinction must exist as to what classifies under this category versus the VTK Examples. The line b/w the two should not be crossed as that defeats the purpose.