<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=DE link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I’m using a structuredGrid:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> </span><span style='font-size:11.0pt;font-family:"Courier New";
color:#1F497D'>vtkStructuredGrid *sGrid = vtkStructuredGrid::New();<br>
<br>
<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The vector array is this:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> </span><span lang=EN-US style='font-size:11.0pt;
font-family:"Courier New";color:#1F497D'>vtkFloatArray *v =
vtkFloatArray::New();<br>
v->SetNumberOfComponents(3);</span><span lang=EN-US style='font-size:
11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>which is filled with data like this:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> </span><span style='font-size:11.0pt;font-family:"Courier New";
color:#1F497D'>v->InsertNextTuple3(ix,iy,iz);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>and is set tot he field:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> </span><span style='font-size:11.0pt;font-family:"Courier New";
color:#1F497D'>sGrid->GetCellData()->SetVectors(v);<br>
<br>
<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The rest is history:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><br>
</span><span style='font-size:11.0pt;font-family:
"Courier New";color:#1F497D'>vtkArrowSource *arrow = vtkArrowSource::New();<br>
<br>
vtkGlyph3D *glyph = vtkGlyph3D::New();<br>
glyph->SetInput(gridCellCenters->GetOutput());
<br>
glyph->SetSourceConnection(arrow->GetOutputPort());<br>
glyph->SetScaleModeToScaleByVector();<br>
glyph->SetColorModeToColorByVector();<br>
glyph->SetScaleFactor(0.1);<br>
glyph->Update();<br>
<br>
vtkPolyDataMapper *glyphMapper =
vtkPolyDataMapper::New();<br>
glyphMapper->SetInputConnection(glyph->GetOutputPort());<br>
<br>
<br>
vtkActor *glyphActor = vtkActor::New();<br>
glyphActor->SetMapper(glyphMapper);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>This is producing uniform colored (blue) glyphs, scaled by their
magnitude.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>So what may be wrong?</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Helvetica","sans-serif"'><br>
<br>
</span><span lang=EN-US><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>Von:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Rakesh Patil [mailto:rakeshthp@in.com] <br>
<b>Gesendet:</b> Freitag, 26. Februar 2010 13:08<br>
<b>An:</b> Sebastian Gatzka<br>
<b>Cc:</b> vtkusers<br>
<b>Betreff</b></span><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Re:[vtkusers] Fwd:
Re: Glyph coloring by vector magnitud<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><br>
It should set the colors.. Tell me what type of grid are you using..?? And what
is the vector array that you are setting to this Grid??<o:p></o:p></p>
<p class=MsoNormal><br>
---------- Original message ----------<br>
From:Sebastian Gatzka< sebastian.gatzka@stud.tu-darmstadt.de ><br>
Date: 26 Feb 10 15:23:25<br>
Subject: [vtkusers] Fwd: Re:Glyph coloring by vector magnitud<br>
To: vtkusers@vtk.org<br>
<br>
<br>
<br>
<span style='font-size:10.0pt;font-family:"Helvetica","sans-serif"'>Unfortunately
this does not work for me.<br>
Despite turning off the data scaling I can scale the glyphs from their
magnitude, but not color them by their magnitude.<br>
<br>
vtkArrowSource *arrow = vtkArrowSource::New();<br>
<br>
vtkGlyph3D *glyph = vtkGlyph3D::New();<br>
glyph->SetInput(gridCellCenters->GetOutput()); <br>
glyph->SetSourceConnection(arrow->GetOutputPort());<br>
glyph->SetScaleMode(VTK_SCALE_BY_VECTOR);<br>
glyph->SetColorMode(VTK_COLOR_BY_VECTOR);<br>
glyph->SetScaleFactor(0.1);<br>
<br>
This code generates <b>scaled but uniform colored</b> vectors.<br>
<br>
</span><br>
Am 22.02.2010 16:33, schrieb Rakesh Patil: <o:p></o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><span style='color:black'>Its
because you have turned of the scaling mode. When you say,
SetScaleModeToDataScalingOff(), all glyphs are rendered of equal length.<br>
<br>
In the next step, you are saying,<br>
<br>
SetColorModeToColorByScale();<br>
<br>
you'll see that all the glyphs are of same scale. Thus, all glyphs are rendered
with same color. I think, Once you comment or remove <br>
<br>
SetScaleModeToDataScalingOff()<br>
<br>
then, it should work fine..<br>
<br>
Seniors please correct me if i'm wrong..<br>
<br>
Good luck<br>
<br>
Regards<br>
Rakesh Patil<br>
</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'><br>
<br>
</span><o:p></o:p></p>
<p class=MsoNormal><span style='color:black'><br>
---------- Original message ----------<br>
From:Sebastian Gatzka< <a href="mailto:sebastian.gatzka@stud.tu-darmstadt.de"
target="\">sebastian.gatzka@stud.tu-darmstadt.de</a> ><br>
Date: 22 Feb 10 19:37:52<br>
Subject: [vtkusers] Glyph coloring by vector magnitud<br>
To: <a href="mailto:vtkusers@vtk.org" target="\">vtkusers@vtk.org</a><br>
<br>
</span><span style='font-size:10.0pt;font-family:"Helvetica","sans-serif";
color:black'>Hello World.<br>
<br>
Meanwhile I made some nice glyphs, but am stuck with the coloring.<br>
I switched on SetColorModeToColorByVector() which may be the coloring by vector
magnitude?<br>
<br>
</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>vtkGlyph3D
*glyph vtkGlyph3D::New();<br>
glyph->SetInput(gridCellCenters->GetOutput()); <br>
glyph->SetSourceConnection(arrow->GetOutputPort());<br>
glyph->SetScaleModeToDataScalingOff();<br>
glyph->SetColorModeToColorByScale();<br>
glyph->SetScaleFactor(0.3);</span><span style='font-size:10.0pt;font-family:
"Helvetica","sans-serif";color:black'><br>
<br>
Unfortunately all glyphs are colored the same (blue).<br>
Do I have to do anything further to get propper coloring? Maybe with the
mapper?<br>
<br>
See you. Sebastian</span><o:p></o:p></p>
</div>
</body>
</html>