00001 // This is brl/bbas/imesh/imesh_operations.h 00002 #ifndef imesh_operations_h_ 00003 #define imesh_operations_h_ 00004 //: 00005 // \file 00006 // \brief Operations on meshes 00007 // \author Matt Leotta (mleotta@lems.brown.edu) 00008 // \date May 5, 2008 00009 // 00010 // \verbatim 00011 // Modifications 00012 // <none yet> 00013 // \endverbatim 00014 00015 00016 #include "imesh_mesh.h" 00017 #include <vcl_set.h> 00018 #include <vgl/vgl_point_3d.h> 00019 00020 //: Subdivide mesh faces into triangle 00021 vcl_auto_ptr<imesh_regular_face_array<3> > 00022 imesh_triangulate(const imesh_face_array_base& faces); 00023 00024 //: Subdivide quadrilaterals into triangle 00025 vcl_auto_ptr<imesh_regular_face_array<3> > 00026 imesh_triangulate(const imesh_regular_face_array<4>& faces); 00027 00028 00029 //: Triangulate the faces of the mesh (in place) 00030 void 00031 imesh_triangulate(imesh_mesh& mesh); 00032 00033 00034 //: Subdivide faces into quadrilaterals (in place) 00035 // Add a vertex at the center of each edge 00036 // And a vertex at the center of each face 00037 void 00038 imesh_quad_subdivide(imesh_mesh& mesh); 00039 00040 //: Subdivide faces into quadrilaterals (in place) 00041 // Add a vertex at the center of each edge 00042 // And a vertex at the center of each face 00043 // Only subdivide the selected faces 00044 void 00045 imesh_quad_subdivide(imesh_mesh& mesh, const vcl_set<unsigned int>& sel_faces); 00046 00047 00048 //: Extract a sub-mesh containing only the faces listed in sel_faces 00049 imesh_mesh 00050 imesh_submesh_from_faces(const imesh_mesh& mesh, const vcl_set<unsigned int>& sel_faces); 00051 00052 00053 //: Flip the orientation of all mesh faces 00054 void imesh_flip_faces( imesh_mesh& mesh ); 00055 00056 //: Flip the orientation of the selected faces 00057 void imesh_flip_faces( imesh_mesh& mesh, const vcl_set<unsigned int>& sel_faces); 00058 00059 00060 //: Compute the dual mesh using face centroids for vertices 00061 imesh_mesh dual_mesh(const imesh_mesh& mesh); 00062 00063 bool contains_point(const imesh_mesh& mesh,vgl_point_3d<double> p); 00064 00065 #endif // imesh_operations_h_