[vtkusers] Random Shift or Translation in vtkGlyph3D Duplicating Process

Chih-Wei Chiu jwchiu at csie.nctu.edu.tw
Thu May 2 11:53:11 EDT 2002


HOW TO DUPLICATE GLYPHS RANDOMLY?

vtkGlyph3D duplicates the source glyph on the dataset points, but I want to
add a
"perturbation". That is, the source glyph is not put at ***exactly*** where
the dataset points are, but at where a little away (translation) from those
points.

If I translate the glyph source before giving it to vtkGlyph3D:

<pesudocode>
source = vtkSphere
xform = vtkTransfrom
xform.Identity()
xform.Translate( random(), random(), random() )

transfilter = vtkTransformPolyDataFilter
transfilter.SetInput ( source.GetOutput() )
transfilter.SetTransform( xform )

duplicate = vtkGlyph3D
duplicate.SetInput( dataset )
duplicate.SetSource( transfilter.GetOutput() )

</pesudocode>

All glyphs will be shift with the ***same*** translation, and the net effect
is the entire dataset volume is shifted with the same degree. But what I
want is the every glyph is shifted by a ***different*** amount (determined
randomly). Is it possible?

Another possible way is to perturb the dataset before handling it to the
vtkGlyph3D, but I don't know how to do it.
--
Chih-Wei Chiu <http://www.csie.nctu.edu.tw/~jwchiu>
Computer Graphics and Geometry Modeling Laboratory,
Computer Science and Information Engineering Department,
National Chiao-Tung University, Taiwan





More information about the vtkusers mailing list