[vtkusers] mesh resolution
Bernhard Mayrhofer
bernhard at wien-zentral.kolping.at
Thu Mar 25 04:59:59 EST 2004
Thanks for your answer. Sorry for asking confusing questions.
Following code shows my solution:
int i,k,l,edge,e=0;
float dummy,median;
float fBounds[6];
vtkFloatArray *length = vtkFloatArray::New();
vtkGenericCell *cell = vtkGenericCell::New();
length->SetNumberOfTuples(1);
for(i=0;i<ViewNormals->GetOutput()->GetNumberOfCells();i++)
{
ViewNormals->GetOutput()->GetCell(i,cell);
for (edge=0;edge<cell->GetNumberOfEdges();edge++)
{
cell->GetEdge(edge);
cell->GetEdge(edge)->GetBounds(fBounds);
length->InsertNextValue(sqrt(pow(fBounds[1]-fBounds[0],2)+pow(fBounds[3]-fBo
unds[2],2)+pow(fBounds[5]-fBounds[4],2)));
e++;
}
}
..................
Bernhard
----- Original Message -----
From: "Mathieu Malaterre" <mathieu.malaterre at kitware.com>
To: "Bernhard Mayrhofer" <bernhard at wien-zentral.kolping.at>
Cc: <vtkusers at vtk.org>
Sent: Monday, March 22, 2004 6:13 PM
Subject: Re: [vtkusers] mesh resolution
> 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