[vtkusers] How to apply different colours to the extracted mean curvature in vtkcurvature
Polly Lina
polly_sukting at hotmail.com
Wed Jan 31 12:29:13 EST 2018
I am applying vtkCurvature "SetCurvatureToMean" to extract the 3D face
polydata.
My question is:
Can anyone please help me on how can I apply different colours to the
extracted dataset by giving a mean curvature threshold. Eg: The values >
0.05 label the surface to black, the values <=0.05 label the surface to
red..etc
This is my code:
vtkCurvatures> meanCurve = vtkCurvatures::New();
meanCurve->SetInputConnection(reader->GetOutputPort());
meanCurve->SetCurvatureTypeToMean();
meanCurve->Update();
vtkLookupTable* lut = vtkLookupTable::New();
lut->SetNumberOfColors(2);
double H;
for (int i = 0; i < nOfPnts; i++)
{
H =
(double)meanCurve->GetOutput()->GetPointData()->GetScalars()->GetTuple1(i);
if (H >= 0.05)
{
lut->SetTableValue(0.0, 0.0, 0.0, 1);
}
else
{
lut->SetTableValue(1.0, 1.0, 1.0, 1);
}
}
lut->Build();
I could only get partially coloured and it is not what i expected.
Thanks and helps are so much appreciated!
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list