[vtkusers] Please Help: Quadratic Cells

Davood Ansari david.ansari at gmail.com
Wed Nov 11 11:46:54 EST 2009


Hi all
I used the following example code to see how the quadratic Tetrahedron gets
on the screen.
Surprisingly it is not a curved object but kind of multi linear .
What is wrong with my pipeline ?




int main(int argc, char** argv)
{
    vtkUnstructuredGrid *meshGrid = vtkUnstructuredGrid::New() ;

    VTK_CREATE(vtkPoints, points);
    //points->Allocate(24);
    points->InsertNextPoint(0.,0.,0.) ;
    points->InsertNextPoint(1.,0.,0.) ;
    points->InsertNextPoint(0.,1.,0.) ;
    points->InsertNextPoint(0.,0.,1.) ;

    points->InsertNextPoint(0.5,0.,0.) ;
    points->InsertNextPoint(0.5,0.5,0.) ;
    points->InsertNextPoint(0.0,0.5,0.) ;

    points->InsertNextPoint(0.,0.,0.5) ;
    points->InsertNextPoint(0.65,0.,0.65) ;
    points->InsertNextPoint(0.,0.65,0.65) ;

    meshGrid->SetPoints(points) ;

    vtkIdList* pts = vtkIdList::New();
    pts -> InsertId(0,0) ;
    pts -> InsertId(1,1) ;
    pts -> InsertId(2,2) ;
    pts -> InsertId(3,3) ;
    pts -> InsertId(4,4) ;
    pts -> InsertId(5,5) ;
    pts -> InsertId(6,6) ;
    pts -> InsertId(7,7) ;
    pts -> InsertId(8,8) ;
    pts -> InsertId(9,9) ;

    meshGrid->InsertNextCell (VTK_QUADRATIC_TETRA, pts) ;

    vtkDataSetMapper *meshMapper = vtkDataSetMapper::New();
    meshMapper -> SetInput(meshGrid);
    //meshMapper -> SetRepresentationToWireframe() ;

    vtkActor *meshActor = vtkActor::New();
    meshActor -> SetMapper(meshMapper);

    vtkRenderer *ren = vtkRenderer::New() ;
    ren -> SetBackground(0.2,0.2,0.15) ;
    ren -> AddActor(meshActor) ;

    vtkRenderWindow *renWin = vtkRenderWindow::New() ;
    renWin ->AddRenderer(ren) ;
    renWin ->SetSize(1024,768) ;

    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New() ;
    iren -> SetRenderWindow(renWin);
    iren -> Initialize();
    iren -> Start();

   std::cout << std::endl ;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091111/30113f55/attachment.htm>


More information about the vtkusers mailing list