<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif" size="-1">Hello again.</font><br>
<br>
<font face="Helvetica, Arial, sans-serif" size="-1">I had a quick look
into the example</font><br>
<font face="Helvetica, Arial, sans-serif" size="-1">There were
different things "wrong"</font><br>
<small><br>
</small>
<ul>
<li><small><font face="Helvetica, Arial, sans-serif">There had to be
some vector components you set to the points.<br>
</font></small></li>
<li><small><font face="Helvetica, Arial, sans-serif">The code you
commented with "<span class="co1">//create anything you want here, we
will use a cube for the demo" </span>is crucial to the glyph.<br>
It desribes how the glyh will look like. If you set a cube the glyp tip
will look like a cube.<br>
If you set a sphere the glyph tip will look like a sphere. So an arrow
is the choice here.</font></small></li>
</ul>
<small><font face="Helvetica, Arial, sans-serif">So now there a three
arrows displayed at the three points.</font><br>
<font face="Helvetica, Arial, sans-serif">But they are not colored. <b>The
transformation from color information (having three components) to
scalar informations (having one component) the coloring can be done
with is not known to me.</b></font><br>
<font face="Helvetica, Arial, sans-serif">Hope you have an answere to
that. The current example code looks like this - I haven't updated the
wiki page yet, because it's not coloring so far - only displaying the
glyphs.</font></small><br>
<br>
<small><font face="Courier New, Courier, monospace">#include
<vtkSmartPointer.h><br>
#include <vtkPointData.h><br>
// #include <vtkCubeSource.h><br>
#include <vtkPolyData.h><br>
#include <vtkPoints.h><br>
#include <vtkGlyph3D.h><br>
#include <vtkCellArray.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkUnsignedCharArray.h><br>
#include <vtkArrowSource.h><br>
<br>
int exampleColorGlyphs()<br>
{<br>
//create points<br>
vtkSmartPointer<vtkPoints> points = <br>
vtkSmartPointer<vtkPoints>::New();<br>
points->InsertNextPoint(0,0,0);<br>
points->InsertNextPoint(1,0,0);<br>
points->InsertNextPoint(2,0,0);<br>
<br>
//create vector components<br>
vtkSmartPointer<vtkUnsignedCharArray> vectors = <br>
vtkSmartPointer<vtkUnsignedCharArray>::New();<br>
vectors->SetName("Vectors");<br>
vectors->SetNumberOfComponents(3);<br>
vectors->InsertNextTuple3(1,1,0);<br>
vectors->InsertNextTuple3(0,1,0);<br>
vectors->InsertNextTuple3(0,0,1);<br>
<br>
//setup scales<br>
vtkSmartPointer<vtkUnsignedCharArray> colors = <br>
vtkSmartPointer<vtkUnsignedCharArray>::New();<br>
colors->SetName("colors");<br>
colors->SetNumberOfComponents(3);<br>
unsigned char r[3] = {255,0,0};<br>
unsigned char g[3] = {0,255,0};<br>
unsigned char b[3] = {0,0,255};<br>
colors->InsertNextTupleValue(r);<br>
colors->InsertNextTupleValue(g);<br>
colors->InsertNextTupleValue(b);<br>
<br>
//combine into a polydata<br>
vtkSmartPointer<vtkPolyData> polydata = <br>
vtkSmartPointer<vtkPolyData>::New();<br>
polydata->SetPoints(points);<br>
//polydata->GetPointData()->SetScalars(colors);<br>
polydata->GetPointData()->SetVectors(vectors);<br>
<br>
vtkSmartPointer<vtkArrowSource> arrow = <br>
vtkSmartPointer<vtkArrowSource>::New();<br>
<br>
vtkSmartPointer<vtkGlyph3D> glyph3D = <br>
vtkSmartPointer<vtkGlyph3D>::New();<br>
glyph3D->SetColorModeToColorByScalar();<br>
glyph3D->SetSourceConnection(arrow->GetOutputPort());<br>
glyph3D->SetInput(polydata);<br>
glyph3D->Update();<br>
<br>
//Create a mapper and actor<br>
vtkSmartPointer<vtkPolyDataMapper> mapper = <br>
vtkSmartPointer<vtkPolyDataMapper>::New();<br>
mapper->SetInputConnection(glyph3D->GetOutputPort());<br>
vtkSmartPointer<vtkActor> actor = <br>
vtkSmartPointer<vtkActor>::New();<br>
actor->SetMapper(mapper);<br>
<br>
//Create a renderer, render window, and interactor<br>
vtkSmartPointer<vtkRenderer> renderer = <br>
vtkSmartPointer<vtkRenderer>::New();<br>
vtkSmartPointer<vtkRenderWindow> renderWindow = <br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
vtkSmartPointer<vtkRenderWindowInteractor>
renderWindowInteractor = <br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
<br>
//Add the actor to the scene<br>
renderer->AddActor(actor);<br>
renderer->SetBackground(1,1,1); // Background color white<br>
<br>
//Render and interact<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
return 0;<br>
}</font></small><br>
<font size="-1"><font face="Helvetica, Arial, sans-serif"><br>
</font></font>Am 05.03.2010 21:55, schrieb David Doria:
<blockquote
cite="mid:c19fcadc1003051255o65f57a89lcdd41056a1ac494@mail.gmail.com"
type="cite">
<div>
<div class="gmail_quote">On Fri, Mar 5, 2010 at 3:35 PM, Sebastian
Gatzka <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sebastian.gatzka@stud.tu-darmstadt.de">sebastian.gatzka@stud.tu-darmstadt.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="DE">
<div>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Obviously
there was nothing wrong.</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">When we
moved on from this “constructed” example to the real
application we are working with everything went fine.</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">All
Vectors are scales and colored now!</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"><br>
</span></p>
</div>
</div>
</blockquote>
<div>Do you think you could fix this example? </div>
<div><br>
</div>
<a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK/Examples/Visualization/ColorGlyphs">http://www.vtk.org/Wiki/VTK/Examples/Visualization/ColorGlyphs</a>
<div><br clear="all">
Thanks,<br>
<br>
</div>
<div>David</div>
</div>
</div>
</blockquote>
</body>
</html>