Expanding a closed contour surface by some distance with the help of surface normals.

Hello Everyone,

I have a closed contour polydata with points and normals (created from vtkPolyDataNormals). I tried to exoand the contour with the help of the normals by a certain distance (1 m). This I have done by calculating new points which are at 1m distance from old points using the normals. Then I replaced the old points with new points in the polydata. The problem I am facing now is that when there is a sharp edge in the contour the expanded portion for it breaks creating gaps. The images show below the are the results. First image is the original contour (yellow,opacity=0.6), second image is the expanded contour(orange,opacity=0.3) (original contour is also displayed for reference), Third image is with expanded contour only.



Is there a way to solve the issue and expand the contour without any gaps? I am also attaching two contour vtp files below. (contour 1 is original and contour 2 is expanded)
contour1.vtp (448.9 KB)
contour2.vtp (453.8 KB)

Hello,

Please, post the code you’re using.

regards,

PC

    NewPoints=vtk.vtkPoints()
    for i in range(normals.GetNumberOfPoints()):
        point=normals.GetPoint(i)
        scale=1
        extension=scale*normalarray[i]
        newpoint=tuple(point+extension)
        NewPoints.InsertNextPoint(newpoint)
        
    
    normals.SetPoints(NewPoints)

@Paulo_Carvalho Thanks for the response! Here is a snippet of my code. normals is the polydata for contour1.vtp shared in the post. normal array is the normal values. I have calculated new points and replaced the old points with new point. then the normal in last line is the polydata for contour2.vtp.

And how about how you generated the contour surface? Certainly there are quite a lot of going on between data load and rendering.

I’m sorry but I didn’t get your question properly. Once we have the new point set in the normals we got the extented surface. In rendering we just displayed the original contour (normals (polydata object) before it undergone extension) and the expanded contour (normals (polydata object) after extension).

As for the problem we were able to get a satisfactory result by using vtkSurfaceReconstructionFilter.