[vtkusers] Drawing half a million "vtkParametricEllipsoid"s

VoodooCode MaxSchererMax at gmail.com
Thu May 23 08:36:57 EDT 2013


I don't understand how to apply the different rotations and scalings to the
each sphere.

This is the short complete compileable codesample, at the moment all spheres
are equal:

int main()
{
	vtkSmartPointer<vtkRenderer> renderer_ =
vtkSmartPointer<vtkRenderer>::New();
	vtkSmartPointer<vtkGlyph3D> glyph_  = vtkSmartPointer<vtkGlyph3D>::New();
	vtkSmartPointer<vtkPoints> rawMap_  = vtkSmartPointer<vtkPoints>::New();
	vtkSmartPointer<vtkPolyData> polyMap_ =
vtkSmartPointer<vtkPolyData>::New();

	int amount = 10;

	VTKTests *vtkTest = new VTKTests();
	std::vector<Eigen::Vector3d, Eigen::aligned_allocator&lt;Eigen::Vector3d> >
radii;
	std::vector<Eigen::Matrix3d, Eigen::aligned_allocator&lt;Eigen::Matrix3d> >
rotations;

	Eigen::Matrix3d test;
	test << 1, 0, 0,
			0, 1, 0,
			0, 0, 1;

	for(int i = 0; i < amount; i++)
	{
		for(int j = 0; j < amount; j++)
		{
			for(int k = 0; k < amount; k++)
			{
				rawMap_->InsertNextPoint(i, j, k);

				radii.push_back(Eigen::Vector3d(10, 10, 10));
				rotations.push_back(test);
			}
		}
	}
	
	vtkSmartPointer<vtkCubeSource> cubeSource =
vtkSmartPointer<vtkCubeSource>::New();
	vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
	polyMap_->SetPoints(rawMap_);
	polyMap_->Update();
 
	vtkSmartPointer<vtkGlyph3DMapper> mapper =
vtkSmartPointer<vtkGlyph3DMapper>::New();
	mapper->SetSource(sphereSource->GetOutput());
	mapper->SetInputConnection(polyMap_->GetProducerPort());
	mapper->Update();

	vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
	actor->SetMapper(mapper);
	
	renderer_->AddActor(actor);

	vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
	renderWindow->AddRenderer(renderer_);

renderWindowInteractor->SetRenderWindow(renderWindow);renderWindow->Render();
	renderWindowInteractor->Start();
	
	return 0;
}



--
View this message in context: http://vtk.1045678.n5.nabble.com/Drawing-half-a-million-vtkParametricEllipsoid-s-tp5720865p5720923.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list