[vtkusers] How to use the docs efficiently as a newbie to vtk?

David Doria daviddoria+vtk at gmail.com
Fri Dec 18 16:08:34 EST 2009


On Fri, Dec 18, 2009 at 2:22 PM,  <lynx.abraxas at freenet.de> wrote:
> Hello vtk programmers!
>
>
> I  just  tried to figure out how I could have managed to get normals of a mesh
> without any examples. Since then I feel very lost...
> Concider one is a newbie to vtk and somehow one got  an  instance  of  a  mesh
> (vtkPolyData).
> Now I want to get a list of all the cell normals so I'd do as follows:
>
> - Search in the class index (http://www.vtk.org/doc/nightly/html/classes.html)
> for anything containing normal; I'd find vtkPolyDataNormals
> - There I get to know it does what I need (if I select correct switches)
> - I've learned that the result is in .GetOutput() which isn't mentioned  there
> so I look in the superclass (vtkPolyDataAlgorithm)
> -  In  vtkPolyDataAlgorithm  I  find  GetOutput()  which  yiels an instance of
> vtkPolyData
>
> --There I have the first disappointment: The output is not the normals...
>
> - So I go to vtkPolyData: There I  don't  find  anything  having  to  do  with
> normals so I go to the super class again (vtkPointSet)...
> - In vtkPointSet nothing so up to vtkDataSet
> - In vtkDataSet I find GetCellData()
>
> --It  needs  some  abstract thinking to see that its result leads closer to my
> normals...
>
> - Having some vtkCellData I go on to vtkCellData Class Reference
> - Nothing about normals there so I go up to vtkDataSetAttributes
> - Finally I find GetNormals(); it returns vtkDataArray
>
> --Now I wonder: What is vtkDataArray???
>
> - I go vtkDataArray Class Reference: Seems to hold any kind of data array...
>
> --How then do I know what data type is in the array that GetNormals() returns?
> Is  it  char, int, float, double...? In the exampe vtkFloatArray::SafeDownCast
> is used. Why not vtkDoubleArray::SafeDownCast? How would I know it's not  some
> integer?  (I  know  for normals that wouldn't make much sense but else where I
> might not be able to exclude this so easily)
>
>
> Well, now, after showing my way through the labyrinth, my big question:
> Is this the way You all go if You can't find an example for Your problem?
> Can all this  be done much easier?
> Since I know a bit of blenders API I  must  say  there  the  way  through  the
> labyrinth is much more straight forward.
>
> Just  getting  to  my  own  simple  vtk-program  by plugging parts of examples
> together makes me feel very clumsy and lost. How to improve in this?
>
>
> Thaks for any help and advice on this.
> Lynx

Lynx,

On such a big system like this it is very tough. Hence my big push for
lots of examples! When you become VERY dedicated to VTK it gets a bit
easier, but the learning curve, as you've seen,  is pretty steep. I've
tried to bring it to everyone's attention that it is likely that a
LARGE majority of users do not want to put in this much effort, they
just want to use an occasional tool or two from the toolkit (if anyone
has any actual statistics or something, please correct me, but from my
small sample of experience it is what I'd wager). This is where the
examples are most helpful.

The "List of all members" link on each class page has been a big help
for me. I used to go up the hierarchy one class at a time as you
mentioned, but this link shows you all of the possible functions that
can be called on a class. Even with that, it's still hard to sort
through the data types, etc. I'd say the best thing to do is help with
the examples and documentation so that we can alleviate this issue for
the next generation of VTKers. As you do this, you'll get the hang of
it :)

David D.



More information about the vtkusers mailing list