[vtkusers] Color AND scale glyphs

Bill Lorensen bill.lorensen at gmail.com
Mon Aug 28 16:23:31 EDT 2017


Scaling:
https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/ScaleGlyphs/

Color:
https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/ColorGlyphs/

Oriented:
https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/OrientedGlyphs/


On Mon, Aug 28, 2017 at 5:37 AM, M. Jordan <mjordan at live.at> wrote:
> Hi,
>
> i would like to color and scale some glyphs.
>
> I am using the following code to draw and scale the glyphs:
>
> vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
> vtkSmartPointer<vtkFloatArray> scales =
> vtkSmartPointer<vtkFloatArray>::New();
> scales->SetName("radius");
>
> for(int i = 0; i < 100; i++)
> {
>     points->InsertNextPoint(x-pos, y-pos, z-pos);
>     scales->InsertNextValue(radius);
> }
>
> vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
> polydata->SetPoints(points);
> polydata->GetPointData()->SetScalars(scales);
>
> // Glyph
> vtkSmartPointer<vtkSphereSource> sphereSource =
> vtkSmartPointer<vtkSphereSource>::New();
> vtkSmartPointer<vtkGlyph3D> glyph = vtkSmartPointer<vtkGlyph3D>::New();
> glyph->SetSourceConnection(sphereSource->GetOutputPort());
> glyph->SetInputData(scBalls_polydata);
> glyph->Update();
> // Mapper
> vtkSmartPointer<vtkPolyDataMapper> mapper  =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(scBalls_glyph3D->GetOutputPort());
> // Actor
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(actor);
> renderer->AddActor(actor);
>
> I don't know how to color AND scale the glyphs individually.  I would like
> to set
> any RGB color in the for loop.
>
> Thank you very much!
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list