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::ConstFaceVertexIter ConstFaceVertexIter
Circulator.
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Kernel::Point Point
Coordinate type.
Kernel::Scalar Scalar
Scalar type.