<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>For polydata it is not enough to specify points. 
You need to specify cell(s) too. That is indication of connectivity of points as 
well as what the connectivity describes. For example, four points could 
represent triangle or three segmented polyline. Refer to vtk cell 
types.</FONT></DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV>
<DIV><FONT face=Arial size=2>Vidyadhar</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=payman_vtk@yahoo.co.uk href="mailto:payman_vtk@yahoo.co.uk">payman 
  labbaf</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, January 20, 2005 7:31 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] can't label poly 
  data</DIV>
  <DIV><BR></DIV>
  <DIV>Dear All,</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>I've been trying to label some points with irregular geometery and 
  topology. </DIV>
  <DIV>I chose vtkPolyData as it says in the specification that is fine for 0 
  dimension data.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Now I have a problem with labeling the data. </DIV>
  <DIV>Could you please have a look at my simplified code and let me know what 
  I'm doing wrong.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT color=#008000 size=2>
  <P>//Points</P></FONT><FONT size=2>
  <P></FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2> pointsArray[12] 
  = {1,1,0,1,2,0,2,1,0,2,2,0};</P>
  <P>vtkFloatArray *pointFloatArray = vtkFloatArray::New();</P>
  <P>pointFloatArray-&gt;SetNumberOfComponents(3);</P>
  <P>pointFloatArray-&gt;SetNumberOfTuples(dims[0]*dims[1]*dims[2]); </P>
  <P>pointFloatArray-&gt;SetVoidArray(&amp;pointsArray[0],12,1);</P>
  <P>vtkPoints *points = vtkPoints::New();</P>
  <P>points-&gt;SetData(pointFloatArray);</P>
  <P>&nbsp;</P><FONT color=#008000 size=2>
  <P>//Vectors</P></FONT><FONT size=2>
  <P></FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2> array[12] = 
  {10,5,0,11,6,0,12,7,0,13,8,0};</P>
  <P>vtkFloatArray *vectors = vtkFloatArray::New();</P>
  <P>vectors-&gt;SetNumberOfComponents(3);</P>
  <P>vectors-&gt;SetNumberOfTuples(dims[0]*dims[1]*dims[2]);</P>
  <P>vectors-&gt;SetArray(&amp;array[0],12,1);</P>
  <P>&nbsp;</P><FONT color=#008000 size=2>
  <P>//Poly Data</P></FONT><FONT size=2>
  <P>vtkPolyData *polyData = vtkPolyData::New();</P>
  <P>polyData-&gt;SetPoints(points);</P>
  <P>polyData-&gt;GetPointData()-&gt;SetVectors(vectors);</P>
  <P>&nbsp;</P><FONT color=#008000 size=2>
  <P>//Label Mapper</P></FONT><FONT size=2>
  <P>vtkLabeledDataMapper *labelMapper = vtkLabeledDataMapper::New();</P>
  <P>labelMapper-&gt;SetInput(polyData);</P>
  <P>labelMapper-&gt;SetLabelModeToLabelVectors();</P>
  <P>&nbsp;</P><FONT color=#008000 size=2>
  <P>//Actor</P></FONT><FONT size=2>
  <P>vtkActor2D *actor = vtkActor2D::New();</P>
  <P>actor-&gt;SetMapper(labelMapper);</P>
  <P>&nbsp;</P>
  <P>The above code works when I'm using vtkStructuredGrid but not for 
  polyData.</P>
  <P>(I also tried InsertNextPoint() function for giving the points coordinates 
  to vtkPolyData and that didn't work either)</P>
  <P>Many thanks in advance</P></FONT></FONT></FONT></FONT></FONT></DIV>
  <P>
  <HR SIZE=1>
  <FONT face="Verdana, Arial, Helvetica, sans-serif" size=2><A 
  href="http://uk.rd.yahoo.com/mail/taglines/default/messenger/*http://uk.messenger.yahoo.com"><STRONG><FONT 
  face="Arial, Helvetica, sans-serif">ALL-NEW Yahoo! 
  Messenger</FONT></STRONG></A><FONT 
  face="Arial, Helvetica, sans-serif"><STRONG> - all new features - even more 
  fun!</STRONG></FONT><STRONG><FONT color=#ff9900> 
</FONT></STRONG></FONT></BLOCKQUOTE></BODY></HTML>