| 113 | } |
| 114 | |
| 115 | int faceDirection( FaceToVerticesMap &faceToVerticesMap, FaceId face, Edge edge ) |
| 116 | { |
| 117 | FaceToVerticesMap::const_iterator vit = faceToVerticesMap.find( face ); |
| 118 | assert( vit != faceToVerticesMap.end() ); |
| 119 | const VertexList &faceVertices = vit->second; |
| 120 | |
| 121 | int numFaceVertices = faceVertices.size(); |
| 122 | |
| 123 | VertexList::const_iterator it = std::find( faceVertices.begin(), faceVertices.end(), edge.first ); |
| 124 | assert( it != faceVertices.end() ); |
| 125 | |
| 126 | int edgeVertexOrigin = std::distance( faceVertices.begin(), it ); |
| 127 | |
| 128 | assert( faceVertices[ index( edgeVertexOrigin, numFaceVertices )] == edge.first ); |
| 129 | |
| 130 | int direction = 0; |
| 131 | if ( faceVertices[ index( edgeVertexOrigin+1, numFaceVertices )] == edge.second ) |
| 132 | { |
| 133 | direction = 1; |
| 134 | } |
| 135 | else |
| 136 | { |
| 137 | assert( faceVertices[ index( edgeVertexOrigin-1, numFaceVertices )] == edge.second ) ; |
| 138 | direction = -1; |
| 139 | } |
| 140 | |
| 141 | assert( direction == 1 || direction == -1 ); |
| 142 | return direction; |
| 143 | } |
| 144 | |
| 145 | void visitFace( |
| 146 | const MeshPrimitive * mesh, |