closest2d.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004                                                \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
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         //**MARKER CLASSES**//
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     }    // end namespace tri
00070 }        // end namespace vcg
00071 
00072 #endif


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:29:32