[vtkusers] vtkPolyData DataSet

Marcel Weiss mweiss at cbs.mpg.de
Thu Apr 2 11:30:35 EDT 2009


> in the Java Wrappers exist no VTKidType. Somebody told to convert it into an int 
> but then i cannot use the insertnextcell method you named. 

I´m not familiar with those java wrappers ... sorry.

> another problem with this approach is that the polygons are not sorted. 
> polygon1 can have the points a,b,c and polygon50 a,b,d. when i get the pointids 
> over the insertnextpoint than i have to insert the same more than one time. 

this can be solved by using vtkPointLocator-> IsInsertedPoint(x,y,z) to check if a point already exists while building up your mesh. 

>bye arne 
bye marcel


-----Ursprüngliche Mitteilung----- 
Von: Marcel Weiss <mweiss at cbs.mpg.de> 
An: saurisaran at aol.com 
Cc: mweiss at cbs.mpg.de 
Verschickt: Do., 2. Apr. 2009, 16:50 
Thema: Re: [vtkusers] vtkPolyData DataSet 


I´m not sure, bit i think it´s just some kind of typedef (some unsigned interer 
type) ... from the ancient times ...  

Marcel Weiss
PhD student
Department of Neurophysics
Max Planck Institute for Human Cognitive and Brain Sciences 

----- Original Message -----
From: saurisaran at aol.com To: mweiss at cbs.mpg.de Sent: Thursday, April 2, 2009 4:28:47 PM GMT +01:00 Amsterdam / Berlin / Bern / 
Rome / Stockholm / Vienna
Subject: Re: [vtkusers] vtkPolyData DataSet



hi, 
i have tried to handle with this vtkIDType in the past. is this a class because 
i cannot find it only the=2
0

vtkIdTypeArray 

is this the same? Sorry when i bother you again. 
bye arne. 


vtkPolyData dat = new vtkPolyData();
vtkCellArray polys = new vtkCellArray();
vtkPoints points = new vtkPoints();
vtkIdType pointIDs[3];

vtkIdType p1 = points.InsertNextPoint(0, 0, 0);
vtkIdType p2 = points.InsertNextPoint(1, 1, 1);
vtkIdType p3 = points.InsertNextPoint(2, 2, 2);

poinIDs[0] = p1; poinIDs[1] = p2; poinIDs[2] = p3; 

polys.InsertNextCell(3, pointIDs);

dat.SetPolys(polys);
dat.SetPoints(points); 


-----Ursprüngliche Mitteilung----- 
Von: Marcel Weiss < mweiss at cbs.mpg.de > 
An: saurisaran at aol.com Cc: mweiss at cbs.mpg.de Verschickt: Do., 2. Apr. 2009, 16:01 
Thema: Re: [vtkusers] vtkPolyData DataSet 


I only use a simple array of IDs instead of a vtkIdList 

the real IDs of your points are returned from InsertNextPoint(...) and should 
not be assigned by hand.

vtkPolyData dat = new vtkPolyData();
vtkCellArray polys = new vtkCellArray();
vtkPoints points = new vtkPoints();

vtkIdType pointIDs[3];

vtkIdType p1 = points.InsertNextPoint(0, 0, 0);
vtkIdType p2 = points.InsertNextPoint(1, 1, 1);
vtkIdType p3 = points.InsertNextPoint(2, 2, 2);

poinIDs[0] = p1; poinIDs[1] = p2; poinIDs[2] = p3; 

polys.InsertNextCell(3, pointIDs);

dat.SetPolys(polys);
dat.SetPoints(points);

Marcel Weiss
PhD stu
dent
Department of Neurophysics
Max Planck Institute for Human Cognitive and Brain Sciences 

----- Original Message -----
From: saurisaran at aol.com To: mweiss at cbs.mpg.de Sent: Thursday, April 2, 2009 
3:44:00 PM GMT +01:00 Amsterdam / Berlin / Bern / 
Rome / Stockholm / Vienna
Subject: Re: [vtkusers] vtkPolyData DataSet

Hi, 
thanks for the fast answer. Can you tell me what is wrong because 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); 

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); 
... 

bye then arne 


-----Ursprüngliche Mitteilung----- 
Von: Marcel Weiss < mweiss at cbs.mpg.de > 
An: saurisaran at aol.com 20
Cc: vtkusers at vtk.org Verschickt: Do., 2. Apr. 2009, 15:21 
Thema: Re: [vtkusers] vtkPolyData DataSet 


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

Marcel Weiss
PhD student
Department of Neurophysics
Max Planck Institute for Human Cognitive and Brain Sciences 

----- Original Message -----
From: saurisaran at aol.com To: vtkusers at vtk.org Sent: Thursday, April 2, 2009 
3:03:18 PM GMT +01:00 Amsterdam / Berlin / Bern / 
Rome / Stockholm / Vienna
Subject: [vtkusers] vtkPolyData DataSet


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


Die AOL Toolbar bietet Ihnen sc
hnellen Zugriff 
auf Ihre Lieblings-Internetseiten 
und integrierte Google Websuche. 
_______________________________________________
Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep mess
ages 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 Die AOL 
Toolbar bietet Ihnen schnellen Zugriff auf Ihre Lieblings-Internetseiten 
und integrierte Google Websuche. 


Die AOL Toolbar bietet Ihnen schnellen Zugriff auf Ihre Lieblings-Internetseiten 
und integrierte Google Websuche. 


Die AOL Toolbar bietet Ihnen schnellen Zugriff auf Ihre Lieblings-Internetseiten und integrierte Google Websuche.



More information about the vtkusers mailing list