[Paraview] writing spheres, cones, etc.
Benjamin Auffarth
auffarth at csc.kth.se
Sun Feb 13 10:29:11 EST 2011
Hi,
I am new to using VTK and paraview, so excuse me if my question is too
obvious. I've been looking into several manuals and the online VTK wiki, but
couldn't find exactly what I was looking for.
I want to visualize abstract shapes, mainly spheres and cones. After
looking into different formats, such as legacy VTK, and trying to create
these shapes from polygons, I am now using VTK from C++ to create the shapes
I want. However my problem is now that I don't know how to store them
(except for taking a screenshot). Is there a writer I can use for that?
Also: once I am satisfied with my visualization, I would like to be able to
export to povray. It would be very convenient to be turn my objects until I
have a good viewpoint and then export with camera and light sources
accordingly to pov format. Could somebody give a simple example how this is
possible?
Thanks a lot,
Benjamin.
My template now looks like this and is based on examples in the wiki:
int main(int argc, char** argv[])
{
std::vector<vtkSmartPointer<vtkPolyDataAlgorithm> >
geometricObjectSources;
geometricObjectSources.push_back(vtkSmartPointer<vtkSphereSource>::New());
geometricObjectSources.push_back(vtkSmartPointer<vtkCylinderSource>::New());
std::vector<vtkSmartPointer<vtkRenderer> > renderers;
std::vector<vtkSmartPointer<vtkPolyDataMapper> > mappers;
std::vector<vtkSmartPointer<vtkActor> > actors;
// Visualize
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
// Create a source, renderer, mapper, and actor
// for each object
for(unsigned int i = 0; i < geometricObjectSources.size(); i++){
geometricObjectSources[i]->Update();
mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());
mappers[i]->SetInputConnection(geometricObjectSources[i]->GetOutputPort());
actors.push_back(vtkSmartPointer<vtkActor>::New());
actors[i]->SetMapper(mappers[i]);
renderer->AddActor(actors[i]);
}
renderWindow->Render();
renderWindowInteractor->Start();
//// Here I want to write my objects into a file
//// or: turn the object and then export to povray with camera according
to viewpoint
return EXIT_SUCCESS;
}
----
Benjamin Auffarth
KTH, Computational Biology and Neurocomputing (CBN),
Albanova Universitetscentrum, Roslagstullsbacken 35,
S-100 44 Stockholm, Sweden
room 162:021B, tel. +46 8 790 8699
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110213/bddd99e5/attachment.htm>
More information about the ParaView
mailing list