1 #ifndef IMPLICIT_ZONE_FUNCTION_H 
    2 #define IMPLICIT_ZONE_FUNCTION_H 
    4 #include "mesher_cgal.h" 
    6 #include <CGAL/Side_of_triangle_mesh.h> 
    7 typedef CGAL::Side_of_triangle_mesh<Polyhedron,K> Side_of_triangle_mesh;
 
    9 #include <CGAL/AABB_tree.h> 
   10 #include <CGAL/AABB_traits.h> 
   11 #include <CGAL/AABB_face_graph_triangle_primitive.h> 
   13 typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
 
   14 typedef CGAL::AABB_traits<K, Primitive> Traits;
 
   15 typedef CGAL::AABB_tree<Traits> Tree;
 
   18     typedef std::vector< std::unique_ptr<Zone> > zones_vec;
 
   24         typedef int                    return_type;
 
   25         typedef typename K::Point_3    Point_3;
 
   26         typedef typename K::FT         FT;
 
   27         typedef typename std::vector< std::pair<int, Side_of_triangle_mesh*> > pip_vector;
 
   30                 region_ip_map& region_ips,
 
   31                 const Point_3* centre,
 
   37                 std::vector<int>& vessels,
 
   38                 std::vector<int>& needles,
 
   41         ) : zones_(zones), default_zone_(default_zone), use_organ_(use_organ), organ_id_(organ_id), use_extent_(use_extent), extent_id_(extent_id)
 
   43           Polyhedron* organ = NULL;
 
   48           extent_tree_ = 
new Tree();
 
   51             organ = 
new Polyhedron(*region_ips[organ_id]);
 
   52             extent_tree_->insert(organ->facets_begin(), organ->facets_end(), *organ);
 
   53             organ_pip_= 
new Side_of_triangle_mesh(*organ);
 
   56           extent_tree_->accelerate_distance_queries();
 
   58           BOOST_FOREACH(std::vector<int>::value_type& 
id, vessels) {
 
   59               Tree* tree = 
new Tree(region_ips[
id]->facets_begin(), region_ips[
id]->facets_end(), *region_ips[
id]);
 
   60               tree->accelerate_distance_queries();
 
   61               trees_.push_back(tree);
 
   62               vessels_pip_.push_back(std::pair<int, Side_of_triangle_mesh*>(
id, 
new Side_of_triangle_mesh(*region_ips[
id])));
 
   65           BOOST_FOREACH(std::vector<int>::value_type& 
id, needles) {
 
   66               Tree* tree = 
new Tree(region_ips[
id]->facets_begin(), region_ips[
id]->facets_end(), *region_ips[
id]);
 
   67               tree->accelerate_distance_queries();
 
   68               trees_.push_back(tree);
 
   69               needles_pip_.push_back(std::pair<int, Side_of_triangle_mesh*>(
id, 
new Side_of_triangle_mesh(*region_ips[
id])));
 
   77         return_type signed_domain(
const Point_3& p, 
const bool = 
true)
 const 
   79             int zone = default_zone_;
 
   81             if (CGAL::squared_distance(*centre_, p) > radius_ * radius_)
 
   82                 return extent_id_ == 0 ? 0 : -extent_id_;
 
   84             if (organ_pip_ != NULL) {
 
   85                 if ((*organ_pip_)(p) == CGAL::ON_UNBOUNDED_SIDE)
 
   86                     return organ_id_ == 0 ? -1000 : -organ_id_; 
 
   91             BOOST_FOREACH(
const pip_vector::value_type& pip, vessels_pip_) {
 
   92                 if ((*pip.second)(p) == CGAL::ON_BOUNDED_SIDE)
 
   95             BOOST_FOREACH(
const pip_vector::value_type& pip, needles_pip_) {
 
   96                 if ((*pip.second)(p) == CGAL::ON_BOUNDED_SIDE)
 
  100             for (
auto&& z : zones_) {
 
  101                 if (z->contains(p) != 0) {
 
  104                     if (zone > 0 && default_zone_ == 0)
 
  110             if (default_zone_ == 0)
 
  116         return_type operator()(
const Point_3& p, 
const bool = 
true)
 const 
  118             return_type i = signed_domain(p);
 
  131         const Point_3* centre_;
 
  134         std::vector<Tree*> trees_;
 
  135         Side_of_triangle_mesh *extent_pip_, *organ_pip_;
 
  136         pip_vector vessels_pip_, needles_pip_;
 
Definition: implicit_zone_function.h:21
Definition: implicit_zone_function.h:17