i have created icosahedron , subdivided it, not trying display seems displaying un-subdivided. here code:
vtksmartpointer<vtkplatonicsolidsource> icosahedron = vtksmartpointer<vtkplatonicsolidsource>::new(); icosahedron->setsolidtypetoicosahedron(); icosahedron->update(); cout << " centre " << icosahedron->getoutput()->getcenter()[0] << ", " << icosahedron->getoutput()->getcenter()[1] << ", " << icosahedron->getoutput()->getcenter()[2] << endl; cout << " there " << icosahedron->getoutput()->getnumberofpolys() << " triangles." << endl; cout << " there " << icosahedron->getoutput()->getnumberofpoints() << " points " << endl; vtksmartpointer<vtkpolydataalgorithm> subdivisionfilter; subdivisionfilter = vtksmartpointer<vtklinearsubdivisionfilter>::new(); dynamic_cast<vtklinearsubdivisionfilter *> (subdivisionfilter.getpointer())->setnumberofsubdivisions(2); subdivisionfilter->setinput(icosahedron->getoutput()); subdivisionfilter->update(); cout << " after " << endl; std::cout << " there " << subdivisionfilter->getoutput()->getnumberofpoints() << " points." << std::endl; std::cout << " there " << subdivisionfilter->getoutput()->getnumberofpolys() << " triangles." << std::endl; vtksmartpointer<vtkpolydatamapper> mapper = vtksmartpointer<vtkpolydatamapper>::new(); mapper->setinputconnection(subdivisionfilter->getoutputport()); vtksmartpointer<vtkactor> actor = vtksmartpointer<vtkactor>::new(); actor->setmapper(mapper); vtksmartpointer<vtkrenderer> renderer = vtksmartpointer<vtkrenderer>::new(); vtksmartpointer<vtkrenderwindow> renderwindow = vtksmartpointer<vtkrenderwindow>::new(); renderwindow->addrenderer(renderer); vtksmartpointer<vtkrenderwindowinteractor> renderwindowinteractor = vtksmartpointer<vtkrenderwindowinteractor>::new(); renderwindowinteractor->setrenderwindow(renderwindow); //add actors scene renderer->addactor(actor); renderer->setbackground(.1, .2, .3); //render , interact renderwindow->render(); renderwindowinteractor->start();
the console output is:
centre 0, 0, 0 there 20 triangles. there 12 points after there 162 points. there 320 triangles.
confirming has indeed been subdivided.
i can see divisions after turning on wireframe mode:
#include <vtkproperty.h> .... actor->getproperty()->setrepresentationtowireframe();
what seeing algorithm adding new points in same plane existing triangle, when render result surface not different.
Comments
Post a Comment