ag2_finite_edge_test_c2.h

来自「CGAL is a collaborative effort of severa」· C头文件 代码 · 共 621 行 · 第 1/2 页

H
621 行
字号
  typedef CGAL::Voronoi_radius<K>           Voronoi_radius;  typedef CGAL::Voronoi_circle<K>           Voronoi_circle;  typedef CGAL::Bitangent_line<K>           Bitangent_line;  typedef typename K::FT                    FT;  typedef CGAL::Bounded_side_of_CCW_circle<K>  Bounded_side_of_CCW_circle;  typedef CGAL::Sign_of_distance_from_bitangent_line<K>                                     Sign_of_distance_from_bitangent_line;  typedef CGAL::Sign_of_distance_from_CCW_circle<K>                                         Sign_of_distance_from_CCW_circle;  typedef CGAL::Order_on_finite_bisector<K>      Order_on_finite_bisector;public:  template<class Method_tag>  bool  operator()(const Site_2& p1,	     const Site_2& p2,	     const Site_2& p3,	     const Site_2& p4,	     const Site_2& q, bool b, const Method_tag& tag) const  {#ifdef AG2_PROFILE_PREDICATES      ag2_predicate_profiler::shadow_region_type_counter++;#endif    //    Weighted_point_inverter inverter(p1);    Inverted_weighted_point u2 = inverter(p2);    Inverted_weighted_point v = inverter(q);    //    Voronoi_radius vr_12q(u2, v);    Voronoi_radius vr_1q2 = vr_12q.get_symmetric();    Bounded_side bs1 = Bounded_side_of_CCW_circle()(vr_12q, tag );    Bounded_side bs2 = Bounded_side_of_CCW_circle()(vr_1q2, tag );    bool is_bs1 = (bs1 == ON_UNBOUNDED_SIDE);    bool is_bs2 = (bs2 == ON_UNBOUNDED_SIDE);    // both the ccw and cw circles do not exist    if ( !is_bs1 && !is_bs2 ) {      return b;    }    // the ccw circle exists but not the cw    if ( is_bs1 && !is_bs2 ) {      return b;    }    // the cw circle exists but not the ccw    if ( !is_bs1 && is_bs2 ) {      return b;    }    // both circles exist    // check whether the shadow region is connected, i.e., wether it is    // of the form (a, b) or (-oo, a) U (b, +oo)    Bitangent_line bl_12(p1, p2);    Sign stc =      Sign_of_distance_from_bitangent_line()(bl_12, q, tag);    CGAL_assertion( stc != ZERO );    bool is_shadow_region_connected = (stc == POSITIVE);    if ( is_shadow_region_connected ) {      if ( b ) { return true; }      Inverted_weighted_point u3 = inverter(p3);      Bitangent_line blinv_23(u2, u3);      Voronoi_circle vc_123(blinv_23);      Voronoi_circle vc_12q(vr_12q);      Comparison_result r =	Order_on_finite_bisector()(vc_123, vc_12q, p1, p2, tag);      if ( r != SMALLER ) { return false; }      Inverted_weighted_point u4 = inverter(p4);      Bitangent_line blinv_42(u4, u2);      Voronoi_circle vc_142(blinv_42);      Voronoi_circle vc_1q2(vr_1q2);      r = Order_on_finite_bisector()(vc_142, vc_1q2, p1, p2, tag);      return ( r == LARGER );    }    // the shadow region is of the form (-oo, a) U (b, +oo)    if ( !b ) { return false; }    Inverted_weighted_point u3 = inverter(p3);    Bitangent_line blinv_23(u2, u3);    Voronoi_circle vc_123(blinv_23);    Voronoi_circle vc_1q2(vr_1q2);    Comparison_result r =      Order_on_finite_bisector()(vc_123, vc_1q2, p1, p2, tag);    if ( r != SMALLER ) { return true; }    Inverted_weighted_point u4 = inverter(p4);    Bitangent_line blinv_42(u4, u2);    Voronoi_circle vc_142(blinv_42);    Voronoi_circle vc_12q(vr_12q);    r = Order_on_finite_bisector()(vc_142, vc_12q, p1, p2, tag);    return ( r != LARGER );  }};//--------------------------------------------------------------------template < class K >class Finite_edge_test_degenerated{public:  typedef typename K::Site_2                Site_2;  typedef CGAL::Weighted_point_inverter<K>  Weighted_point_inverter;  typedef CGAL::Inverted_weighted_point<K>  Inverted_weighted_point;  typedef CGAL::Voronoi_radius<K>           Voronoi_radius;  typedef CGAL::Voronoi_circle<K>           Voronoi_circle;  typedef CGAL::Bitangent_line<K>           Bitangent_line;  typedef typename K::FT                    FT;  typedef CGAL::Bounded_side_of_CCW_circle<K>  Bounded_side_of_CCW_circle;  typedef CGAL::Sign_of_distance_from_bitangent_line<K>                                     Sign_of_distance_from_bitangent_line;  typedef CGAL::Sign_of_distance_from_CCW_circle<K>                                         Sign_of_distance_from_CCW_circle;  typedef CGAL::Order_on_finite_bisector<K>      Order_on_finite_bisector;public:  template<class Method_tag>  bool  operator()(const Site_2& p1, const Site_2& p2, const Site_2& p3,	     const Site_2& q, bool b, const Method_tag& tag) const  {#ifdef AG2_PROFILE_PREDICATES    ag2_predicate_profiler::shadow_region_type_counter++;#endif    //    Weighted_point_inverter inverter(p1);    Inverted_weighted_point u2 = inverter(p2);    Inverted_weighted_point v = inverter(q);    Voronoi_radius vr_12q(u2, v);    Voronoi_radius vr_1q2 = vr_12q.get_symmetric();    Bounded_side bs1 = Bounded_side_of_CCW_circle()(vr_12q, tag );    Bounded_side bs2 = Bounded_side_of_CCW_circle()(vr_1q2, tag );    bool is_bs1 = (bs1 == ON_UNBOUNDED_SIDE);    bool is_bs2 = (bs2 == ON_UNBOUNDED_SIDE);    // both the ccw and cw circles do not exist    if ( !is_bs1 && !is_bs2 ) {      return b;    }    // the ccw circle exists but not the cw    if ( is_bs1 && !is_bs2 ) {      return b;    }    // the cw circle exists but not the ccw    if ( !is_bs1 && is_bs2 ) {      return b;    }    // both circles exist    // check whether the shadow region is connected, i.e., wether it is    // of the form (a, b) or (-oo, a) U (b, +oo)    Bitangent_line bl_12(p1, p2);    Sign stc =      Sign_of_distance_from_bitangent_line()(bl_12, q, tag);    Inverted_weighted_point u3 = inverter(p3);    Bitangent_line blinv_23(u2, u3);    CGAL_assertion( stc != ZERO );    bool is_shadow_region_connected = (stc == POSITIVE);    if ( is_shadow_region_connected ) {      // the shadow region is of the form (a, b)      if ( b ) { return false; }      Voronoi_circle vc_123(blinv_23);      Voronoi_circle vc_12q(vr_12q);      Comparison_result r =	Order_on_finite_bisector()(vc_123, vc_12q, p1, p2, tag);      return ( r == SMALLER );    }    // the shadow region is of the form (-oo, a) U (b, +oo)    if ( !b ) { return false; }    Voronoi_circle vc_123(blinv_23);    Voronoi_circle vc_1q2(vr_1q2);    Comparison_result r =      Order_on_finite_bisector()(vc_123, vc_1q2, p1, p2, tag);    return ( r != SMALLER );  }  template<class Method_tag>  bool  operator()(const Site_2& p1, const Site_2& p2,	     const Site_2& q, bool b, const Method_tag& tag) const  {#ifdef AG2_PROFILE_PREDICATES      ag2_predicate_profiler::shadow_region_type_counter++;#endif    //    Weighted_point_inverter inverter(p1);    Inverted_weighted_point u2 = inverter(p2);    Inverted_weighted_point v = inverter(q);    Voronoi_radius vr_12q(u2, v);    Voronoi_radius vr_1q2 = vr_12q.get_symmetric();    Bounded_side bs1 = Bounded_side_of_CCW_circle()(vr_12q, tag );    Bounded_side bs2 = Bounded_side_of_CCW_circle()(vr_1q2, tag );    bool is_bs1 = (bs1 == ON_UNBOUNDED_SIDE);    bool is_bs2 = (bs2 == ON_UNBOUNDED_SIDE);    // both the ccw and cw circles do not exist    if ( !is_bs1 && !is_bs2 ) {      return b;    }    // only the ccw circle exists    if ( is_bs1 && !is_bs2 ) { return false; }    // only the cw circle exists    if ( !is_bs1 && is_bs2 ) { return false; }    // both circles exist        // check whether the shadow region is connected, i.e., wether it is    // of the form (a, b) or (-oo, a) U (b, +oo)    return !b;  }};//--------------------------------------------------------------------template<class K, class MTag>class Ag2_finite_edge_test_C2{public:  typedef K                      Kernel;  typedef MTag                   Method_tag;  typedef typename K::Site_2     Site_2;private:  typedef CGAL::Finite_edge_test_degenerated<K>  Test_degenerated;  typedef CGAL::Finite_edge_test<K>              Test;public:  typedef bool                  result_type;  struct argument_type {};  struct Arity {};  inline  bool operator()(const Site_2& p1, const Site_2& p2,		  const Site_2& q, bool b) const  {    return Test_degenerated()(p1, p2, q, b, Method_tag());  }  inline  bool operator()(const Site_2& p1, const Site_2& p2,		  const Site_2& p3, const Site_2& q, bool b) const  {    return Test_degenerated()(p1, p2, p3, q, b, Method_tag());      }  inline  bool operator()(const Site_2& p1, const Site_2& p2,		  const Site_2& p3, const Site_2& p4,		  const Site_2& q, bool b) const  {    return Test()(p1, p2, p3, p4, q, b, Method_tag());      }};//--------------------------------------------------------------------CGAL_END_NAMESPACE#endif // CGAL_AG2_FINITE_EDGE_TEST_C2_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?