[vtkusers] How to extract area of (triangle) Cells?

Bill Lorensen bill.lorensen at gmail.com
Fri Dec 18 11:01:47 EST 2009


David,

I looked at the source for vtkMeshQuality and I think you have
uncovered a bug. I see vtkDoubleArray named "Quality" added to the
cell data, but I do not see where any data is added to the array.

I noticed that that Graphics/Texting/Cxx/MeshQuality does not access
the CellData.

If it's not tested it's broken,

Bill

On Fri, Dec 18, 2009 at 8:10 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Thu, Dec 17, 2009 at 11:14 AM, Bryn Lloyd <blloyd at vision.ee.ethz.ch>
> wrote:
>>
>> David,
>>
>> Not sure, but it works in paraview doesn't it?
>>
>> 1. Maybe inverted triangles (there was an issue in the past with inverted
>> tets).
>>
>> 2. Maybe you don't have triangles, but strips?
>>
>> /Bryn
>>
>
> Bryn,
> Hmm, I tried it with a sphere source run through vtkTriangleFilter. This
> should produce good triangles, right?
>   vtkSmartPointer<vtkSphereSource> sphereSource =
> vtkSmartPointer<vtkSphereSource>::New();
>   sphereSource->Update();
>
>   vtkSmartPointer<vtkTriangleFilter> triangleFilter =
> vtkSmartPointer<vtkTriangleFilter>::New();
>   triangleFilter->SetInputConnection(sphereSource->GetOutputPort());
>   triangleFilter->Update();
>
>   //vtkPolyData* mesh = sphereSource->GetOutput();
>   vtkPolyData* mesh = triangleFilter->GetOutput();
>   cout << "There are " << mesh->GetNumberOfCells() << " cells." << endl;
>
>   vtkSmartPointer<vtkMeshQuality> qualityFilter =
> vtkSmartPointer<vtkMeshQuality>::New();
>   qualityFilter->SetInput(mesh);
>   qualityFilter->SetTriangleQualityMeasureToArea();
>   qualityFilter->Update();
>
>   vtkDataSet* qualityMesh = qualityFilter->GetOutput();
>   vtkSmartPointer<vtkDoubleArray> qualityArray =
> vtkDoubleArray::SafeDownCast(qualityMesh->GetCellData()->GetArray("Quality"));
>
>   cout << "There are " << qualityArray->GetNumberOfTuples() << " values." <<
> endl;
>
>   for(unsigned int i = 0; i < qualityArray->GetNumberOfTuples(); i++)
>     {
>     double val;
>     qualityArray->GetValue(i);
>     cout << "value " << i << " : " << val << endl;
>     }
> The output is still
> ...
> value 90 : 5.77804e-269
> value 91 : 5.77804e-269
> value 92 : 5.77804e-269
> ...
> Any thoughts?
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages 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
>
>



More information about the vtkusers mailing list