[vtkusers] mesh resolution

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Mar 22 12:13:29 EST 2004


Bernhard Mayrhofer wrote:
> Hi!
> i want to calculate the mesh resolution of triangulated data (from 
> objreader->trianglefilter->decimate->polydatanormals->polydata ). i 
> indend to calculate the median length between connected points (i didn´t 
> found a method, which can do this or similar)
>  
> i used following code to obtain the length:
> 
> cPoints=ViewNormals->GetOutput()->GetNumberOfCells();
> for(ID=0;ID<cPoints;ID++)
> {
> ViewNormals->GetOutput()->GetCell(ID,cell);
> cell->GetEdge(ID); //cell..vtkCell
> length[ID]=sqrt(cell->GetEdge(ID)->GetLength2()); //length..floatarray
> }
> i think there are a view problems. not all values of length stored in 
> the array are possible, there are extremly big values. i think this are 
> random values. i don´t know if ID<cPoints is ok.
>  
> I also tried following instead:
>  
> edge=cell->GetNumberOfEdges();
> 
> the value was 3. i think this is because i used vtkTriangleFilter.
> Now i have no more ideas. Maybe you can help me.

Bernhard,

	I don't understand. You are using a vtkTriangleFilter but you don't 
want your data to be triangulated ? If so just don't use the filter.

	Also this line is wrong:

 > cell->GetEdge(ID); //cell..vtkCell

	You should not try to access edge #ID if:

    ID > cell->GetNumberOfEdges()

	Maybe do a for loop

for(edge=0;edge<cell->GetNumberOfEdges() ;edge++)
	cell->GetEdge(edge);

Also try to read the code of vtkMeshQuality it might help you write your 
own filter.

HTH
Mathieu





More information about the vtkusers mailing list