<div style="white-space:pre-wrap">Hi Ken,<br><br>    Thank you very much for your answer. I hadn't understood that vtkGlyph3D would create all the arrows in memory. <br><br>However, it may still be the only choice I have as I would like to be able to assign a different color (based on a scalar) to each arrow, and some arrows should point downward while others upwards. The size of the arrow will stay constant but the color I would like to be able to change it on an arrow-by arrow basis, and I don't know if this can be done using vtkGlyph3DMapper...<br><br>Of course, I would be more than happy to be proven wrong ðŸ˜Š.<br><br>Thank you again.<br><br>Andrea.<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, 2 Dec 2016 at 16:30, Ken Martin <<a href="mailto:ken.martin@kitware.com">ken.martin@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Be aware Glyph3D is a filter and will actually generate all those arrows in memory. Glyph3DMapper is a mapper and uses OpenGL tricks to render the same arrow lots of times.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Both classes place a glyph at the location of each input point. The orientation is controlled by a different array in your point data ala the comments below:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks</div><div class="gmail_msg">Ken</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">  //@{</div><div class="gmail_msg">  /**</div><div class="gmail_msg">  Â * Turn on/off orienting of input geometry.</div><div class="gmail_msg">  Â * When turned on, the orientation array specified</div><div class="gmail_msg">  Â * using SetOrientationArray() will be used.</div><div class="gmail_msg">  Â */</div><div class="gmail_msg">  vtkSetMacro(Orient, bool);</div><div class="gmail_msg">  vtkGetMacro(Orient, bool);</div><div class="gmail_msg">  vtkBooleanMacro(Orient, bool);</div><div class="gmail_msg">  //@}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">  //@{</div><div class="gmail_msg">  /**</div><div class="gmail_msg">  Â * Orientation mode indicates if the OrientationArray provides the direction</div><div class="gmail_msg">  Â * vector for the orientation or the rotations around each axes. Default is</div><div class="gmail_msg">  Â * DIRECTION</div><div class="gmail_msg">  Â */</div><div class="gmail_msg">  vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);</div><div class="gmail_msg">  vtkGetMacro(OrientationMode, int);</div><div class="gmail_msg">  void SetOrientationModeToDirection()</div><div class="gmail_msg">  Â  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }</div><div class="gmail_msg">  void SetOrientationModeToRotation()</div><div class="gmail_msg">  Â  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }</div><div class="gmail_msg">  const char* GetOrientationModeAsString();</div><div class="gmail_msg">  //@}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">  enum OrientationModes</div><div class="gmail_msg">  {</div><div class="gmail_msg">  Â  DIRECTION=0,</div><div class="gmail_msg">  Â  ROTATION=1</div><div class="gmail_msg">  };</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">  /**</div><div class="gmail_msg">  Â * Tells the mapper to use an orientation array if Orient is true.</div><div class="gmail_msg">  Â * An orientation array is a vtkDataArray with 3 components. The first</div><div class="gmail_msg">  Â * component is the angle of rotation along the X axis. The second</div><div class="gmail_msg">  Â * component is the angle of rotation along the Y axis. The third</div><div class="gmail_msg">  Â * component is the angle of rotation along the Z axis. Orientation is</div><div class="gmail_msg">  Â * specified in X,Y,Z order but the rotations are performed in Z,X an Y.</div><div class="gmail_msg">  Â * This definition is compliant with SetOrientation method on vtkProp3D.</div><div class="gmail_msg">  Â * By using vector or normal there is a degree of freedom or rotation</div><div class="gmail_msg">  Â * left (underconstrained). With the orientation array, there is no degree of</div><div class="gmail_msg">  Â * freedom left.</div><div class="gmail_msg">  Â * This is convenience method. The same effect can be achieved by using</div><div class="gmail_msg">  Â * SetInputArrayToProcess(vtkGlyph3DMapper::ORIENTATION, 0, 0,</div><div class="gmail_msg">  Â * vtkDataObject::FIELD_ASSOCIATION_POINTS, orientationarrayname);</div><div class="gmail_msg">  Â */</div><div class="gmail_msg">  void SetOrientationArray(const char* orientationarrayname);</div></div><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Fri, Dec 2, 2016 at 10:18 AM, Andrea Gavana <span dir="ltr" class="gmail_msg"><<a href="mailto:andrea.gavana@gmail.com" class="gmail_msg" target="_blank">andrea.gavana@gmail.com</a>></span> wrote:<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Dear All,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">  Â  I am trying to combine a vtkArrowSource and vtkGlyph3D. I have been (naively) thinking that by specifying a polydata with two points (start and end) and assigning its points to the vtkGlyph3D I would obtain an arrow that starts at the start point and end at the end point.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I have created a small, self-contained following Python script to demonstrate what I mean - I get 4 arrows, one at each point I define, instead of two arrows. What am I missing? Any suggestion is more than welcome.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thank you in advance.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Andrea.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">import vtk</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">import numpy</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># First set of points - first arrow</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">points1 = numpy.array([[ 11271.915, 7538.686, 6245.661],</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â [ 11271.915, 7538.686, 5897.034]])</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Second set of points - second arrow</font></div></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">points2 = numpy.array([[ 10532.274, 9101.572, 6313.167],</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â [ 10532.274, 9101.572, 5964.539]])</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Create an arrow source with some attributes</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_source = vtk.vtkArrowSource()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_source.SetTipRadius(0.2)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_source.SetShaftRadius(0.075)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Create the vtkGlyph3D</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_glyph = vtk.vtkGlyph3D()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_glyph.SetScaleModeToDataScalingOff()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Usual mapper</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_mapper = vtk.vtkPolyDataMapper()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_mapper.SetInputConnection(arrow_glyph.GetOutputPort())</font></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span style="font-family:monospace,monospace" class="gmail_msg"># Usual actor</span></div><div class="gmail_msg"><span style="font-family:monospace,monospace" class="gmail_msg">arrow_actor = vtk.vtkActor()</span><br class="gmail_msg"></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_actor.SetMapper(arrow_mapper)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">append_poly_data = vtk.vtkAppendPolyData()</font></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Loop through points1 and points2</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">for p in [points1, points2]:</font></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  arrow_poly_data = vtk.vtkPolyData()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  vtk_arrow_lines = vtk.vtkCellArray()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  vtk_arrow_lines.InsertNextCell(2)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  vtk_arrow_lines.InsertCellPoint(0)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  vtk_arrow_lines.InsertCellPoint(1)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  vtk_arrow_points = vtk.vtkPoints()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  # Loop through the head and tail of a single arrow</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  for j in xrange(2):</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  Â  Â  vtk_arrow_points.InsertNextPoint(p[j])</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  arrow_poly_data.SetPoints(vtk_arrow_points)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  arrow_poly_data.SetLines(vtk_arrow_lines)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">  Â  append_poly_data.AddInputData(arrow_poly_data)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_glyph.SetInputConnection(append_poly_data.GetOutputPort())</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_glyph.SetSourceConnection(arrow_source.GetOutputPort())</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_glyph.SetScaleFactor(100)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">arrow_actor.GetProperty().SetColor(1, 1, 1)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># ------------------------------------------------------------</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># Create the RenderWindow, Renderer and both Actors</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># ------------------------------------------------------------</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">ren = vtk.vtkRenderer()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">renWin = vtk.vtkRenderWindow()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">renWin.AddRenderer(ren)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">iren = vtk.vtkRenderWindowInteractor()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">iren.SetRenderWindow(renWin)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"># add actors</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">ren.AddActor(arrow_actor)</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">ren.ResetCamera()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">iren.Start()</font></div><div class="gmail_msg"><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div><font face="monospace, monospace" class="gmail_msg"><br class="gmail_msg"></font></div></div>
<br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="gmail_msg">
Powered by <a href="http://www.kitware.com" rel="noreferrer" class="gmail_msg" target="_blank">www.kitware.com</a><br class="gmail_msg">
<br class="gmail_msg">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" class="gmail_msg" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br class="gmail_msg">
<br class="gmail_msg">
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" class="gmail_msg" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br class="gmail_msg">
<br class="gmail_msg">
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" class="gmail_msg" target="_blank">http://markmail.org/search/?q=vtkusers</a><br class="gmail_msg">
<br class="gmail_msg">
Follow this link to subscribe/unsubscribe:<br class="gmail_msg">
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" class="gmail_msg" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><br clear="all" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div>-- <br class="gmail_msg"><div class="m_-6726101654680824080gmail_signature gmail_msg" data-smartmail="gmail_signature">Ken Martin PhD<div class="gmail_msg">Chairman & CFO<br class="gmail_msg">Kitware Inc.<br class="gmail_msg">28 Corporate Drive<br class="gmail_msg">Clifton Park NY 12065<br class="gmail_msg">518 371 3971<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span style="font-size:10pt;font-family:Tahoma,sans-serif" class="gmail_msg">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee.  Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message. 
Thank you.</span></div></div></div>
</div></blockquote></div>