[vtkusers] How to change source in vtkProgrammableGlyphFilter

Eric E. Monson emonson at cs.duke.edu
Tue Aug 24 09:45:56 EDT 2010


Hey Jong,

Just so you know, if you have an attribute that describes which type of glyph (sphere, cube,...) that you want at each vertex, then vtkGlyph3D allows you to create a table of glyphs to index into with this attribute. The only problem I've had with this (besides how to set it up :), is that it doesn't seem to copy attributes from the original data set to the glyphed data set. But, it does give you one way to control which source shape shows up at which point.

I probably have a Python example someplace if you're interested.

-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Aug 24, 2010, at 9:31 AM, Jong Youl Choi wrote:

> You are right. The code I showed has no fancy thing yet. Basically, I
> want to assign a different glyph on each vertex (or point) so that a
> graph looks like a mixture of sphere, cube, cone, etc.
> 
> Thanks,
> Jong
> 
> On Tue, Aug 24, 2010 at 7:22 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> On Mon, Aug 23, 2010 at 11:26 PM, Jong Youl Choi <jychoi at indiana.edu> wrote:
>>> 
>>> Hi all,
>>> 
>>> I have tried to change a source (from sphere to cone) in
>>> vtkProgrammableGlyphFilter with no luck. My code is as follow:
>>> 
>>>        vtkProgrammableGlyphFilter *glyph =
>>> vtkProgrammableGlyphFilter::New();
>>>        vtkSphereSource *sphere = vtkSphereSource::New();
>>>        glyph->SetInput(plot); // plot is vtkPolyData
>>>        glyph->SetSource(sphere->GetOutput()); // sphere is vtkSphereSource
>>>        glyph->SetGlyphMethod(CalcGlyph, glyph);
>>> 
>>> And CalcGlyph is defined:
>>> 
>>> void CalcGlyph(void *arg)
>>> {
>>>        vtkProgrammableGlyphFilter *glyph = (vtkProgrammableGlyphFilter*)
>>> arg;
>>>        VTK_CREATE(vtkConeSource, cone);
>>>        glyph->SetSource(cone->GetOutput());  // Tried to reset the source
>>> 
>>>        double xyz[3];
>>>        glyph->GetPoint(xyz);
>>> 
>>>        cone->SetCenter(xyz);
>>> }
>>> 
>>> Is there any way to replace or change the source initially defined in
>>> vtkProgrammableGlyphFilter? Thank you for your help in advance.
>>> 
>>> Thanks,
>>> Jong
>>> 
>>> --
>>> Jong Youl Choi
>> I'm not familiar with vtkProgrammableGlyphFilter, but it doesn't sound like
>> you're doing anything that vtkGlyph3D can't do:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ScaleGlyphs
>> David
>> 
> 
> 
> 
> -- 
> Jong Youl Choi
> Dept. of Computer Science
> Indiana University at Bloomington
> Homepage: http://www.cs.indiana.edu/~jychoi
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list