PSS case bdiff=5 compute_pss_side_p_known

All bisector computations have been removed.

Signed-off-by: Panagiotis Cheilaris <philaris@cs.ntua.gr>
This commit is contained in:
Panagiotis Cheilaris 2014-07-15 16:04:27 +02:00
parent 451198fe19
commit 0e3f2d5e3b
3 changed files with 63 additions and 4 deletions

View File

@ -1655,6 +1655,19 @@ public:
return Point_2(c.x() + d.x(), c.y() + d.y(), RT(2));
}
inline
static
Point_2 center_from_same_side_corners(
const Point_2 & c, const Point_2 & d, const Bearing bside)
{
CGAL_precondition(bside % 2 == 1);
const FT ax = (bside % 4 == 1) ?
RT(2)*c.x() + c.y() - d.y() : c.x() + d.x();
const FT ay = (bside % 4 == 1) ?
c.y() + d.y() : RT(2)*c.y() + d.x() - c.y();
return Point_2(ax, ay, RT(2));
}
inline
static
bool points_inside_touching_sides_v(

View File

@ -93,6 +93,7 @@ public:
using Base::center_from_corner_and_pt;
using Base::points_inside_touching_sides_v;
using Base::center_from_opposite_corners;
using Base::center_from_same_side_corners;
private:
typedef SegmentDelaunayGraph_2::Are_same_points_C2<K>
@ -574,10 +575,12 @@ private:
compute_pss_nonhv_consecutive(p, q, r, lq, lr, bq, br);
} else if ((bdiff == 3) or (bdiff == 4)) {
compute_pss_ortho_wedge(p, q, r, lq, lr, bq, br);
} else if (bdiff == 5) {
compute_pss_side_p_known(p, q, r, lq, lr, bq, br);
} else if (bdiff == 6) {
compute_pss_lines_side(p, lq, lr, (br+1)%8);
} else {
compute_pss_bisectors(p, q, r);
CGAL_assertion( false );
}
CGAL_assertion( oriented_side_of_line(lq, this->point()) );
CGAL_assertion( oriented_side_of_line(lr, this->point()) );
@ -600,6 +603,28 @@ private:
uz_ = RT(2);
}
inline void
compute_pss_side_p_known(
const Site_2& p, const Site_2& q, const Site_2& r,
const Line_2& lq, const Line_2 & lr,
const Bearing bq, const Bearing br)
{
const Bearing bside = (br + ((br % 2 == 0) ? 1 : 2)) % 8;
const bool l_compute_y = (bside % 4 == 1) ? true : false;
const FT pcoord = l_compute_y ? p.point().x() : p.point().y();
const FT qcoord = coord_at(lq, pcoord, l_compute_y);
const FT rcoord = coord_at(lr, pcoord, l_compute_y);
const Point_2 qcorner =
l_compute_y ? Point_2(pcoord, qcoord) : Point_2(qcoord, pcoord);
const Point_2 rcorner =
l_compute_y ? Point_2(pcoord, rcoord) : Point_2(rcoord, pcoord);
const Point_2 v =
center_from_same_side_corners(rcorner, qcorner, bside);
ux_ = v.hx();
uy_ = v.hy();
uz_ = v.hw();
}
inline void
compute_pss_ortho_wedge(
const Site_2& p, const Site_2& q, const Site_2& r,

View File

@ -65,8 +65,9 @@ public:
using Base::bearing;
using Base::bearing_diff;
using Base::center_from_corner_and_pt;
using Base::center_from_opposite_corners;
using Base::points_inside_touching_sides_v;
using Base::center_from_opposite_corners;
using Base::center_from_same_side_corners;
typedef enum {PPP = 0, PPS, PSS, SSS} vertex_t;
struct PPP_Type {};
@ -1091,10 +1092,12 @@ private:
compute_pss_nonhv_consecutive(p, q, r, lq, lr, bq, br);
} else if ((bdiff == 3) or (bdiff == 4)) {
compute_pss_ortho_wedge(p, q, r, lq, lr, bq, br);
} if (bdiff == 6) {
} else if (bdiff == 5) {
compute_pss_side_p_known(p, q, r, lq, lr, bq, br);
} else if (bdiff == 6) {
compute_pss_lines_side(p, lq, lr, (br+1)%8);
} else {
compute_vv_bisectors(p, q, r, PSS_Type());
CGAL_assertion( false );
}
CGAL_assertion( oriented_side_of_line(lq, this->point()) );
CGAL_assertion( oriented_side_of_line(lr, this->point()) );
@ -1117,6 +1120,24 @@ private:
Point_2((qcoord+rcoord)/FT(2), pcoord + sgn*sidelen/FT(2)) ;
}
inline void
compute_pss_side_p_known(
const Site_2& p, const Site_2& q, const Site_2& r,
const Line_2& lq, const Line_2 & lr,
const Bearing bq, const Bearing br) const
{
const Bearing bside = (br + ((br % 2 == 0) ? 1 : 2)) % 8;
const bool l_compute_y = (bside % 4 == 1) ? true : false;
const FT pcoord = l_compute_y ? p.point().x() : p.point().y();
const FT qcoord = coord_at(lq, pcoord, l_compute_y);
const FT rcoord = coord_at(lr, pcoord, l_compute_y);
const Point_2 qcorner =
l_compute_y ? Point_2(pcoord, qcoord) : Point_2(qcoord, pcoord);
const Point_2 rcorner =
l_compute_y ? Point_2(pcoord, rcoord) : Point_2(rcoord, pcoord);
vv = center_from_same_side_corners(rcorner, qcorner, bside);
}
inline void
compute_pss_ortho_wedge(
const Site_2& p, const Site_2& q, const Site_2& r,