<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY><FONT size=2><FONT size=2>
<P>Hi Ricardo,</P>
<P>Maybe you can use this.</P>
<P>Tron</P>
<P> </P>
<P>Snippet from simple code that computes cell center given polydata with triangles.</FONT></P>
<P><FONT color=#0000ff size=2>int</FONT><FONT size=2> i, pId;</P>
<P></FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2> m[3];</P>
<P></FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> p0[3], p1[3], p2[3];</FONT></P>
<P><FONT size=2>....</FONT></P><FONT size=2><FONT size=2>
<P>vtkPolyData *Source = reader->GetOutput();</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Get the points belonging to this cell i.</P></FONT><FONT size=2>
<P>Source->GetCellPoints(i,cells);</P>
<P></P>
<P></FONT><FONT color=#008000 size=2>// Put the three vertex coordinates in p0, p1, p2.</P></FONT><FONT size=2>
<P>pId = cells->GetId(0);</P>
<P>points->GetPoint(pId,p0);</P>
<P>pId = cells->GetId(1);</P>
<P>points->GetPoint(pId,p1);</P>
<P>pId = cells->GetId(2);</P>
<P>points->GetPoint(pId,p2);</P>
<P></P>
<P></FONT><FONT color=#008000 size=2>// Compute the cell center m.</P></FONT><FONT size=2>
<P>m[0] = (p0[0] + p1[0] + p2[0]) / 3.0;</P>
<P>m[1] = (p0[1] + p1[1] + p2[1]) / 3.0; </P>
<P>m[2] = (p0[2] + p1[2] + p2[2]) / 3.0; </P></FONT></FONT></FONT><FONT color=#008000 size=2><FONT size=2>
<P> </P></FONT></FONT><FONT face=Arial color=#000000 size=2></FONT>
<DIV id=idSignature45703 dir=ltr>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>Tron Darvann</FONT></DIV>
<DIV><FONT face=Arial size=2>Research Engineer, PhD, 3D-Laboratory</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><U>Tel:</U> (+45) 35 32 67 58 (lab) / (+45) 28 20 03 12 (mobile)</FONT></DIV>
<DIV><FONT face=Arial size=2><U>E-mail:</U> <A href="mailto:trd@odont.ku.dk">trd@odont.ku.dk</A></FONT></DIV>
<DIV><FONT face=Arial size=2><U>Skype:</U> tron.darvann</FONT></DIV>
<DIV><FONT face=Arial size=2><U>Fax:</U> (+45) 35 32 65 05</FONT></DIV>
<DIV><FONT face=Arial size=2><U>Mailing and Visiting Address:</U></FONT></DIV>
<DIV><FONT face=Arial size=2>3D-Lab, School of Dentistry</FONT></DIV>
<DIV><FONT face=Arial size=2>University of Copenhagen</FONT></DIV>
<DIV><FONT face=Arial size=2>Nørre Alle 20</FONT></DIV>
<DIV><FONT face=Arial size=2>DK-2200 Copenhagen N</FONT></DIV>
<DIV><FONT face=Arial size=2>Denmark</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Fra:</B> vtkusers-bounces+trd=odont.ku.dk@vtk.org på vegne af Secolas UA<BR><B>Sendt:</B> ma 11-12-2006 13:10<BR><B>Til:</B> vtkusers@vtk.org<BR><B>Emne:</B> [vtkusers] Get CellID<BR></FONT><BR></DIV>
<DIV>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hello!</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am doing an application that from an imported VRML Model I want to get cell information. I need to get the points that define the cell.</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This is part of the code that I use to access the cells but I'm stuck because I don't know how to get the cellId for the GetCellPoints function.</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"> </SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN lang=EN-GB style="FONT-SIZE: 10pt">…</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN lang=EN-GB style="FONT-SIZE: 10pt">polyData = (vtkPolyData* ) Act->GetMapper()->GetInput();</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">int</SPAN> t = polyData->GetNumberOfPolys();</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"> cellArray = polyData->GetPolys();</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-SIZE: 10pt">polyData->GetCellPoints( pointList);</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt"> …</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt"></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt">If anyone knows the best way to do this I would forever gratefull. Any other sugestions are very welcome too!</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt">Best Regards</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB style="FONT-SIZE: 10pt"></SPAN> </P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt">Ricardo Seco, University of Aveiro, Portugal</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></P></DIV></BODY></HTML>