Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Find all neighbours of a certain primitive

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Find all neighbours of a certain primitive


Chronological Thread 
  • From: Mael <>
  • To:
  • Subject: Re: [cgal-discuss] Find all neighbours of a certain primitive
  • Date: Thu, 16 May 2019 08:22:41 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:Ow1OWh+XjWD1+P9uRHKM819IXTAuvvDOBiVQ1KB31+ocTK2v8tzYMVDF4r011RmVBNyduqMP0rKI+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhViDanZb5/KBq6oRjNusQXnIBvNrs/xhzVr3VSZu9Y33loJVWdnxb94se/4ptu+DlOtvwi6sBNT7z0c7w3QrJEAjsmNXs15NDwuhnYUQSP/HocXX4InRdOHgPI8Qv1Xpb1siv9q+p9xCyXNtD4QLwoRTiv6bpgRRn1gykFKjE56nnahNFugqJVoByvpBJxzIDbb46XKPVzZbnScc8ASGdbQspcWS5MD4WhZIUPFeoBOuNYopH6qVQUsxS+ARSnCeTqyjBSmHD22bc20/4mEQHb0w0vAdYOvG7QrNrvL6gdSv66wbLHzTrdaPNW3Cny6JTSchEhr/GDR65/cdbWyUk1FwLJlEmfqYvgPz6M0OkGrmaV7+1lVe21im4nrRl8rSSgxsg2jonFnIUVykrL9Sh/3Y07JsW4RVZmbdOnE5ZcrTyWOop2T884TWxluzw2xqMItJKlZCQHzIgrywTcZvGGaYSF4AzvWPyPLTp+mXlrYqiwhwyo/kil0uD8Vte70FJNriddj9XBtmoB1xnU6sSaUPd9+12u2TeL1wzK7eFEPFw0mbDcK54/wr48jJwTvlrfHiPumUX2irGZdlk89+S16OnqYa/qqoKdOoJ0kA3zPKcjltahDek2LAQCR22b9v691L3n8035WrJKjvgun6ncqp/VO8AbqrSjAw9Sz4Yi5AiwDzO83NQch3YIN0lKdwycgojmJV7OJ/X4Aumjg1S2kDZryerJMaH9ApXKNHjCkK3tcqp6605Z0AYz18xQ54pICrEdJ/L+QlP+tNPCAR89KgC73ufnCM5h2YMDQmKPGbSUMLjSsF+N/uIgOfOAZI4TuDbnKvgq/eTijXEjmQxVQa781pQebDW0H+9tPl6CSXvqmNYIV2kQ7SQkS+m/rVSPVXYHYn+/W+Qm4SwrBYbgCY7JTI2Fj7GG2SqnBIxYb2taDUqdV3zvctPXCL83dCuOL5o5wXQ/Xr+7Rtp5jEz8hErB07Nia9Hs1GgYuJbkjoUnvrCVkBZrszl9DsDY1HyRCWZqniUOSiNkhPkj83w48U+K1O1Du9IdDcZavaobXQo9MJPA1f10AtvuXRjQONyOTQT+G4T0MXQKVts0huQ2TQN4EtSmgArE2nDzUbAYkLmGGIYl/KvXw3/rNoB2zHOUjKQ=

Hello,

Do you really care for the primitive, or just the neighboring faces? If you just want the neighboring faces, and assuming your primitive is AABB_face_graph_triangle_primitive, the primitive ID is a boost::graph_traits<Surface_mesh>::face_descriptor (i.e. Surface_mesh::Face_index) and you can use BGL-like functions provided by CGAL such as CGAL::faces_around_face:

face_descriptor fd = p_id;
for(face_descriptor neigh_fd : CGAL::faces_around_face(halfedge(fd, sm), sm) // sm is your surface mesh
{
  etc
}

See the package BGL for a lot of convenient functions (it requires a data structure to fit a certain interface, which CGAL::Surface_mesh does using the 'graph_traits' interface).

Best,
Mael

On 16/05/2019 01:57, Rash wrote:
Hi people,

I wrote a small raytracer (with CGAL::Surface_mesh<Point> Mesh) with tree acceleration in cgal. I would like to find all neighbours of a hit primitive.

Ray_intersection hit = tree.first_intersection(rays[y][x]);

if(hit)
{
    const Point& point =  boost::get<Point>(hit->first);
    const Primitive_id& primitive_id = boost::get<Primitive_id>(hit->second);
    //i need the neighbours of the hit primitive
}

How do I this? I found this documentation but it seems to work only for points not primitives:

https://doc.cgal.org/latest/Spatial_searching/index.html

And it searches for its euclidan distance not for being connected together.

Is there something like:

std::vector<Primitive_id&> ids = getNeighoursOfPrimive(primitive_id);


Like I said I am using CGAL::Surface_mesh<Point> Mesh for my mesh and their is only one mesh in the scene.

Kind regards
Rashid




Archive powered by MHonArc 2.6.18.

Top of Page