Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __VCG_TRIMESH_CLOSEST_2D
00026 #define __VCG_TRIMESH_CLOSEST_2D
00027
00028 #include <math.h>
00029 #include <vcg/space/point2.h>
00030 #include <vcg/space/segment2.h>
00031 #include <vcg/space/box2.h>
00032 #include <vcg/simplex/face/distance.h>
00033
00034 namespace vcg {
00035 namespace tri {
00036
00037
00038 template <class MESH_TYPE,class OBJ_TYPE>
00039 class Tmark
00040 {
00041 MESH_TYPE *m;
00042 public:
00043 Tmark(){}
00044 Tmark( MESH_TYPE *m) {SetMesh(m);}
00045 void UnMarkAll(){ vcg::tri::UnMarkAll(*m);}
00046 bool IsMarked(OBJ_TYPE* obj){return (vcg::tri::IsMarked(*m,obj));}
00047 void Mark(OBJ_TYPE* obj){ vcg::tri::Mark(*m,obj);}
00048 void SetMesh(MESH_TYPE *_m)
00049 {
00050 m=_m;
00051 }
00052 };
00053
00054 template <class MESH, class GRID>
00055 typename MESH::FaceType * GetClosestEdgeBase( MESH & mesh,GRID & gr,const typename GRID::CoordType & _p,
00056 const typename GRID::ScalarType _maxDist,typename GRID::ScalarType & _minDist,
00057 typename GRID::CoordType &_closestPt)
00058 {
00059 typedef typename GRID::ScalarType ScalarType;
00060 typedef Point3<ScalarType> Point3x;
00061 typedef FaceTmark<MESH> MarkerFace;
00062 MarkerFace mf;
00063 mf.SetMesh(&mesh);
00064 vcg::PointSegment2DEPFunctor<ScalarType> PDistFunct;
00065 _minDist=_maxDist;
00066 return (gr.GetClosest(PDistFunct,mf,_p,_maxDist,_minDist,_closestPt));
00067 }
00068
00069 }
00070 }
00071
00072 #endif