[vtkusers] Missing Neighbors in VTKPolyData

Martin Klemm martin.klemm at hs-offenburg.de
Mon Dec 2 09:12:50 EST 2013


The surface was generated by the vtkPowerCrustSurfaceFilter (found here 
http://www.sq3.org.uk/powercrust/ ). Since I need triangles I used a 
trianglefilter afterwards. Then I used a vtkFillHolesFilter in case 
there is a hole (but I think it is not necessary). Then I use two planes 
to clip away a part of the generated surface. Because 
vtkClipClosedSurface can produce lines I used another triangle filter to 
filter out the lines.

And the problem happens with the output of the last triangle filter. So 
my pipeline is as follows:
vtkPowerCrustSurfaceFilter -> vtkTriangleFilter -> vtkFillHolesFilter -> 
vtkClipClosedSurface -> vtkTriangleFilter

Do you know how I can check for cracks in the surface? Or is there even 
a good way to close them?

Thanks for your help!


On 02.12.2013 14:27, Bill Lorensen wrote:
> How was the surface generated. Perhaps there are cracks in the surface.
>
>
> On Mon, Dec 2, 2013 at 2:33 AM, Martin Klemm
> <martin.klemm at hs-offenburg.de> wrote:
>>
>> Hi,
>>
>> I am currently working on a function that passes through all cells of a
>> triangulated power crust surface. Depending on the normal of the cell it is
>> classified as valid or invalid. The algorithm works except of a problem that
>> occurs in certain cells.
>>
>> For my algorithm I use GetCellEdgeNeighbors of vtkPolyData to receive the
>> edge neighbors of a cell. On a closed surface there should be three
>> neighbors for a triangle. However, some triangles just have two neighbors.
>>
>> Then I checked the point neighbors which shows the same result. There are no
>> coincident neighbors on this "weird" edge.
>>
>> Then I rendered the neighbors and the current cell as you can see here:
>>
>> http://www.picamatic.com/view/9881191_Unbenannt/
>>
>> Moreover I print the point neighbors:
>> curCell = 719
>> point neighbors first point: 719 1151 1153
>> point neighbors second point: 714 715 719 721 722 7
>> point neighbors third point: 719 720 721 1151 1152
>>
>> It looks like that even there are neighbors they are not linked to each
>> other. And it seems like there are more neighbors than the renderwindow
>> really shows. Could that be because there are really small triangles that
>> you cannot really see in the renderer? Do you have any suggestions how to
>> improve this situation?
>>
>> And here is my function to get the neighbors of a specified cell:
>>
>>
>> /**
>>   * \brief Gets the neighbors of a specified cell (triangle)
>>   * \param inputTriangles The input cells (triangles)
>>   * \param cellId The specified ID of the cell
>>   * \param neighbors A list with the neighbors of the specified cell
>>   *
>>   * \warning You have to call vtkTriangleFilter before using this function.
>>   * \todo Figure out how it is possible that on a closed surface a triangle
>> can have less than three
>>   * neighbors.
>>   */
>> void SurfaceReconstructScreen::GetCellNeighbors(vtkPolyData* inputTriangles,
>>                                                  vtkIdType cellId,
>>                                                  QList<vtkIdType>& neighbors,
>>                                                  bool debug)
>> {
>>     //clear result list
>>     neighbors.clear();
>>
>>     //build links in order to use getcellneighbors
>>     inputTriangles->BuildLinks();
>>
>>     //
>>     vtkSmartPointer<vtkIdList> cellPointIds =
>> vtkSmartPointer<vtkIdList>::New();
>>     inputTriangles->GetCellPoints(cellId, cellPointIds);
>>
>>     for(vtkIdType i = 0; i < cellPointIds->GetNumberOfIds(); i++)
>>     {
>>        vtkSmartPointer<vtkIdList> idList = vtkSmartPointer<vtkIdList>::New();
>>        vtkIdType firstPoint;
>>        vtkIdType secondPoint;
>>
>>        //add one of the edge points
>>        firstPoint = cellPointIds->GetId(i);
>>
>>        //add the other edge point
>>        if(i+1 == cellPointIds->GetNumberOfIds())
>>        {
>>           secondPoint = cellPointIds->GetId(0);
>>        }
>>        else
>>        {
>>           secondPoint = cellPointIds->GetId(i + 1);
>>        }
>>
>>        //get the neighbors of the cell
>>        vtkSmartPointer<vtkIdList> neighborCellIds =
>> vtkSmartPointer<vtkIdList>::New();
>>
>>        inputTriangles->GetCellEdgeNeighbors(cellId, firstPoint, secondPoint,
>> neighborCellIds);
>>
>>        for(vtkIdType j = 0; j < neighborCellIds->GetNumberOfIds(); j++)
>>        {
>>           neighbors.push_back(neighborCellIds->GetId(j));
>>        }
>>     }
>> }
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>



More information about the vtkusers mailing list