Skip to content

Instantly share code, notes, and snippets.

View pgbarletta's full-sized avatar

German P. Barletta pgbarletta

  • Institute for Quantitative Biomedicine (IQB)
  • Piscataway, New Jersey
  • 14:21 (UTC -04:00)
View GitHub Profile
cpp
// "called" is an object (functor) of the class "callback_for_boxes"
class callback_for_boxes {
public:
std::vector<size_t> *_id_vector_a, *_id_vector_b;
NA_Vector *_neighbors_a, *_neighbors_b;
callback_for_boxes(std::vector<size_t> &id_vector_a,
std::vector<size_t> &id_vector_b, NA_Vector &neighbors_a,
NA_Vector &neighbors_b)
// "called" is an object (functor) of the class "callback_for_boxes"
class callback_for_boxes {
public:
std::vector<size_t> *_id_vector_a, *_id_vector_b;
NA_Vector *_neighbors_a, *_neighbors_b;
callback_for_boxes(std::vector<size_t> &id_vector_a,
std::vector<size_t> &id_vector_b, NA_Vector &neighbors_a,
NA_Vector &neighbors_b)
: _id_vector_a(&id_vector_a), _id_vector_b(&id_vector_b),
// Get cells bounding boxes.
for (const auto &cell_ite : input_cells) {
const Tetrahedron tetra(
cell_ite->vertex(0)->point(), cell_ite->vertex(1)->point(),
cell_ite->vertex(2)->point(), cell_ite->vertex(3)->point());
boxes.push_back(Box(std::move(tetra.bbox()), cell_ite));
}
// Get the intersections
CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), called);
///////////////////////////////////
// Get cells bounding boxes.
for (const auto &cell_ite : input_cells) {
const Tetrahedron tetra(
cell_ite->vertex(0)->point(), cell_ite->vertex(1)->point(),
cell_ite->vertex(2)->point(), cell_ite->vertex(3)->point());
boxes.push_back(Box(std::move(tetra.bbox()), cell_ite));
}