[vtkusers] Please Help: Quadratic Cells
Moreland, Kenneth
kmorel at sandia.gov
Wed Nov 11 12:42:49 EST 2009
You may also be interested in some changes I plan to check in soon to vtkDataSetSurfaceFilter that will allow you to control the subdivision used when approximating nonlinear surfaces with polygons. It's not as sophisticated as the tessellator as it will subdivide each face the same amount regardless of the error, but it will be easer to use because you will not have to consider what fields to use for the error metric.
-Ken
On 11/11/09 10:26 AM, "David Thompson" <dcthomp at sandia.gov> wrote:
Hi Davood,
OpenGL and other rendering libraries only draw points, lines, and triangles.
Over any of these graphics primitives, fields such as texture coordinates or
color will vary linearly. VTK must convert the nonlinear element into a series
of these primitives. The default is to use the fewest possible number of
primitives so that meshes with many cells can be rendered efficiently. In order
to get a more accurate rendering, you should try using the vtkTessellatorFilter
which will subdivide the element (or its boundaries) according to an error metric.
David
________________________________________
From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] On Behalf Of Davood Ansari [david.ansari at gmail.com]
Sent: Wednesday, November 11, 2009 08:46
To: vtkusers at vtk.org
Subject: [vtkusers] Please Help: Quadratic Cells
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 ;
}
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
**** Kenneth Moreland
*** Sandia National Laboratories
***********
*** *** *** email: kmorel at sandia.gov
** *** ** phone: (505) 844-8919
*** web: http://www.cs.unm.edu/~kmorel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091111/4aaf3157/attachment.htm>
More information about the vtkusers
mailing list