[Insight-users] A question about drawing mesh with opengl
Dan Mueller
dan.muel at gmail.com
Thu Nov 20 03:22:05 EST 2008
Hi,
> how can I get the points of the cell?
You can retrieve the points of the mesh using the following:
MeshType::PointsContainer* points = mesh->GetPoints();
You can retrieve the cell information (i.e. triangles for
TriangleCell) using the following:
MeshType::CellsContainer* cells = mesh->GetCells();
Both of these container types define iterators which can be used to
step through the collection:
MeshType::CellsContainerPointer cells = mesh->GetCells( );
MeshType::CellsContainerConstIterator it = cells->Begin();
MeshType::CellsContainerConstIterator itEnd = cells->End();
while ( it != itEnd )
{
MeshType::CellType cell = it.Value();
MeshType::CellType::PointIdConstIterator itCell =
cell->PointIdsBegin();
MeshType::CellType::PointIdConstIterator itCellEnd =
cell->PointIdsEnd();
while( itCell != itEnd )
{
unsigned long cellPointIndex = *it;
// Do something with the point index
++itCell;
}
++it;
}
I have not compiled this code (just snipped it from different places)
but it should give you an idea how to access points/cells.
Also you can look at sections 4.2 and 4.3 of the ITK Software Guide:
http://www.itk.org/ItkSoftwareGuide.pdf
Hope this helps.
Regards, Dan
2008/11/20 hubaoping <hubaoping at 126.com>:
>
>
> Hello
> A mesh has the cell type is TriangleCell,I want to draw the mesh with
> opengl.I can access to points and the cells of the mesh,but how can I get
> the points of the cell? Cells can also use the "GetPoints()"method?
> Every triangle has three points,do the three points saved in a array? If
> the three points of a cells saved in a array,how can I access to it?
> Thank you!
>
>
>
> ________________________________
> 网易邮箱10周年,技术见证辉煌
>
> ________________________________
> 网易邮箱10周年,技术见证辉煌
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list