⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 finite_edge_interior_conflict_c2.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 2 页
字号:
		    o_l_qps != ON_ORIENTED_BOUNDARY );        if ( o_l_pqr == ON_ORIENTED_BOUNDARY ) {      return ( o_l_qps == o_l_pv );    } else {      return ( o_l_pqr == o_l_pv );    }  }  //--------------------------------------------------------------------  bool  is_interior_in_conflict_both_sp(const Site_2& p, const Site_2& q,				  const Site_2& r, const Site_2& s,				  const Site_2& t, Method_tag tag) const  {    return is_interior_in_conflict_both_ps(q, p, s, r, t, tag);  }  //------------------------------------------------------------------------  //------------------------------------------------------------------------  //------------------------------------------------------------------------  bool  is_interior_in_conflict_touch(const Site_2& p, const Site_2& q,				const Site_2& r, const Site_2& s,				const Site_2& t, Method_tag tag) const  {    // checks if interior of voronoi edge is in conflict if both extrema     // of the voronoi edge touch the corresponding circles.    // return true if interior is in conflict; false otherwise    if ( t.is_segment() ) { return false; }#if 1    CGAL_assertion( p.is_segment() || q.is_segment() );    Voronoi_vertex_2 vpqr(p, q, r);    Voronoi_vertex_2 vqps(q, p, s);    if ( vpqr.incircle_no_easy(s) == ZERO &&	 vqps.incircle_no_easy(r) == ZERO ) {      return false;    }    if ( p.is_segment() && q.is_segment() ) {      return true;    }#else    // OLD CODE: buggy if the edge is degenerate    if ( (p.is_point() && q.is_point()) ||	 (p.is_segment() && q.is_segment()) ) {       return true;    }#endif    if ( p.is_point() && q.is_segment() ) {      Line_2 lq = compute_supporting_line(q.supporting_site());          Comparison_result res =	compare_squared_distances_to_line(lq, p.point(), t.point());      return (res != SMALLER);    }    return is_interior_in_conflict_touch(q, p, s, r, t, tag);  }  //------------------------------------------------------------------------  //------------------------------------------------------------------------  //------------------------------------------------------------------------  bool  is_interior_in_conflict_none(const Site_2& p, const Site_2& q,			       const Site_2& r, const Site_2& s,			       const Site_2& t, Method_tag tag) const  {    if ( t.is_segment() ) { return false; }    bool in_conflict(false);    if ( p.is_point() && q.is_point() ) {      in_conflict = is_interior_in_conflict_none_pp(p, q, r, s, t, tag);    } else if ( p.is_point() && q.is_segment() ) {      in_conflict = is_interior_in_conflict_none_ps(p, q, r, s, t, tag);    } else if ( p.is_segment() && q.is_point() ) {      in_conflict = is_interior_in_conflict_none_sp(p, q, r, s, t, tag);    } else { // both p and q are segments      in_conflict = is_interior_in_conflict_none_ss(p, q, r, s, t, tag);    }    return in_conflict;  }  //------------------------------------------------------------------------  bool  is_interior_in_conflict_none_pp(const Site_2& p, const Site_2& q,				  const Site_2& , const Site_2& ,				  const Site_2& t, Method_tag ) const  {    CGAL_precondition( p.is_point() && q.is_point() && t.is_point() );    return false;  }  //------------------------------------------------------------------------  bool  is_interior_in_conflict_none_ps(const Site_2& sp, const Site_2& sq,				  const Site_2& r, const Site_2& s,				  const Site_2& st, Method_tag ) const  {    CGAL_precondition( sp.is_point() && sq.is_segment() && st.is_point() );    if ( same_points(sp, sq.source_site()) ||	 same_points(sp, sq.target_site()) ) {      return false;    }       Line_2 lq = compute_supporting_line(sq.supporting_site());    Voronoi_vertex_2 vpqr(sp, sq, r);    Voronoi_vertex_2 vqps(sq, sp, s);    Point_2 p = sp.point(), t = st.point();    Line_2 lperp = compute_perpendicular(lq, t);    Oriented_side op = oriented_side_of_line(lq, p);    Oriented_side ot = oriented_side_of_line(lq, t);    bool on_same_side =      ((op == ON_POSITIVE_SIDE && ot == ON_POSITIVE_SIDE) ||       (op == ON_NEGATIVE_SIDE && ot == ON_NEGATIVE_SIDE));    Comparison_result res =      compare_squared_distances_to_line(lq, t, p);    Oriented_side opqr = vpqr.oriented_side(lperp);    Oriented_side oqps = vqps.oriented_side(lperp);    bool on_different_side =      ((opqr == ON_POSITIVE_SIDE && oqps == ON_NEGATIVE_SIDE) ||       (opqr == ON_NEGATIVE_SIDE && oqps == ON_POSITIVE_SIDE));    return ( on_same_side && (res == SMALLER) && on_different_side );  }  //------------------------------------------------------------------------  bool  is_interior_in_conflict_none_sp(const Site_2& p, const Site_2& q,				  const Site_2& r, const Site_2& s,				  const Site_2& t, Method_tag tag) const  {    return is_interior_in_conflict_none_ps(q, p, s, r, t, tag);  }  //------------------------------------------------------------------------  bool  is_interior_in_conflict_none_ss(const Site_2& p, const Site_2& q,				  const Site_2& r, const Site_2& s,				  const Site_2& t, Method_tag ) const  {    CGAL_precondition( p.is_segment() && q.is_segment() && t.is_point() );    Voronoi_vertex_2 vpqr(p, q, r);    Voronoi_vertex_2 vqps(q, p, s);    Line_2 lp = compute_supporting_line(p.supporting_site());    Line_2 lq = compute_supporting_line(q.supporting_site());    // first orient lp according to its Voronoi vertices    if ( vpqr.is_degenerate_Voronoi_circle() ) {      Site_2 tpqr = Site_2::construct_site_2(vpqr.degenerate_point());      if ( same_points(tpqr, p.source_site()) ||	   same_points(tpqr, p.target_site()) ) {	if ( vqps.oriented_side(lp) != ON_POSITIVE_SIDE ) {	  lp = opposite_line(lp);	}      }    } else {      if ( vpqr.oriented_side(lp) != ON_POSITIVE_SIDE ) {	lp = opposite_line(lp);      }    }#if 0 // OLD CODE    if (  ( vpqr.is_degenerate_Voronoi_circle() &&	    same_points(vpqr.degenerate_point(), p.source_site()) ) ||	  ( vpqr.is_degenerate_Voronoi_circle() &&	    same_points(vpqr.degenerate_point(), p.target_site()) )  ) {      if ( vqps.oriented_side(lp) != ON_POSITIVE_SIDE ) {	lp = opposite_line(lp);      }    } else {      if ( vpqr.oriented_side(lp) != ON_POSITIVE_SIDE ) {	lp = opposite_line(lp);      }    }#endif    // then orient lq according to its Voronoi vertices    if ( vpqr.is_degenerate_Voronoi_circle() ) {      Site_2 tpqr = Site_2::construct_site_2(vpqr.degenerate_point());      if ( same_points(tpqr, q.source_site()) ||	   same_points(tpqr, q.target_site()) ) {	if ( vqps.oriented_side(lq) != ON_POSITIVE_SIDE ) {	  lq = opposite_line(lq);	}      }    } else {      if ( vpqr.oriented_side(lq) != ON_POSITIVE_SIDE ) {	lq = opposite_line(lq);      }    }#if 0 // OLD CODE    if (  ( vpqr.is_degenerate_Voronoi_circle() &&	    same_points(vpqr.degenerate_point(), q.source_site()) ) ||	  ( vpqr.is_degenerate_Voronoi_circle() &&	    same_points(vpqr.degenerate_point(), q.target_site()) )  ) {      if ( vqps.oriented_side(lq) != ON_POSITIVE_SIDE ) {	lq = opposite_line(lq);      }    } else {      if ( vpqr.oriented_side(lq) != ON_POSITIVE_SIDE ) {	lq = opposite_line(lq);      }    }#endif    Point_2 tp = t.point();    // check if t is on the same side as the Voronoi vertices    Oriented_side ot_lp = oriented_side_of_line(lp, tp);    Oriented_side ot_lq = oriented_side_of_line(lq, tp);    if ( ot_lp != ON_POSITIVE_SIDE || ot_lq != ON_POSITIVE_SIDE ) {      return false;    }    Line_2 lperp;    Comparison_result res =      compare_squared_distances_to_lines(tp, lp, lq);    if ( res == SMALLER ) {      lperp = compute_perpendicular(lp, tp);    } else {      lperp = compute_perpendicular(lq, tp);    }    CGAL_precondition( ot_lp != ON_ORIENTED_BOUNDARY &&		       ot_lq != ON_ORIENTED_BOUNDARY );    // check of lperp separates the two Voronoi vertices    Oriented_side opqr_perp = vpqr.oriented_side(lperp);    Oriented_side oqps_perp = vqps.oriented_side(lperp);    bool on_different_side =      (opqr_perp == ON_POSITIVE_SIDE &&       oqps_perp == ON_NEGATIVE_SIDE) ||      (opqr_perp == ON_NEGATIVE_SIDE &&        oqps_perp == ON_POSITIVE_SIDE);    return ( on_different_side );  }  //------------------------------------------------------------------------  //------------------------------------------------------------------------  //------------------------------------------------------------------------public:  typedef bool              result_type;  typedef Site_2            argument_type;  struct Arity {};  bool operator()(const Site_2& p, const Site_2& q, const Site_2& r,		  const Site_2& s, const Site_2& t, Sign sgn) const  {    if ( sgn == POSITIVE ) {      return is_interior_in_conflict_none(p, q, r, s, t, Method_tag());    } else if ( sgn == NEGATIVE ) {      return is_interior_in_conflict_both(p, q, r, s, t, Method_tag());    } else {      return is_interior_in_conflict_touch(p, q, r, s, t, Method_tag());    }  }  bool operator()(const Site_2& p, const Site_2& q, const Site_2& ,		  const Site_2& t, Sign sgn) const  {    if ( t.is_point() ) {      return ( sgn == NEGATIVE );    }    if ( sgn != NEGATIVE ) {      return false;    }    if ( p.is_segment() || q.is_segment() ) {      return false;    }    bool p_is_endpoint =      same_points(p, t.source_site()) || same_points(p, t.target_site());    bool q_is_endpoint =      same_points(q, t.source_site()) || same_points(q, t.target_site());    return ( p_is_endpoint && q_is_endpoint );  }  bool operator()(const Site_2& p, const Site_2& q, const Site_2& t,		  Sign ) const  {    if ( p.is_segment() || q.is_segment()) {      return false;    }    // both p and q are points    if ( t.is_point() ) {      RT dtpx = p.point().x() - t.point().x();      RT minus_dtpy = -p.point().y() + t.point().y();      RT dtqx = q.point().x() - t.point().x();      RT dtqy = q.point().y() - t.point().y();      Sign s1 = sign_of_determinant2x2(dtpx, minus_dtpy, dtqy, dtqx);      CGAL_assertion( s1 != ZERO );      return ( s1 == NEGATIVE );    }    bool bp =      same_points(p, t.source_site()) || same_points(p, t.target_site());    bool bq =      same_points(q, t.source_site()) || same_points(q, t.target_site());						           return ( bp && bq );  }};//-----------------------------------------------------------------------------CGAL_SEGMENT_DELAUNAY_GRAPH_2_END_NAMESPACECGAL_END_NAMESPACE#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_FINITE_EDGE_INTERIOR_CONFLICT_C2_H

⌨️ 快捷键说明

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