[vtkusers] vtkPoints Adding too many points?

Ambar C ambarc at gmail.com
Tue Nov 16 01:11:25 EST 2010


I'm have a set of vtkPoint references, and each reference seems to be
getting the points added to it's predecessor as well as the ones added
to itself. Here's the basic code:

	vtkPolyData *poly1 = vtkPolyData::New();
	vtkPolyData *poly2 = vtkPolyData::New();
	vtkPolyData *poly3 = vtkPolyData::New();
	vtkPolyData *poly4 = vtkPolyData::New();

	vtkPoints *points1 = vtkPoints::New();
	vtkPoints *points2 = vtkPoints::New();
	vtkPoints *points3 = vtkPoints::New();
	vtkPoints *points4 = vtkPoints::New();

	//Inserting points.
	
	points1->InsertPoint(0, 1, 4, 5);
	points1->InsertPoint(1, -1, 3, 2);
	points1->InsertPoint(2, -4, -4, -4);

	points2->InsertPoint(3, 2, 8, 9);
	points2->InsertPoint(4, -2, 2, 3);
	points2->InsertPoint(5, 4,  5,  5);

	points3->InsertPoint(6, -1, 4, -5);
	points3->InsertPoint(7, -4, -2, -2);
	points3->InsertPoint(8, -2, -9, 9);

	points4->InsertPoint(9, 1, 6, 5);
	points4->InsertPoint(10, -1, 3, 2);
	points4->InsertPoint(11, -4, -4, -4);
	cout<<points4->GetNumberOfPoints()<<"
"<<points3->GetNumberOfPoints()<<" "<<points2->GetNumberOfPoints()<<"
"<<points1->GetNumberOfPoints()<<" "<<endl;
	//Setting the points as the data.

	poly1->SetPoints(points1);
	poly2->SetPoints(points2);
	poly3->SetPoints(points3);
	poly4->SetPoints(points4);

	cout<<poly4->GetNumberOfPoints()<<" "<<poly3->GetNumberOfPoints()<<"
"<<poly2->GetNumberOfPoints()<<" "<<poly1->GetNumberOfPoints()<<"
"<<endl;

The output I get is
12 9 6 3
12 9 6 3

Instead of the expected
3 3 3 3
3 3 3 3



More information about the vtkusers mailing list