[vtkusers] vtkContourFilter on 2D Cells (vtkPolygon)
Randall Hand
randall.hand at gmail.com
Wed Feb 1 12:29:20 EST 2006
Do you want edges of all the polys? Or just an outer outline of the entire
construct?
If the outer outline is what you want, have you tried the vtkFeatureEdges
filter?
I tried this just now in Paraview (it's great for experimenting with this
kind of stuff, as it's based on VTK). I loaded an Unstructured Grid with
all 2D cells. I had to use an "Extract Surface" (vtkDataSetSurfaceFilter)
to get it into a vtkPolyData format, but then I could use the "Feature
Edges" (vtkFeatureEdges) filter. Turn off all options except "Boundary
Edges", and voila.
On 2/1/06, Frederic DANESI <fred.danesi at netcourrier.com> wrote:
>
> Dear,
>
> Thanks for this helpful remark… it works now but finally that's not at all
> what I am looking for …
>
> In fact, I would like to find the contour of several polygons … just like
> a boolean operation of "union", so all points of all polygons have the same
> scalar value. I was hoping that vtkContour would assume something like this
> ….
>
> Have you any idea to do this ? …
>
> Thanks,
>
> Fred.
>
>
>
> You're setting the value of all 4 points to "1", and then taking a contour
> of 1. It doesn't intersect anywhere, so I think it's working just right.
>
> Change the scalars to:
> for (int i =0; i <4; i++) scalars->InsertNextValue(i);
>
> And then you'll have 4 different values.
>
> On 2/1/06, *Frederic DANESI* <fred.danesi at netcourrier.com > wrote:
>
> Dear vtkusers,
>
> I am trying something that I believe quite simple, but without any
> success.
>
> I would like to build some vtkPolygons (2D) and then to use
> vtkContourFilter
> to obtain an isoline (which I assume to match with the boundary of all
> polygons together) ...
>
> Even with only one polygon, vtkContourFilter does not do anything
> (vtkContourFilter (09981DD8): Created: 0 points, 0 verts, 0 lines, 0
> triangles) ...
>
> I enclosed my code hereafter.
>
> I will really appreciate any idea, tips on what I missed or what I'm doing
> wrong, or any code example...
>
> Thanks,
> Fred.
>
> ----
>
> vtkPolygon *polygon = vtkPolygon::New();
>
> polygon->GetPointIds()->SetNumberOfIds(4);
> polygon->GetPointIds()->SetId(0,0);
> polygon->GetPointIds()->SetId(1,1);
> polygon->GetPointIds()->SetId(2,2);
> polygon->GetPointIds()->SetId(3,3);
>
> polygon->GetPoints()->SetNumberOfPoints(4);
> polygon->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0);
> polygon->GetPoints()->SetPoint(1, 10.0, 0.0, 0.0);
> polygon->GetPoints()->SetPoint(2, 10.0, 10.0, 0.0);
> polygon->GetPoints()->SetPoint(3, 0.0, 10.0, 0.0);
>
> vtkIntArray * scalars = vtkIntArray::New();
> scalars->Allocate(5000,10000);
> for (int i =0; i <4; i++) scalars->InsertNextValue(1);
>
> vtkPolyData * polygonPolyData = vtkPolyData::New();
> polygonPolyData->Allocate(1,1);
> polygonPolyData->InsertNextCell(polygon->GetCellType(),
> polygon->GetPointIds());
> polygonPolyData->SetPoints(polygon->GetPoints());
> polygonPolyData->GetPointData()->SetScalars(scalars);
>
> // mapping and rendering "polygonPolyData" ==> OK ...
>
> vtkContourFilter * flt = vtkContourFilter ::New();
> flt->SetInput((vtkDataSet *)output);
> flt->DebugOn();
> flt->SetValue(0,1);
>
> //+ mapping and rendering ==> vtkContourFilter (09981DD8): Created: 0
> points, 0 verts, 0 lines, 0 triangles ... empty ...
>
> --
> Responsable Département DINCCS
> (Département Ingénierie Numérique Conception Collaborative et Simulation)
> Pole de Haute Technologie
> 08000 Charleville-Mézières
> Tél. 03.24.37.89.89
>
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
> --
> Randall Hand
> Visualization Scientist,
> ERDC-MSRC Vicksburg, MS
> Homepage: http://www.yeraze.com
>
--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060201/2fcf2dda/attachment.htm>
More information about the vtkusers
mailing list