#include #include #include #include #include #include #include #include #include #include #include // //using namespace std; // class MyFace; class MyEdge; class MyVertex : public vcg::VertexSimp2 {}; class MyEdge : public vcg::EdgeSimp2 {}; class MyEdgeMesh: public vcg::edg::EdgeMesh< std::vector, std::vector > {}; typedef vcg::GridStaticPtr EdgeMeshGrid; #define VERT_NUMB 100 int main(int , char **) { //create a random mesh of edge MyEdgeMesh em; srand(1000); em.vert.reserve(VERT_NUMB); for (int i=0;iP().X()=x0; v0->P().Y()=y0; v0->P().Z()=z0; v1->P().X()=x1; v1->P().Y()=y1; v1->P().Z()=z1; em.edges.push_back(MyEdge()); MyEdge *e=&em.edges.back(); e->V(0)=v0; e->V(1)=v1; } vcg::edg::UpdateBounding::Box(em); EdgeMeshGrid static_grid; static_grid.Set(em.edges.begin(), em.edges.end()); float dist; vcg::Point3f p; MyEdge *e=vcg::edgemesh::GetClosestEdge(em,static_grid,vcg::Point3f(500,500,500),1000,dist,p); std::vector ret; int num=vcg::edgemesh::GetInBoxEdge >(em,static_grid,em.bbox,ret); return 0; }