56 #ifndef OPENMESH_MESH_DUAL_H 57 #define OPENMESH_MESH_DUAL_H 63 #if defined(OM_CC_MIPS) 69 #include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh> 70 #include <OpenMesh/Core/Utils/Property.hh> 87 template <
typename MeshTraits>
88 PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &primal)
90 PolyMesh_ArrayKernelT<MeshTraits>* dual =
new PolyMesh_ArrayKernelT<MeshTraits>();
95 FPropHandleT< typename PolyMesh_ArrayKernelT<MeshTraits>::VertexHandle > primalToDual;
96 primal.add_property(primalToDual);
99 for(
typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceIter fit=primal.faces_begin(); fit!=primal.faces_end(); ++fit)
104 centerPoint += primal.point(*vit);
106 centerPoint /= degree;
107 primal.property(primalToDual, *fit) = dual->add_vertex(centerPoint);
111 std::vector< typename PolyMesh_ArrayKernelT<MeshTraits>::VertexHandle > face_vhandles;
112 for(
typename PolyMesh_ArrayKernelT<MeshTraits>::ConstVertexIter vit=primal.vertices_begin(); vit!=primal.vertices_end(); ++vit)
114 if(!primal.is_boundary(*vit))
116 face_vhandles.clear();
118 face_vhandles.push_back(primal.property(primalToDual, *fit));
119 dual->add_face(face_vhandles);
123 primal.remove_property(primalToDual);
135 #endif // OPENMESH_MESH_DUAL_H defined Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:110
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Definition: PolyMeshT.hh:176
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
Kernel::ConstFaceVertexIter ConstFaceVertexIter
Circulator.
Definition: PolyMeshT.hh:177