[vtkusers] vtkPolyData DataSet

saurisaran at aol.com saurisaran at aol.com
Thu Apr 2 16:37:51 EDT 2009


hi,
thanks for the answer. i use the Java wrapper classes so i have a problem with the method 
InsertNextCell(num,cellIDs) because i don´t know i can handle the cellids in java. i try it this way 
but i get an error:
...

vtkPolyData dat = new vtkPolyData();




vtkPoints points = new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNextPoint(1, 1, 1);

points.InsertNextPoint(2, 2, 2);



vtkPolygon p = new vtkPolygon();
p.GetPointIds().SetId(0, 0);

p.GetPointIds().SetId(1 1);

p.GetPointIds().SetId(2, 2);



dat.SetPoints(points);

vtkCellArray polys = new vtkCellArray();
polys.InsertNextCell(p);

dat.SetPolys(polys);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);






new vtkPolyData();




vtkPoints points = new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNextPoint(1, 1, 1);

points.InsertNextPoint(2, 2, 2);



vtkPolygon p = new vtkPolygon();
p.GetPointIds().SetId(0, 0);

p.GetPointIds().SetId(1 1);

p.GetPointIds().SetId(2, 2);



dat.SetPoints(points);

vtkCellArray polys = new vtkCellArray();
polys.InsertNextCell(p);

dat.SetPolys(polys);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);





new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNextPoint(1, 1, 1);

points.InsertNextPoint(2, 2, 2);



vtkPolygon p = new vtkPolygon();
p.GetPointIds().SetId(0, 0);

p.GetPointIds().SetId(1 1);

p.GetPointIds().SetId(2, 2);



dat.SetPoints(points);

vtkCellArray polys = new vtkCellArray();
polys.InsertNextCell(p);

dat.SetPolys(poly
s);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);




new vtkPolygon();
p.GetPointIds().SetId(0, 0);

p.GetPointIds().SetId(1 1);

p.GetPointIds().SetId(2, 2);



dat.SetPoints(points);

vtkCellArray polys = new vtkCellArray();
polys.InsertNextCell(p);

dat.SetPolys(polys);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);



new vtkCellArray();
polys.InsertNextCell(p);

dat.SetPolys(polys);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);


new vtkPolyDataMapper();
objectmapper.SetInput(dat);

...

an alternative approach i tried was the following but also got an error:
...

vtkPolyData dat = new vtkPolyData();


vtkPoints points = new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNextPoint(1, 0, 0);

points.InsertNextPoint(1, 0, 1);



dat.SetPoints(points);



vtkIdList list = new vtkIdList();
list.InsertNextId(0);

list.InsertNextId(1);

list.InsertNextId(2);



dat.InsertNextCell(3, list);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);




new vtkPolyData();


vtkPoints points = new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNextPoint(1, 0, 0);

points.InsertNextPoint(1, 0, 1);



dat.SetPoints(points);



vtkIdList list = new vtkIdList();
list.InsertNextId(0);

list.InsertNextId(1);

list.InsertNextId(2);



dat.InsertNextCell(3, list);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);



new vtkPoints();
points.InsertNextPoint(0, 0, 0);

points.InsertNex
tPoint(1, 0, 0);

points.InsertNextPoint(1, 0, 1);



dat.SetPoints(points);



vtkIdList list = new vtkIdList();
list.InsertNextId(0);

list.InsertNextId(1);

list.InsertNextId(2);



dat.InsertNextCell(3, list);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);


new vtkIdList();
list.InsertNextId(0);

list.InsertNextId(1);

list.InsertNextId(2);



dat.InsertNextCell(3, list);



vtkPolyDataMapper objectmapper = new vtkPolyDataMapper();
objectmapper.SetInput(dat);

new vtkPolyDataMapper();
objectmapper.SetInput(dat);
...
bye then arne









you can use the InsertNextCell(num,cellIDs) function of vtkPolyData...
um is the number of points foming the cell, so three in your case of triangles.
ellIDs is an array of the pointIDs. 

i, 
 am still new to VTK but i have al little problem. i want to create a 
tkPolyData DataSet from scratch. In my programm 
 have a list of point with their coordinates and a list of triangles. A 
riangle is defined by the indices of the pointlist points. 
y question is how can I create the DataSet. I use the Java wrapper classes. My 
irst step was to create an vtkPoints 
bject and use the insertnextpoint method with the coordinates. Now i have the 
roblem with the triangles/polygons. 
 don´t know to handle with the vtkCellArray or how i can create a 
riangle/polygon and insert it in vtkCellArray. 
ye then arne. 


________________________________________________________________________
AOL eMail auf Ihrem Handy! Ab sofort können Sie a
uch unterwegs Ihre AOL email abrufen. Registrieren Sie sich jetzt kostenlos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090402/e62903fd/attachment.htm>


More information about the vtkusers mailing list