[vtkusers] Fwd: Re: Extract Closed Polygons from vtkPolydata

Ahmed Khaled ak at plaxis.com
Tue Mar 24 04:10:11 EDT 2015


Hi,

I have a 2D mesh as the grey one in the photo(the photo is attached) as an
stl i used  vtkFeatureEdges to extract and draw the green borders but i am
wondering how can I extract the inner and the outer green rectangles in 2
different vtkPolydata instances.

Is there any other way better than using vtkFeatureEdges?

the vtp file from the output of the vtkFeatureEdges
here is the code I wrote

void renderPoint(double* point, double[3] color, float opacity, float point
size)
{

 //Rendering code
  ...

}

void main()
{

vtkSmartPointer<vtkSTLReader> reader =
    vtkSmartPointer<vtkSTLReader>::New();
  reader->SetFileName("window.stl");
  reader->Update();

  auto polyData = reader->GetOutput();

  vtkSmartPointer<vtkFeatureEdges> featureEdges =
    vtkSmartPointer<vtkFeatureEdges>::New();
  featureEdges->SetInput(mFinitePolyData);
  featureEdges->BoundaryEdgesOn();
  featureEdges->FeatureEdgesOff();
  featureEdges->ManifoldEdgesOff();
  featureEdges->NonManifoldEdgesOff();
  featureEdges->ColoringOff();
  featureEdges->Update();

  mBoundaryPolyData = featureEdges->GetOutput();

  for (int i = 0; i < 10; ++i)
  {
    renderPoint(mBoundaryPolyData->GetPoint(i), blue, 1.0, 5.0);
  }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150324/87524cd4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mesh.PNG
Type: image/png
Size: 6489 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150324/87524cd4/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: edges.vtp
Type: application/octet-stream
Size: 16316 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150324/87524cd4/attachment.obj>


More information about the vtkusers mailing list