[vtkusers] vtkContourFilter on 2D Cells (vtkPolygon)
Randall Hand
randall.hand at gmail.com
Wed Feb 1 10:11:51 EST 2006
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060201/d5516f4d/attachment.htm>
More information about the vtkusers
mailing list