[vtkusers] VTK newbie: please help_vtkOBJReader & vtkBandedPolyDataContourFilter problem :Solved

shajay shajay.bhooshan at gmail.com
Fri Oct 3 13:24:59 EDT 2008


Hey Rich,

(Sorry I misspelt your name earlier.)

It seems that the vtkOBJReader doesnt add any default scalar data to the
vtkPolyData output (reader->GetOutput().

Manually adding scalar information unto the output vtkPolyData seems to sort
the problem. I am not sure if this is the same behaviour as the java
classes. 

It might be that this is the intended behavior and that I made a glaring
newbie error.!

Thanks for your time again,
shajay.

	vtkOBJReader *reader1=vtkOBJReader::New();
	reader1->SetFileName(VTK_DATA_ROOT "test.OBJ");
	reader1->Update();
////////////-additional
	vtkPolyData *inputP=reader1->GetOutput();
	vtkPoints *pts=inputP->GetPoints();
	vtkFloatArray *scalar=vtkFloatArray::New();
	scalar->SetNumberOfTuples(inputP->GetNumberOfPoints());
	for (int i=0;i<inputP->GetNumberOfPoints();i++)
	{
	double coords[3];
	pts->GetPoint(i,coords);
	scalar->InsertValue(i,coords[2]);
	}

	inputP->GetPointData()->SetScalars(scalar);
	inputP->Update();
////////////-additional	
	vtkBandedPolyDataContourFilter  *bcf3 =
vtkBandedPolyDataContourFilter::New();
	bcf3->SetInput(inputP);//bcf3->Update();
	bcf3->GenerateValues(100,inputP->GetPointData()->GetScalars()->GetRange());
	bcf3->SetScalarModeToIndex();
	bcf3->GenerateContourEdgesOn();
	bcf3->UpdateWholeExtent();
	std::cout<<bcf3->GetContourEdgesOutput()->GetNumberOfLines()<<endl;


-- 
View this message in context: http://www.nabble.com/VTK-newbie%3A-please-help_vtkOBJReader---vtkBandedPolyDataContourFilter--problem-tp19782682p19802271.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list