63 #ifndef OPENMESH_MESH_DUAL_H 64 #define OPENMESH_MESH_DUAL_H 70 #if defined(OM_CC_MIPS) 76 #include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh> 77 #include <OpenMesh/Core/Utils/Property.hh> 94 template <
typename MeshTraits>
95 PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &primal)
97 PolyMesh_ArrayKernelT<MeshTraits>* dual =
new PolyMesh_ArrayKernelT<MeshTraits>();
102 FPropHandleT< typename PolyMesh_ArrayKernelT<MeshTraits>::VertexHandle > primalToDual;
103 primal.add_property(primalToDual);
106 for(
typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceIter fit=primal.faces_begin(); fit!=primal.faces_end(); ++fit)
111 centerPoint += primal.point(*vit);
113 centerPoint /= degree;
114 primal.property(primalToDual, *fit) = dual->add_vertex(centerPoint);
118 std::vector< typename PolyMesh_ArrayKernelT<MeshTraits>::VertexHandle > face_vhandles;
119 for(
typename PolyMesh_ArrayKernelT<MeshTraits>::ConstVertexIter vit=primal.vertices_begin(); vit!=primal.vertices_end(); ++vit)
121 if(!primal.is_boundary(*vit))
123 face_vhandles.clear();
125 face_vhandles.push_back(primal.property(primalToDual, *fit));
126 dual->add_face(face_vhandles);
130 primal.remove_property(primalToDual);
142 #endif // OPENMESH_MESH_DUAL_H defined Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:113
Kernel::ConstFaceVertexIter ConstFaceVertexIter
Circulator.
Definition: PolyMeshT.hh:180
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Definition: PolyMeshT.hh:179
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:115
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64