Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

MESH scene graph API

Introduction

The MESH scene graph is the re-ordered version of the X3D scene graph. Indeed it arranges topology informations in a more usable form. The MESH scene graph is based on winged-edge nodes.

Moreover the scene graph is templated by the datas stored per vertex, edge, face and mesh, ensuring a fully customizable structure. We present here the form of a classical MESH scene graph and the interface of the different entities of a Mesh node.

An example of MESH scene graph

X3DandMESHSceneGraph.jpg

fig 1: on the left, a typical X3D scene graph, on the right the translation into the MESH scene graph.

The translation of an X3D scene graph into a MESH scene graph conserves the global structure, but some differences are introduced. the X3DTK::X3D::IndexedFaceSet node is replaced by a template winged-edge node, X3DTK::MESH::Mesh<MData, VData, EData, FData, readOnly>, X3DTK::X3D::Coordinate is replaced by another template node: X3DTK::MESH::Vertex<>. The list of node attributes like X3DTK::X3D::Normal is removed, the information is placed into the template nodes.

Concerning the X3DTK::X3D::Appearance, the X3D sub-graph is cloned without translating it into a MESH node.

Notice that there is a difference between the X3DTK::X3D::Coordinate node and the X3DTK::MESH::Vertex<>. The former stores coordinates, the latter stores vertices. Indeed same 3D coordinates can lead to several vertices.

Base entities of X3DTK::MESH::Mesh

The winged-edge structure is based on interdependant entities: vertex, edge and face. These entities are templated by datas that can be chosen by the user. Nevertheless each entity contains topological links with the neighboor entities.

Access

You can access the vertex type:
 // Default vertex (with default template datas)
 X3DTK::MESH::DefSFVertex *v;
 // User datas vertex
 X3DTK::MESH::SFVertex<MyMeshData, MyVertexData, MyEdgeData, MyFaceData, true> *u;

Template datas are explained later.

Topological part

Letīs see what kind of topological requests can be made. Here is an example of mesh:
faces_topology.gif
A face is made up of oriented edges which are defined by a from vertex and a to vertex. Here, the face f contains the edge e (counter-clock wise), of which from vertex is u and to vertex is v.

From a vertex:

 X3DTK::MESH::DefSFVertex *v;
 // Getting the rounding edges
 const typename X3DTK::MESH::DefSFVertex::MFEdge &me = v->getEdges();
 // Getting the rounding faces
 const typename X3DTK::MESH::DefSFVertex::MFFace &mf = v->getFaces();

From an edge:

 X3DTK::MESH::DefSFEdge *e;
 // Getting the symetric edge
 X3DTK::MESH::DefSFEdge *s = e->getSymetric();
 // Getting the from vertex
 X3DTK::MESH::DefSFVertex *f = e->getFromVertex();
 // Getting the to vertex
 X3DTK::MESH::DefSFVertex *t = e->getToVertex();
 // Getting the right faces
 const typename X3DTK::MESH::DefSFEdge::MFFace &mf = e->getRightFaces();
 // Getting all the faces
 typename X3DTK::MESH::DefSFEdge::MFFace af = e->getFaces();

From a face:

 X3DTK::MESH::DefSFFace *f;
 // Getting the edges of the face
 const typename X3DTK::MESH::DefSFFace::MFEdge &me = e->getEdges();

Template datas

The MESH scene graph offers a special and innovative use of template datas per entity. Thus in our case, the template parameters represent datas stored per vertex, per edge or per face. special framework based on atomic data aggregation by type list developed .

Letīs take the example of vertex. A standard X3D file defines at most, a coordinate, a normal, a color and a texture coordinate per vertex. However you are a user of the library and you need to code an algorithm that only requires coordinates and normals. Colors and texture coordinates are useless and take overload memory. You want that vertices only store coordinate and normal information. The MESH scene graph is customizable and allows you to choose which information are stored per entity. Furthermore you can also define your own information per vertex, by adding a weight property for instance.


Generated on Wed Apr 7 12:15:26 2004 for X3DToolKit by doxygen 1.3.3