Renamed VertexTMark into EmptyMark to reflect its nature (do nothing) and be easier to be used in other context (e.g. as a dummy marker functor for edges)
This commit is contained in:
parent
75aeed8d04
commit
13b1a8f1d9
|
|
@ -29,8 +29,11 @@
|
||||||
#include <vcg/space/point3.h>
|
#include <vcg/space/point3.h>
|
||||||
#include <vcg/space/box3.h>
|
#include <vcg/space/box3.h>
|
||||||
#include <vcg/space/point4.h>
|
#include <vcg/space/point4.h>
|
||||||
|
#include <vcg/space/index/grid_util.h>
|
||||||
|
#include <vcg/space/index/grid_closest.h>
|
||||||
#include <vcg/math/base.h>
|
#include <vcg/math/base.h>
|
||||||
#include <vcg/simplex/face/distance.h>
|
#include <vcg/simplex/face/distance.h>
|
||||||
|
#include <vcg/simplex/edge/distance.h>
|
||||||
#include <vcg/simplex/vertex/distance.h>
|
#include <vcg/simplex/vertex/distance.h>
|
||||||
#include <vcg/space/intersection3.h>
|
#include <vcg/space/intersection3.h>
|
||||||
#include <vcg/space/index/space_iterators.h>
|
#include <vcg/space/index/space_iterators.h>
|
||||||
|
|
@ -66,15 +69,27 @@ namespace vcg {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class MESH_TYPE>
|
template <class MESH_TYPE>
|
||||||
class VertTmark
|
class EdgeTmark:public Tmark<MESH_TYPE,typename MESH_TYPE::EdgeType>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EdgeTmark(){}
|
||||||
|
EdgeTmark(MESH_TYPE *m) {this->SetMesh(m);}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class MESH_TYPE>
|
||||||
|
class EmptyTMark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MESH_TYPE::VertexType VertexType;
|
typedef typename MESH_TYPE::VertexType VertexType;
|
||||||
inline VertTmark(){}
|
typedef typename MESH_TYPE::EdgeType EdgeType;
|
||||||
inline VertTmark(MESH_TYPE *){}
|
inline EmptyTMark(){}
|
||||||
|
inline EmptyTMark(MESH_TYPE *){}
|
||||||
inline void UnMarkAll() const {}
|
inline void UnMarkAll() const {}
|
||||||
inline bool IsMarked(VertexType*) const { return false; }
|
inline bool IsMarked(VertexType*) const { return false; }
|
||||||
inline void Mark(VertexType*) const {}
|
inline void Mark(VertexType*) const {}
|
||||||
|
inline bool IsMarked(EdgeType*) const { return false; }
|
||||||
|
inline void Mark(EdgeType*) const {}
|
||||||
inline void SetMesh(void * /*m=0*/) const {}
|
inline void SetMesh(void * /*m=0*/) const {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -190,7 +205,7 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
typedef typename GRID::ScalarType ScalarType;
|
typedef typename GRID::ScalarType ScalarType;
|
||||||
typedef Point3<ScalarType> Point3x;
|
typedef Point3<ScalarType> Point3x;
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
||||||
|
|
@ -206,7 +221,7 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
typedef typename GRID::ScalarType ScalarType;
|
typedef typename GRID::ScalarType ScalarType;
|
||||||
typedef Point3<ScalarType> Point3x;
|
typedef Point3<ScalarType> Point3x;
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
typedef vcg::vertex::PointScaledDistanceFunctor<typename MESH::VertexType> VDistFunct;
|
typedef vcg::vertex::PointScaledDistanceFunctor<typename MESH::VertexType> VDistFunct;
|
||||||
|
|
@ -223,7 +238,7 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
typedef typename GRID::ScalarType ScalarType;
|
typedef typename GRID::ScalarType ScalarType;
|
||||||
typedef Point3<ScalarType> Point3x;
|
typedef Point3<ScalarType> Point3x;
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
typedef vcg::vertex::PointNormalDistanceFunctor<typename MESH::VertexType> VDistFunct;
|
typedef vcg::vertex::PointNormalDistanceFunctor<typename MESH::VertexType> VDistFunct;
|
||||||
|
|
@ -266,7 +281,7 @@ namespace vcg {
|
||||||
const typename GRID::CoordType & _p, const typename GRID::ScalarType & _maxDist,
|
const typename GRID::CoordType & _p, const typename GRID::ScalarType & _maxDist,
|
||||||
OBJPTRCONTAINER & _objectPtrs,DISTCONTAINER & _distances, POINTCONTAINER & _points)
|
OBJPTRCONTAINER & _objectPtrs,DISTCONTAINER & _distances, POINTCONTAINER & _points)
|
||||||
{
|
{
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
||||||
|
|
@ -301,7 +316,7 @@ namespace vcg {
|
||||||
DISTCONTAINER & _distances,
|
DISTCONTAINER & _distances,
|
||||||
POINTCONTAINER & _points)
|
POINTCONTAINER & _points)
|
||||||
{
|
{
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
||||||
|
|
@ -327,7 +342,7 @@ namespace vcg {
|
||||||
const vcg::Box3<typename GRID::ScalarType> _bbox,
|
const vcg::Box3<typename GRID::ScalarType> _bbox,
|
||||||
OBJPTRCONTAINER & _objectPtrs)
|
OBJPTRCONTAINER & _objectPtrs)
|
||||||
{
|
{
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
MarkerVert mv;
|
MarkerVert mv;
|
||||||
mv.SetMesh(&mesh);
|
mv.SetMesh(&mesh);
|
||||||
return(gr.GetInBox/*<MarkerVert,OBJPTRCONTAINER>*/(mv,_bbox,_objectPtrs));
|
return(gr.GetInBox/*<MarkerVert,OBJPTRCONTAINER>*/(mv,_bbox,_objectPtrs));
|
||||||
|
|
@ -452,14 +467,14 @@ namespace vcg {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class GRID,class MESH>
|
template <class GRID,class MESH>
|
||||||
class ClosestVertexIterator:public vcg::ClosestIterator<GRID, vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType>, VertTmark<MESH> >
|
class ClosestVertexIterator:public vcg::ClosestIterator<GRID, vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType>, EmptyTMark<MESH> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef GRID GridType;
|
typedef GRID GridType;
|
||||||
typedef MESH MeshType;
|
typedef MESH MeshType;
|
||||||
typedef VertTmark<MESH> MarkerVert;
|
typedef EmptyTMark<MESH> MarkerVert;
|
||||||
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
typedef vcg::vertex::PointDistanceFunctor<typename MESH::ScalarType> VDistFunct;
|
||||||
typedef vcg::ClosestIterator<GRID, VDistFunct, VertTmark<MESH> > ClosestBaseType;
|
typedef vcg::ClosestIterator<GRID, VDistFunct, EmptyTMark<MESH> > ClosestBaseType;
|
||||||
VDistFunct fn;
|
VDistFunct fn;
|
||||||
ClosestVertexIterator(GridType &_Si):ClosestBaseType(_Si,fn){}
|
ClosestVertexIterator(GridType &_Si):ClosestBaseType(_Si,fn){}
|
||||||
|
|
||||||
|
|
@ -490,7 +505,7 @@ namespace vcg {
|
||||||
|
|
||||||
/// this is for meshes with 2D coordinates
|
/// this is for meshes with 2D coordinates
|
||||||
template <class MESH, class GRID>
|
template <class MESH, class GRID>
|
||||||
typename MESH::FaceType * GetClosestEdgeBase( MESH & mesh,GRID & gr,const typename GRID::CoordType & _p,
|
typename MESH::EdgeType * GetClosestEdge2DBase( MESH & mesh,GRID & gr,const typename GRID::CoordType & _p,
|
||||||
const typename GRID::ScalarType _maxDist,typename GRID::ScalarType & _minDist,
|
const typename GRID::ScalarType _maxDist,typename GRID::ScalarType & _minDist,
|
||||||
typename GRID::CoordType &_closestPt)
|
typename GRID::CoordType &_closestPt)
|
||||||
{
|
{
|
||||||
|
|
@ -503,6 +518,21 @@ namespace vcg {
|
||||||
return (gr.GetClosest(PDistFunct,mf,_p,_maxDist,_minDist,_closestPt));
|
return (gr.GetClosest(PDistFunct,mf,_p,_maxDist,_minDist,_closestPt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// this is for meshes with 3D coordinates
|
||||||
|
template <class MESH, class GRID>
|
||||||
|
typename MESH::EdgeType * GetClosestEdgeBase( MESH & mesh,GRID & gr,const typename GRID::CoordType & _p,
|
||||||
|
const typename GRID::ScalarType _maxDist,typename GRID::ScalarType & _minDist,
|
||||||
|
typename GRID::CoordType &_closestPt)
|
||||||
|
{
|
||||||
|
typedef typename GRID::ScalarType ScalarType;
|
||||||
|
typedef EmptyTMark<MESH> MarkerEdge;
|
||||||
|
MarkerEdge mf;
|
||||||
|
mf.SetMesh(&mesh);
|
||||||
|
vcg::edge::PointDistanceFunctor<ScalarType> PDistFunct;
|
||||||
|
_minDist=_maxDist;
|
||||||
|
// return (gr.GetClosest(PDistFunct,mf,_p,_maxDist,_minDist,_closestPt));
|
||||||
|
return vcg::GridClosest(gr,PDistFunct,mf, _p,_maxDist,_minDist,_closestPt);
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace tri
|
} // end namespace tri
|
||||||
} // end namespace vcg
|
} // end namespace vcg
|
||||||
|
|
|
||||||
|
|
@ -1507,7 +1507,7 @@ static bool checkPoissonDisk(SampleSHT & sht, const Point3<ScalarType> & p, Scal
|
||||||
{
|
{
|
||||||
// get the samples closest to the given one
|
// get the samples closest to the given one
|
||||||
std::vector<VertexType*> closests;
|
std::vector<VertexType*> closests;
|
||||||
typedef VertTmark<MeshType> MarkerVert;
|
typedef EmptyTMark<MeshType> MarkerVert;
|
||||||
static MarkerVert mv;
|
static MarkerVert mv;
|
||||||
|
|
||||||
Box3f bb(p-Point3f(radius,radius,radius),p+Point3f(radius,radius,radius));
|
Box3f bb(p-Point3f(radius,radius,radius),p+Point3f(radius,radius,radius));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue