mirror of https://github.com/CGAL/cgal
Use Power_side_of_bounded_power_sphere instead of Side_of_bounded_orthogonal_sphere
both functors made the same computation, up the sign of the result. The return type now is CGAL::Bounded_side, which makes things easier to understand and use
This commit is contained in:
parent
2b66bb75e9
commit
6af2db1b91
|
|
@ -383,9 +383,9 @@ public:
|
|||
typedef typename K::Weighted_point_3 Weighted_point_3;
|
||||
typedef typename K::Sign Sign;
|
||||
|
||||
typedef Sign result_type;
|
||||
typedef Bounded_side result_type;
|
||||
|
||||
Sign operator() ( const Weighted_point_3 & p,
|
||||
Bounded_side operator() (const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r,
|
||||
const Weighted_point_3 & s,
|
||||
|
|
@ -399,10 +399,10 @@ public:
|
|||
CGAL_assertion( o != COPLANAR);
|
||||
// the minus sign below is due to the fact that power_test_3
|
||||
// return in fact minus the 5x5 determinant of lifted (p,q,r,s.t)
|
||||
return - o * os;
|
||||
return enum_cast<Bounded_side>(o * os);
|
||||
}
|
||||
|
||||
Sign operator() ( const Weighted_point_3 & p,
|
||||
Bounded_side operator() (const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r,
|
||||
const Weighted_point_3 & s) const
|
||||
|
|
@ -414,7 +414,7 @@ public:
|
|||
s.x(), s.y(), s.z(), s.weight());
|
||||
}
|
||||
|
||||
Sign operator() ( const Weighted_point_3 & p,
|
||||
Bounded_side operator() (const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r) const
|
||||
{
|
||||
|
|
@ -424,55 +424,18 @@ public:
|
|||
r.x(), r.y(), r.z(), r.weight());
|
||||
}
|
||||
|
||||
Sign operator() ( const Weighted_point_3 & p,
|
||||
Bounded_side operator() (const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q) const
|
||||
{
|
||||
return CGAL_NTS sign( CGAL_NTS square(p.x()-q.x()) +
|
||||
return enum_cast<Bounded_side>(
|
||||
CGAL_NTS sign( CGAL_NTS square(p.x()-q.x()) +
|
||||
CGAL_NTS square(p.y()-q.y()) +
|
||||
CGAL_NTS square(p.z()-q.z()) +
|
||||
p.weight() - q.weight());
|
||||
p.weight() - q.weight()));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template < typename K >
|
||||
class Side_of_bounded_orthogonal_sphere_3
|
||||
{
|
||||
public :
|
||||
typedef typename K::Weighted_point_3 Weighted_point_3;
|
||||
typedef typename K::Power_side_of_bounded_power_sphere_3 In_sphere;
|
||||
typedef typename K::Bounded_side Bounded_side;
|
||||
|
||||
typedef Bounded_side result_type;
|
||||
|
||||
Bounded_side operator() ( const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r,
|
||||
const Weighted_point_3 & s,
|
||||
const Weighted_point_3 & t) const
|
||||
{
|
||||
return enum_cast<CGAL::Bounded_side>( - In_sphere()(p,q,r,s,t));
|
||||
}
|
||||
|
||||
Bounded_side operator() ( const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r,
|
||||
const Weighted_point_3 & s) const
|
||||
{
|
||||
return enum_cast<CGAL::Bounded_side>( - In_sphere()(p,q,r,s) );
|
||||
}
|
||||
|
||||
Bounded_side operator() ( const Weighted_point_3 & p,
|
||||
const Weighted_point_3 & q,
|
||||
const Weighted_point_3 & r) const
|
||||
{
|
||||
return enum_cast<CGAL::Bounded_side>( - In_sphere()(p,q,r) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename K >
|
||||
class Compute_weight_2
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ corresponding respectively to
|
|||
`Bounded_side operator() ( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r) ; `
|
||||
|
||||
*/
|
||||
typedef unspecified_type Side_of_bounded_orthogonal_sphere_3;
|
||||
typedef unspecified_type Power_side_of_bounded_power_sphere_3;
|
||||
|
||||
|
||||
/// @}
|
||||
|
|
@ -172,8 +172,8 @@ power_side_of_oriented_power_sphere_3_object();
|
|||
/*!
|
||||
|
||||
*/
|
||||
Side_of_bounded_orthogonal_sphere_3
|
||||
side_of_bounded_orthogonal_sphere_3_object();
|
||||
Power_side_of_bounded_power_sphere_3
|
||||
power_side_of_bounded_power_sphere_3_object();
|
||||
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1876,9 +1876,9 @@ dual(Cell_handle c) const
|
|||
is_Gabriel(Cell_handle c, int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i));
|
||||
typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
|
||||
typename Geom_traits::Power_side_of_bounded_power_sphere_3
|
||||
side_of_bounded_orthogonal_sphere =
|
||||
geom_traits().side_of_bounded_orthogonal_sphere_3_object();
|
||||
geom_traits().power_side_of_bounded_power_sphere_3_object();
|
||||
|
||||
if ((!is_infinite(c->vertex(i))) &&
|
||||
side_of_bounded_orthogonal_sphere(
|
||||
|
|
@ -1915,9 +1915,9 @@ dual(Cell_handle c) const
|
|||
is_Gabriel(Cell_handle c, int i, int j) const
|
||||
{
|
||||
CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j));
|
||||
typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
|
||||
typename Geom_traits::Power_side_of_bounded_power_sphere_3
|
||||
side_of_bounded_orthogonal_sphere =
|
||||
geom_traits().side_of_bounded_orthogonal_sphere_3_object();
|
||||
geom_traits().power_side_of_bounded_power_sphere_3_object();
|
||||
|
||||
Facet_circulator fcirc = incident_facets(c,i,j),
|
||||
fdone(fcirc);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ _test_cls_regular_euclidean_traits_3 (const Traits &)
|
|||
Compare_power_distance_3;
|
||||
typedef typename Traits::Power_side_of_bounded_power_sphere_3
|
||||
Power_side_of_bounded_power_sphere_3;
|
||||
typedef typename Traits::Side_of_bounded_orthogonal_sphere_3
|
||||
Side_of_bounded_orthogonal_sphere_3;
|
||||
typedef typename Traits::Construct_weighted_circumcenter_3
|
||||
Construct_weighted_circumcenter_3;
|
||||
typedef typename Traits::Compute_power_product_3
|
||||
|
|
@ -56,8 +54,6 @@ _test_cls_regular_euclidean_traits_3 (const Traits &)
|
|||
traits.compare_power_distance_3_object();
|
||||
Power_side_of_bounded_power_sphere_3 bounded_power_test =
|
||||
traits.power_side_of_bounded_power_sphere_3_object();
|
||||
Side_of_bounded_orthogonal_sphere_3 side_of_bounded_orthogonal_sphere =
|
||||
traits.side_of_bounded_orthogonal_sphere_3_object();
|
||||
Construct_weighted_circumcenter_3 weighted_circumcenter =
|
||||
traits.construct_weighted_circumcenter_3_object();
|
||||
Compute_power_product_3 power_product =
|
||||
|
|
@ -103,10 +99,8 @@ _test_cls_regular_euclidean_traits_3 (const Traits &)
|
|||
c = weighted_circumcenter(wp02,wp1,wp2,wp3);
|
||||
assert (compare_power_distance(c,wp02,wp3) == CGAL::EQUAL);
|
||||
|
||||
// test In_smallest_orthogonal_sphere_3
|
||||
// test Side_of_bounded_orthogonal_sphere_3
|
||||
std::cout << " test In_smallest_orthogonal_sphere_3" << std::endl;
|
||||
std::cout << " test Side_of_bounded_orthogonal_sphere_3" << std::endl;
|
||||
// test Power_side_of_bounded_power_sphere_3
|
||||
std::cout << " test Power_side_of_bounded_power_sphere_3" << std::endl;
|
||||
Bare_point q0(0.,0.,0.);
|
||||
Bare_point q1(2.,0.,0.);
|
||||
Bare_point q2(0.,2.,0.);
|
||||
|
|
@ -132,56 +126,47 @@ _test_cls_regular_euclidean_traits_3 (const Traits &)
|
|||
FT ww02 = FT(2)/FT(3);
|
||||
Weighted_point wq02(q0, ww02);
|
||||
|
||||
|
||||
assert(bounded_power_test(wq0, wq1, wq2)
|
||||
== CGAL::POSITIVE);
|
||||
assert(bounded_power_test(wq1, wq0, wq2)
|
||||
== CGAL::POSITIVE);
|
||||
assert(bounded_power_test(wq1, wq2, wq0)
|
||||
== CGAL::ZERO);
|
||||
assert(bounded_power_test(wq1, wq2, wq01)
|
||||
== CGAL::NEGATIVE);
|
||||
assert(bounded_power_test(wq2, wq1, wq01)
|
||||
== CGAL::NEGATIVE);
|
||||
assert(bounded_power_test(wq11, wq21, wq0)
|
||||
== CGAL::POSITIVE);
|
||||
assert(bounded_power_test(wq21, wq11, wq0)
|
||||
== CGAL::POSITIVE);
|
||||
assert(side_of_bounded_orthogonal_sphere(wq21, wq11, wq0)
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
|
||||
assert(bounded_power_test(wq1, wq0, wq2)
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq1, wq2, wq0)
|
||||
== CGAL::ON_BOUNDARY);
|
||||
assert(bounded_power_test(wq1, wq2, wq01)
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq2, wq1, wq01)
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq11, wq21, wq0)
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq21, wq11, wq0)
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
|
||||
assert(bounded_power_test(wq0, wq1, wq2, wq3)
|
||||
== CGAL::POSITIVE);
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq1, wq0, wq2, wq3)
|
||||
== CGAL::POSITIVE);
|
||||
assert(side_of_bounded_orthogonal_sphere(wq1, wq0, wq2, wq3)
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq1, wq2, wq3, wq0)
|
||||
== CGAL::NEGATIVE);
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq1, wq3, wq2, wq0)
|
||||
== CGAL::NEGATIVE);
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq11, wq21, wq31, wq02)
|
||||
== CGAL::ZERO);
|
||||
== CGAL::ON_BOUNDARY);
|
||||
assert(bounded_power_test(wq31, wq21, wq11, wq02)
|
||||
== CGAL::ZERO);
|
||||
== CGAL::ON_BOUNDARY);
|
||||
|
||||
|
||||
assert(bounded_power_test(wq0, wq1, wq2, wq3, wq4)
|
||||
== CGAL::ZERO);
|
||||
== CGAL::ON_BOUNDARY);
|
||||
assert(bounded_power_test(wq1, wq0, wq2, wq3, wq4)
|
||||
== CGAL::ZERO);
|
||||
== CGAL::ON_BOUNDARY);
|
||||
assert(bounded_power_test(wq01, wq11, wq21, wq31, wq4)
|
||||
== CGAL::POSITIVE);
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq01, wq21, wq11, wq31, wq4)
|
||||
== CGAL::POSITIVE);
|
||||
== CGAL::ON_UNBOUNDED_SIDE);
|
||||
assert(bounded_power_test(wq0, wq1, wq2, wq3, wq41)
|
||||
== CGAL::NEGATIVE);
|
||||
assert(bounded_power_test(wq0, wq1, wq3, wq2, wq41)
|
||||
== CGAL::NEGATIVE);
|
||||
assert(side_of_bounded_orthogonal_sphere(wq0, wq1, wq3, wq2, wq41)
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
|
||||
assert(bounded_power_test(wq0, wq1, wq3, wq2, wq41)
|
||||
== CGAL::ON_BOUNDED_SIDE);
|
||||
|
||||
// test weighted_circumcenter
|
||||
// test squared_radius_smallest_orthogonal_sphere
|
||||
|
|
|
|||
Loading…
Reference in New Issue