[vtkusers] Difference between AddArray and SetScalars

madz madaramh at gmail.com
Fri Dec 6 00:45:36 EST 2013


I have a graph which I want to colour by a value. When I'm setting the colour
values in addArray, I noticed that the colour range and distribution was
better than that of SetScalars. What is the reason for this? The code;

                double bound[6];
	        outputPolyData->GetPoints()->GetBounds(bound);
		double min = bound[4], max = bound[5];

		vtkSmartPointer<vtkDoubleArray> tempArray =
vtkSmartPointer<vtkDoubleArray>::New();
		tempArray->SetName("colordata");
		for(int i=0;i<zVal.size();i++)
		{
			tempArray->InsertNextValue(zVal[i]);
		}
		outputPolyData->GetPointData()->SetScalars(tempArray); //or AddArray


		colorLookupTable->SetTableRange(min,max);
		double vmin,vmax; 
		colorLookupTable->GetHueRange(vmin,vmax);
		if(vmin!=vmax)
		{
			colorLookupTable->SetHueRange(0.6667,0.0);
		}
		colorLookupTable->Build();




--
View this message in context: http://vtk.1045678.n5.nabble.com/Difference-between-AddArray-and-SetScalars-tp5724868.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list