[vtkusers] Splitting vtkFeatureEdges into lines

Sergey Programmer croooter at gmail.com
Fri Jul 16 11:17:16 EDT 2010


The problem was in the loop:
in the lines below
            p1 = pts[cc-1] + 1;
            p2 = pts[cc] + 1;

"+1" was a bad idea. Now it draws okay, however, instead of 600 visible
lines it draws 1200.

Is there a way to remove duplicate lines? Cleaning/merging filters on the
polydata did not help.

Regards,
C

On Wed, Jul 14, 2010 at 5:48 PM, Sergey Programmer <croooter at gmail.com>wrote:

> Hi All,
>
> I'm trying to refine my surface and then split into lines. The steps are
> 1. take original vtkPolyData and filter it using vtkFeatureEdges - dataset
> after rendering looks nice
> 2. now I want to traverse the result vtkPolyData (named below contours) and
> extract lines
>             vtkCellArray *ca = contours->GetOutput()->GetLines();
>             vtkIdType ncells = ca->GetNumberOfCells();
>
> And at the step 2 I'm having problems:
>
> 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.
>
> What am I missing?
>
> PS: Lines points extraction is implemented as following:
>     ca->InitTraversal();
>     while ( ca->GetNextCell( npts, pts ) )
>     {
>         for ( cc = 1; cc < npts; cc++ )
>         {
>             p1 = pts[cc-1] + 1;
>             p2 = pts[cc] + 1;
>             contours->GetOutput()->GetPoint( p1, pc1 );
>             contours->GetOutput()->GetPoint( p2, pc2 );
>             .... // creating and rendering the extracted line
>         }
>   }
>
>
> Regards,
> C
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100716/5bd8cd0c/attachment.htm>


More information about the vtkusers mailing list