Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: 3D Graphics Programming With QuickDraw 3D /
Chapter 4 - Geometric Objects / Geometric Objects Reference
Geometric Objects Routines


Traversing Mesh Components, Vertices, Faces, and Edges

QuickDraw 3D provides a large number of functions that you can use to iterate through the components, vertices, faces, or edges of a mesh. For example, you can call the Q3Mesh_FirstMeshComponent function to get the first component in a mesh; then you can call the Q3Mesh_NextMeshComponent function to get any subsequent mesh components.

For even simpler mesh traversal, QuickDraw 3D defines a large number of macros modeled on the standard C language for statement. For example, the Q3ForEachMeshComponent macro uses the Q3Mesh_FirstMeshComponent function and the Q3Mesh_NextMeshComponent function to iterate through all the components of a mesh.

IMPORTANT
Adding or deleting vertices or faces within the scope of these iterators might produce unpredictable results.
#define Q3ForEachMeshComponent(m,c,i)                    \
   for ( (c) = Q3Mesh_FirstMeshComponent((m),(i));       \
      (c);                                               \
      (c) = Q3Mesh_NextMeshComponent((i)) )
#define Q3ForEachComponentVertex(c,v,i)                  \
   for ( (v) = Q3Mesh_FirstComponentVertex((c),(i));     \
      (v);                                               \
      (v) = Q3Mesh_NextComponentVertex((i)) )
#define Q3ForEachComponentEdge(c,e,i)                    \
   for ( (e) = Q3Mesh_FirstComponentEdge((c),(i));       \
      (e);                                               \
      (e) = Q3Mesh_NextComponentEdge((i)) )
#define Q3ForEachMeshVertex(m,v,i)                       \
   for ( (v) = Q3Mesh_FirstMeshVertex((m),(i));          \
      (v);                                               \
      (v) = Q3Mesh_NextMeshVertex((i)) )
#define Q3ForEachMeshFace(m,f,i)                         \
   for ( (f) = Q3Mesh_FirstMeshFace((m),(i));            \
      (f);                                               \
      (f) = Q3Mesh_NextMeshFace((i)) )
#define Q3ForEachMeshEdge(m,e,i)                         \
   for ( (e) = Q3Mesh_FirstMeshEdge((m),(i));            \
      (e);                                               \
      (e) = Q3Mesh_NextMeshEdge((i)) )
#define Q3ForEachVertexEdge(v,e,i)                       \
   for ( (e) = Q3Mesh_FirstVertexEdge((v),(i));          \
      (e);                                               \
      (e) = Q3Mesh_NextVertexEdge((i)) )
#define Q3ForEachVertexVertex(v,n,i)                     \
   for ( (n) = Q3Mesh_FirstVertexVertex((v),(i));        \
      (n);                                               \
      (n) = Q3Mesh_NextVertexVertex((i)) )
#define Q3ForEachVertexFace(v,f,i)                       \
   for ( (f) = Q3Mesh_FirstVertexFace((v),(i));          \
      (f);                                               \
      (f) = Q3Mesh_NextVertexFace((i)) )
#define Q3ForEachFaceEdge(f,e,i)                         \
   for ( (e) = Q3Mesh_FirstFaceEdge((f),(i));            \
      (e);                                               \
      (e) = Q3Mesh_NextFaceEdge((i)) )
#define Q3ForEachFaceVertex(f,v,i)                       \
   for ( (v) = Q3Mesh_FirstFaceVertex((f),(i));          \
      (v);                                               \
      (v) = Q3Mesh_NextFaceVertex((i)) )
#define Q3ForEachFaceFace(f,n,i)                         \
   for ( (n) = Q3Mesh_FirstFaceFace((f),(i));            \
      (n);                                               \
      (n) = Q3Mesh_NextFaceFace((i)) )
#define Q3ForEachFaceContour(f,h,i)                      \
   for ( (h) = Q3Mesh_FirstFaceContour((f),(i));         \
      (h);                                               \
      (h) = Q3Mesh_NextFaceContour((i)) )
#define Q3ForEachContourEdge(h,e,i)                      \
   for ( (e) = Q3Mesh_FirstContourEdge((h),(i));         \
      (e);                                               \
      (e) = Q3Mesh_NextContourEdge((i)) )
#define Q3ForEachContourVertex(h,v,i)                    \
   for ( (v) = Q3Mesh_FirstContourVertex((h),(i));       \
      (v);                                               \
      (v) = Q3Mesh_NextContourVertex((i)) )
#define Q3ForEachContourFace(h,f,i)                      \
   for ( (f) = Q3Mesh_FirstContourFace((h),(i));         \
      (f);                                               \
      (f) = Q3Mesh_NextContourFace((i)) )

Subtopics
Q3Mesh_FirstMeshComponent
Q3Mesh_NextMeshComponent
Q3Mesh_FirstComponentVertex
Q3Mesh_NextComponentVertex
Q3Mesh_FirstComponentEdge
Q3Mesh_NextComponentEdge
Q3Mesh_FirstMeshVertex
Q3Mesh_NextMeshVertex
Q3Mesh_FirstMeshFace
Q3Mesh_NextMeshFace
Q3Mesh_FirstMeshEdge
Q3Mesh_NextMeshEdge
Q3Mesh_FirstVertexEdge
Q3Mesh_NextVertexEdge
Q3Mesh_FirstVertexVertex
Q3Mesh_NextVertexVertex
Q3Mesh_FirstVertexFace
Q3Mesh_NextVertexFace
Q3Mesh_FirstFaceEdge
Q3Mesh_NextFaceEdge
Q3Mesh_FirstFaceVertex
Q3Mesh_NextFaceVertex
Q3Mesh_FirstFaceFace
Q3Mesh_NextFaceFace
Q3Mesh_FirstFaceContour
Q3Mesh_NextFaceContour
Q3Mesh_FirstContourEdge
Q3Mesh_NextContourEdge
Q3Mesh_FirstContourVertex
Q3Mesh_NextContourVertex
Q3Mesh_FirstContourFace
Q3Mesh_NextContourFace

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help