<!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> </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> </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> </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->SetNumberOfComponents(3);</P>
<P>pointFloatArray->SetNumberOfTuples(dims[0]*dims[1]*dims[2]); </P>
<P>pointFloatArray->SetVoidArray(&pointsArray[0],12,1);</P>
<P>vtkPoints *points = vtkPoints::New();</P>
<P>points->SetData(pointFloatArray);</P>
<P> </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->SetNumberOfComponents(3);</P>
<P>vectors->SetNumberOfTuples(dims[0]*dims[1]*dims[2]);</P>
<P>vectors->SetArray(&array[0],12,1);</P>
<P> </P><FONT color=#008000 size=2>
<P>//Poly Data</P></FONT><FONT size=2>
<P>vtkPolyData *polyData = vtkPolyData::New();</P>
<P>polyData->SetPoints(points);</P>
<P>polyData->GetPointData()->SetVectors(vectors);</P>
<P> </P><FONT color=#008000 size=2>
<P>//Label Mapper</P></FONT><FONT size=2>
<P>vtkLabeledDataMapper *labelMapper = vtkLabeledDataMapper::New();</P>
<P>labelMapper->SetInput(polyData);</P>
<P>labelMapper->SetLabelModeToLabelVectors();</P>
<P> </P><FONT color=#008000 size=2>
<P>//Actor</P></FONT><FONT size=2>
<P>vtkActor2D *actor = vtkActor2D::New();</P>
<P>actor->SetMapper(labelMapper);</P>
<P> </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>