VTK/MinimalExample

From KitwarePublic
< VTK
Revision as of 15:26, 20 August 2012 by Daviddoria (talk | contribs) (Created page with "When asking questions on the mailing list, the goal must be to entice the readers to help you with your question. This means you should provide as much detail as you can about yo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

When asking questions on the mailing list, the goal must be to entice the readers to help you with your question. This means you should provide as much detail as you can about your situation. This includes things such as your operating system, compiler version, etc.

Most importantly, you should provide a minimal, compilable, self-contained example of the problem.

Minimal Do not include code that is not relevant to the problem. For example, if you are having a problem getting the neighbor of a cell that you click on (in the click event of an InteractorStyle), and getting to that point is not involved in the problem, then you should make the example specify the cell that you want to get the neighbor of programmatically, without involving any interaction or visualization.

Compilable

Do not send code like this:

polydata = sphereSource->GetOutput();

instead, make sure that readers can copy+paste+compile:

  1. include <vtkPolyData.h>
  2. include <vtkSphereSource.h>
  3. include <vtkSmartPointer.h>

int main() {

 vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New();
 sphereSource->Update();
 vtkPolyData* polydata;
 polydata = filter->GetOutput();
 return 0;

}

Self-contained Unless the problem is "I am having trouble reading this file", do not include external files in your examples. That is, rather than use a vtkXMLPolyDataReader, use a vtkSphereSource. Rather than read a text file with parameters, or accept command line parameters, hard code them into the example. Again, Copy+Paste+Compile is what makes life easy for the readers, and hence will get you an answer with higher probability.