[vtkusers] vtkCatmullClarkFilter HELP PLEASE!!
minococciolo at libero.it
minococciolo at libero.it
Fri Oct 31 06:03:54 EDT 2008
Hello everybody,
I'm trying to use vtkCatmullClarkFilter to create a
quadrangular mesh.
Unfortunately, the documentation about it on the web is
quite null. Is there someone who can help me?
I'm using C++ with Visual C++
Express 2005, but every example or source code in tcl, python etc. is good.
Thank you very much.
/*----------Here is a simple code. It doesn't work!
------------*/
#include....
int main(int argc, char** argv)
{
// First we'll
create some points.
//
vtkPoints *points = vtkPoints::New();
points-
>InsertPoint(0, 0.0, 0.0, 0.0);
points->InsertPoint(1, 0.0, 1.0, 0.0);
points-
>InsertPoint(2, 1.0, 1.0, 0.0);
points->InsertPoint(3, 1.0, 0.0, 0.0);
vtkCellArray *strips = vtkCellArray::New();
strips->InsertNextCell(4);
strips-
>InsertCellPoint(0);
strips->InsertCellPoint(1);
strips->InsertCellPoint(2);
strips->InsertCellPoint(3);
vtkPolyData *profile = vtkPolyData::New();
profile->SetPoints(points);
profile->SetPolys(strips);
vtkCatmullClarkFilter
*cc = vtkCatmullClarkFilter::New();
cc->SetNumberOfSubdivisions(4);
cc-
>SetInput(profile);
cc->Execute();
cc->Update();
vtkPolyDataMapper *map =
vtkPolyDataMapper::New();
map->SetInput(cc->GetOutput());
vtkActor *strip =
vtkActor::New();
strip->SetMapper(map);
strip->GetProperty()->SetColor
(0.3800, 0.7000, 0.1600);
// Create the usual rendering stuff.
vtkRenderer
*ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// Add the
actors to the renderer, set the background and size
//
ren1->AddActor(strip);
ren1->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(250, 250);
renWin-
>Render();
// render the image
iren->Initialize();
iren->Start();
return
0 ;
}
More information about the vtkusers
mailing list