[vtkusers] vtkMeshQuality Check, only one quality criteria is displayed at a time.. WHY?

David Doria daviddoria+vtk at gmail.com
Tue Mar 2 10:07:14 EST 2010


On Mon, Mar 1, 2010 at 11:37 PM, Rakesh Patil <rakeshthp at in.com> wrote:

> Hi,
>
> What a stupidity.. I should have done it last time itself.. Please excuse
> me for that.. So here it goes..
>
> vtkSmartPointer<vtkMeshQuality> qualityMesh =
> vtkSmartPointer<vtkMeshQuality>::New();
> qualityMesh->SetInput(uGrid);
>
> if(_maxAngleQualityFlag)
> {
> qualityMesh->SetTriangleQualityMeasureToMaxAngle();
> qualityMesh->Update();
>
> vtkSmartPointer<vtkDoubleArray> qualityArray =
> vtkDoubleArray::SafeDownCast(
> qualityMesh->GetOutput()->GetCellData()->GetArray("Quality"));
> qualityArray->SetName("qualityArr");
>
> vtkSmartPointer<vtkThreshold> badcells =
> vtkSmartPointer<vtkThreshold>::New();
> badcells->SetInput( qualityMesh->getOutput());
> badcells->ThresholdByUpper(120);
> badcells->SetInputArrayToProcess(0,0,0,
> vtkDataObject::FIELD_ASSOCIATION_CELLS, "qualityArr");
> badcells->Update();
>
> vtkSmartPointer& lt;vtkDataSetMapper> mapp =
> vtkSmartPointer<vtkDataSetMapper>::New();
> mapp->SetInput(badcells->GetOutput());
> mapp->ScalarVisibilityOff();
>
> pRenderer->RemoveActor(maxAngleActor);
> maxAngleActor = vtkSmartPointer<vtkActor>::New();
> maxAngleActor->SetMapper(mapp);
> maxAngleActor->GetProperty()->SetColor(0, 0, 1);
> maxAngleActor->GetProperty()->SetLineWidth(3);
> maxAngleActor->GetProperty()->SetRepresentationToWireframe();
>
> pRenderer->AddActor(maxAngleActor);
> }
>
> if(_minAngleQualityFlag)
> {
> qualityMesh->SetTriangleQualityMeasureToMinAngle();
> qualityMesh->Update();
>
> vtkSmartPointer<vtkDoubleArray> qualityArray =
> vtkDoubleArray::SafeDownCast(
> qualityMesh->GetOutput()->GetCellData()->GetArray("Quality"));
> qualityArray->SetName("qualityArr");
>
> vtkSmartPointer<vtkThreshold> badcells =
> vtkSmartPointer<vtkThreshold>::New();
> badcells->SetInput( qualityMesh->getOutput());
> badcells->ThresholdByLower(20);
> badcells->SetInputArrayToProcess(0,0,0,
> vtkDataObject::FIELD_ASSOCIATION_CELLS, "qualityArr");
> badcells->Update();
>
> vtkSmartPointer<vtkDataSetMapper> mapp =
> vtkSmartPointer<vtkDataSetMapper>::New();
> mapp->SetInput(badcells->GetOutput());
> mapp->ScalarVisibilityOff();
>
> pRenderer->RemoveActor(minAngleActor);
> minAngleActor = vtkSmartPointer<vtkActor>::New();
> minAngleActor->SetMapper(mapp);
> minAngleActor->GetProperty()->SetColor(1, 0, 0);
> minAngleActor->GetProperty()->SetLineWidth(3);
> minAngleActor->GetProperty()->SetRepresentationToWireframe();
>
> pRenderer->AddActor(minAngleActor);
> }
>
> So in this case, the cells disqualifying min angle criteria will be
> visible, even if both flags are true. If i change the order of rendering..
> i.e. minAngle block first and then maxAngle block, then only cells
> disqualifying max angle criteria are only displayed.
>
> Can you figure out any mistake there??
>
> Thanks
>
> Regards
> Rakesh Patil
>

I'm not sure if you can do it with only one vtkMeshQuality filter. Maybe
someone can comment if that is possible. I would just go ahead and make a
new vtkMeshQuality filter inside each condition:

if(_maxAngleQualityFlag)
{
vtkSmartPointer<vtkMeshQuality> qualityMesh =
vtkSmartPointer<vtkMeshQuality>::New();
qualityMesh->SetInput(uGrid);
...

if(_minAngleQualityFlag)
{
vtkSmartPointer<vtkMeshQuality> qualityMesh2 =
vtkSmartPointer<vtkMeshQuality>::New();
qualityMesh2->SetInput(uGrid);

qualityMesh2->SetTriangleQualityMeasureToMinAngle();
qualityMesh2->Update();
....

That should definitely work.

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100302/d2608037/attachment.htm>


More information about the vtkusers mailing list