[vtkusers] Drawing half a million "vtkParametricEllipsoid"s
David Doria
daviddoria at gmail.com
Wed May 22 12:23:28 EDT 2013
On Wed, May 22, 2013 at 10:54 AM, VoodooCode <MaxSchererMax at gmail.com> wrote:
> I think I almost got it. I created the map, inserted the spheres and if I can
> manipulate each of them independently it should work. Using the actors I can
> rotate and scale the objects, but how to access a single sphere to apply its
> scaling and rotation?
>
> I added a new code snippet.
>
> //Sample start
>
> vtkSmartPointer<vtkSphereSource> baseSphere =
> vtkSmartPointer<vtkSphereSource>::New();
> baseSphere->SetRadius(1);
>
> glyph_->SetInput(polyMap_);
> glyph_->SetSourceConnection(baseSphere->GetOutputPort());
> glyph_->Update();
>
> mapper_->SetInputConnection(glyph_->GetOutputPort());
> for(int i = 0; i < radius.size(); i++)
> {
> //Configuration of the rotation/translation
> vtkSmartPointer<vtkMatrix4x4> transformationMatrix =
> vtkSmartPointer<vtkMatrix4x4>::New();
> vtkSmartPointer<vtkMatrixToLinearTransform> matrixToLinearTransform =
> vtkSmartPointer<vtkMatrixToLinearTransform>::New();
> configureMatrix(rotation[i], transformationMatrix);
> matrixToLinearTransform->SetInput(transformationMatrix);
> matrixToLinearTransform->Update();
>
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
>
> actor->SetMapper(???);
>
> actor->SetScale(radius.data);
> actor->SetUserTransform(matrixToLinearTransform);
> }
>
> //Sample end
As David mentioned, you need to place the data as PointData. Here are
a couple of glyph filter examples:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ColorGlyphs
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/OrientedGlyphs
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/Glyph3D
The TensorGlyph example needs some cleaning up/simplification, but
perhaps it will still give you some clues:
http://www.vtk.org/Wiki/VTK/Examples/Broken/TensorGlyph
As usual, when posting code snippets, it is much more helpful if you
can construct a minimal, compilable, self-contained example. We often
lose things like "What type is glyph_ in your previous snippet?"
"Where/Did you set the PointData?", etc.
David
More information about the vtkusers
mailing list