[vtkusers] Cap Clip Surface

David Gobbi david.gobbi at gmail.com
Thu Sep 10 08:43:56 EDT 2015


The problem is that the VTK rendering pipeline expects polydata to contain
only convex polygons, but following code can create a non-convex polygon:

        // Change the polylines into polygons
vtkSmartPointer<vtkPolyData> boundaryPoly =
vtkSmartPointer<vtkPolyData>::New();
boundaryPoly->SetPoints(boundaryStrips->GetOutput()->GetPoints());
boundaryPoly->SetPolys(boundaryStrips->GetOutput()->GetLines());

The vtkContourTriangulator filter (which I contributed to VTK) can fix this:

        // Triangulate the polyline contour
vtkSmartPointer<vtkContourTriangulator> triangulator =
vtkSmartPointer<vtkContourTriangulator>::New();
        triangulator->SetInputConnection(boundaryStrips->GetOutputPort());
        triangulator->Update();
        // use the triangulator output as the cap

Please let me know if this works for you.

Cheers,
 - David

On Thu, Sep 10, 2015 at 3:38 AM, momo <lilymagic2005 at yahoo.com.hk> wrote:

> I have a surface like the left in the picture belows. I applied Cap Clip on
> the surface, and I append the original surface and the caps, then output to
> a .stl file. It looks well in the render window in VTK. However, when I
> used
> Paraview to view the output file, it looks the same as the original
> surface.
> The left of the picture shows the actual result of the output file after
> appending in Paraview. So what happened actually?Thanks.
>
> <http://vtk.1045678.n5.nabble.com/file/n5733821/Clip_Capture.jpg>
> CapClip.cxx <http://vtk.1045678.n5.nabble.com/file/n5733821/CapClip.cxx>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150910/73f8b6d0/attachment.html>


More information about the vtkusers mailing list