VTK/MinimalExample: Difference between revisions
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...") |
Daviddoria (talk | contribs) mNo edit summary |
||
Line 3: | Line 3: | ||
Most importantly, you should provide a minimal, compilable, self-contained example of the problem. | Most importantly, you should provide a minimal, compilable, self-contained example of the problem. | ||
Minimal | * '''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. | 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 | * '''Compilable''' | ||
Do not send code like this: | Do not send code like this: | ||
<source lang="cpp"> | |||
polydata = sphereSource->GetOutput(); | polydata = sphereSource->GetOutput(); | ||
</source> | |||
instead, make sure that readers can copy+paste+compile: | instead, make sure that readers can copy+paste+compile: | ||
<source lang="cpp"> | |||
#include <vtkPolyData.h> | #include <vtkPolyData.h> | ||
#include <vtkSphereSource.h> | #include <vtkSphereSource.h> | ||
Line 27: | Line 30: | ||
return 0; | return 0; | ||
} | } | ||
</source> | |||
Self-contained | * '''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. | 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. |
Revision as of 15:29, 20 August 2012
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:
<source lang="cpp"> polydata = sphereSource->GetOutput(); </source>
instead, make sure that readers can copy+paste+compile:
<source lang="cpp">
- include <vtkPolyData.h>
- include <vtkSphereSource.h>
- include <vtkSmartPointer.h>
int main() {
vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->Update();
vtkPolyData* polydata; polydata = filter->GetOutput(); return 0;
} </source>
- 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.