The problem was in the loop:<br>in the lines below<br> p1 = pts[cc-1] + 1;<br>
p2 = pts[cc] + 1;<br><br>"+1" was a bad idea. Now it draws okay, however, instead of 600 visible lines it draws 1200. <br><br>Is there a way to remove duplicate lines? Cleaning/merging filters on the polydata did not help.<br>
<br>Regards,<br>C<br><br><div class="gmail_quote">On Wed, Jul 14, 2010 at 5:48 PM, Sergey Programmer <span dir="ltr"><<a href="mailto:croooter@gmail.com">croooter@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi All,<br><br>I'm trying to refine my surface and then split into lines. The steps are<br>1. take original vtkPolyData and filter it using vtkFeatureEdges - dataset after rendering looks nice<br>2. now I want to traverse the result vtkPolyData (named below contours) and extract lines<br>
vtkCellArray *ca = contours->GetOutput()->GetLines();<br>
vtkIdType ncells = ca->GetNumberOfCells();<br>
<br>And at the step 2 I'm having problems:<br><br>The ncells is too big (1000+, while on step 1 I see at most 10-20 lines), when I draw extracted lines I see triangles, not the contours I saw on step 1.<br><br>What am I missing?<br>
<br>PS: Lines points extraction is implemented as following:<br> ca->InitTraversal();<br> while ( ca->GetNextCell( npts, pts ) )<br> {<br> for ( cc = 1; cc < npts; cc++ )<br> {<br> p1 = pts[cc-1] + 1;<br>
p2 = pts[cc] + 1;<br> contours->GetOutput()->GetPoint( p1, pc1 );<br> contours->GetOutput()->GetPoint( p2, pc2 );<br> .... // creating and rendering the extracted line<br>
}<br> }<br><br><br>Regards,<br>C<br>
</blockquote></div><br>