<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    I'm trying to display cubes with different sizes and each size is
    assigned its own color, see code below.<br>
    <br>
    So far I have managed to correctly,<br>
    <br>
    Assign the colors but not the sizes ( this case is the code below )<br>
    OR<br>
    Assign the sizes but not the colors<br>
    <br>
    I can post the whole code if it helps. Any help on this would be
    greatly appreciated.<br>
    <br>
    Thanks<br>
    Alex.<br>
    <br>
    <small><small><font face="Courier New, Courier, monospace">&nbsp;&nbsp;&nbsp; <font
            color="#33cc00">// Setup scales</font><br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkFloatArray&gt; scales =
          vtkSmartPointer&lt;vtkFloatArray&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; scales-&gt;SetName("scales");<br>
          &nbsp;&nbsp;&nbsp; <font color="#33cc00">// setup colors</font><br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkUnsignedCharArray&gt; colors =
          vtkSmartPointer&lt;vtkUnsignedCharArray&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; colors-&gt;SetName("colors");<br>
          &nbsp;&nbsp;&nbsp; colors-&gt;SetNumberOfComponents(3);<br>
          <br>
          &nbsp;&nbsp;&nbsp; <font color="#3333ff">for</font> (<font color="#3333ff">int</font>
          i = 0; i &lt; ca.numCubes; i++)<br>
          &nbsp;&nbsp;&nbsp; {<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;InsertNextPoint(ca.cubeCentre[i].x
          ,ca.cubeCentre[i].y ,ca.cubeCentre[i].z);<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; scales-&gt;InsertNextValue(ca.cubeLength[i]);<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#3333ff">for</font> ( <font
            color="#3333ff">int</font> j = 0; j &lt; numLengths; j++)<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#3333ff">if</font> (ca.cubeLength[i]
          == t_lengths[j])<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colors-&gt;InsertNextTupleValue(rgb[j]);<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#3333ff">break;</font><br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp; }<br>
          &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkPolyData&gt; polydata =
          vtkSmartPointer&lt;vtkPolyData&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; polydata-&gt;SetPoints(points);<br>
          &nbsp;&nbsp;&nbsp; polydata-&gt;GetPointData()-&gt;SetScalars(scales);<br>
          &nbsp;&nbsp;&nbsp; polydata-&gt;GetPointData()-&gt;SetScalars(colors);<br>
          &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkCubeSource&gt; cubeSource =
          vtkSmartPointer&lt;vtkCubeSource&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkGlyph3D&gt; glyph3D =
          vtkSmartPointer&lt;vtkGlyph3D&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; glyph3D-&gt;SetColorModeToColorByScalar();<br>
          &nbsp;&nbsp;&nbsp;
          glyph3D-&gt;SetSourceConnection(cubeSource-&gt;GetOutputPort());<br>
          &nbsp;&nbsp;&nbsp; glyph3D-&gt;SetInput(polydata);<br>
          &nbsp;&nbsp;&nbsp; glyph3D-&gt;Update();<br>
          &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper =
          vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>
          &nbsp;&nbsp;&nbsp;
          mapper-&gt;SetInputConnection(glyph3D-&gt;GetOutputPort());<br>
          &nbsp;&nbsp;&nbsp; <br>
          &nbsp;&nbsp;&nbsp;<font color="#33cc00"> // create mapper</font><br>
          &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkActor&gt; actor =
          vtkSmartPointer&lt;vtkActor&gt;::New();<br>
          &nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(mapper);</font></small></small><br>
    <br>
    <br>
    <br>
    On 2/10/2012 1:01 PM, David Doria wrote:
    <blockquote
cite="mid:CABDpjT=gfqvh7rU-d1CJFQrVrUvbKoM_kgqsfwVvWtDbBtn+wA@mail.gmail.com"
      type="cite">
      <pre wrap="">On Fri, Feb 10, 2012 at 5:34 AM, Alex Southern <a class="moz-txt-link-rfc2396E" href="mailto:mrapsouthern@gmail.com">&lt;mrapsouthern@gmail.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Is possible to set the color of each glyph individually?

i.e. i'd like glyph's with different scaling to have different colors.
</pre>
      </blockquote>
      <pre wrap="">
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ColorGlyphs">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ColorGlyphs</a>

David
</pre>
    </blockquote>
    <br>
  </body>
</html>