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

David Doria daviddoria+vtk at gmail.com
Fri Dec 18 12:47:26 EST 2009


On Fri, Dec 18, 2009 at 11:50 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Vince,
>
> I think the code is fine. The bug was in the user's code.
>
> Sorry for the noise,
>
> Bill
>
> On Fri, Dec 18, 2009 at 11:32 AM, Magnotta, Vincent A
> <vincent-magnotta at uiowa.edu> wrote:
>> The quality array is set near line 730 in my version of vtkMeshQuality
>> (5.2). It appears that the quality->Delete(); method should be removed from
>> line 445 and moved to line 745.
>>
>> Vince
>>
>>
>> ----------------------
>> Associate Professor
>> Department of Radiology
>> 0453-D JCP
>> 200 Hawkins Drive
>> Iowa City, IA 52242
>> E-mail: vincent-magnotta at uiowa.edu
>> Phone: 319-356-8255 Fax: 319-353-6275
>> Website: http://www.radiology.uiowa.edu
>>
>>
>>
>> -----Original Message-----
>> From: vtkusers-bounces at vtk.org on behalf of Bill Lorensen
>> Sent: Fri 12/18/2009 10:01 AM
>> To: David Doria
>> Cc: vtkusers at vtk.org
>> Subject: Re: [vtkusers] How to extract area of (triangle) Cells?
>>
>> 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
>>>

The noise was my fault - apologies, shame indeed.

Thanks,

David D.



More information about the vtkusers mailing list