[vtkusers] Glyph3D questions

John Biddiscombe biddisco at cscs.ch
Fri Aug 26 03:23:06 EDT 2005


Using vtk from recent CVS (glyph3D has changed a lot since vtk4.4), to 
display a different object for each type, with a differnet colour, I use 
this snippet. In this case data scaling is off, but if you wanted to do 
scaling too then you can add another SetInputArrayToProcess call. 
Likewise for orientation. If you can't get orientation working, then ask 
me again and I'll have another look inside the glyph3D code, I cant 
remember if orientation can be specified separately from other scalars etc.

    NodeGlyphs->SetInput(NodeData);
    NodeGlyphs->SetColorModeToColorByScalar();
    NodeGlyphs->SetScaleModeToDataScalingOff();
    NodeGlyphs->SetScaleFactor(0.25);
    NodeGlyphs->SetScaling(1);
    NodeGlyphs->SetIndexModeToScalar();
    
NodeGlyphs->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS, 
"nodeTypes");
    
NodeGlyphs->SetInputArrayToProcess(3,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS, 
"nodeColours");

    for (int i=0; i<this->NumGlyphObjects; ++i) {
      NodeGlyphs->SetSource(i, this->GlyphObjects[i]);
    }
    NodeGlyphs->SetRange(0,NODET_MAX);
    NodeGlyphs->Update();

In the above code, we assume that there is an array called "nodeTypes" 
and another "nodeColours" which is present on the pointdata of the 
NodeData object.

JB


Roger Blum wrote:

>Hello,
>
>I have checked the manual, examples and news list but couldn't find the
>solution to my problem.
>
>I would like to use a vthGlyph3D filter to display my data.
>For each glyph I have
>- a point (X,Y,Z)
>- a direction (X,Y,Z)
>- a color code (1,...,n)
>- a type code (1,...,n)
>
>With this information I would like to show the glyphs (type depending on 
>type code)
>with a specific color (depending on color code) at a position (point) with a 
>direction
>at a fixed size (not influenced by zooming).
>
>How do I have to set up and connect the needed objects so my vtkGlyph3D 
>object
>generates the desired output?
>
>Thanks for your help,
>Roger 
>
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82





More information about the vtkusers mailing list