Merge branch 'Aos_2-fixes-efif-old' into Aos_2-fixes-efif

This commit is contained in:
Efi Fogel 2018-08-01 10:13:29 +03:00
commit a9e37b6ac6
41 changed files with 984 additions and 314 deletions

View File

@ -103,7 +103,7 @@ public:
}
/*! Construct copy */
Arr_counting_traits_2(Arr_counting_traits_2& other) : Base(other)
Arr_counting_traits_2(const Arr_counting_traits_2& other) : Base(other)
{
clear_counters();
increment();

View File

@ -18,7 +18,7 @@
// $Date$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>s
// Author(s): Ron Wein <wein@post.tau.ac.il>s
// Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <eric@mpi-inf.mpg.de>
// (based on old version by Iddo Hanniel
@ -27,6 +27,7 @@
// Efi Fogel
// Ron Wein
// Idit Haran)
#ifndef CGAL_ARR_TRAITS_ADAPTOR_2_H
#define CGAL_ARR_TRAITS_ADAPTOR_2_H
@ -73,6 +74,12 @@ public:
Right_side_category;
protected:
// All sides
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Are_all_sides_oblivious_category;
// left-right dispatch
typedef CGAL::internal::Arr_left_right_implementation_dispatch<
@ -2270,10 +2277,10 @@ class Arr_traits_adaptor_2 :
public Arr_traits_basic_adaptor_2<ArrangementTraits_>
{
public:
// Traits-class geometric types.
typedef ArrangementTraits_ Base_traits_2;
typedef Arr_traits_basic_adaptor_2<ArrangementTraits_> Base;
typedef Arr_traits_basic_adaptor_2<Base_traits_2> Base;
typedef Arr_traits_adaptor_2<Base_traits_2> Self;
typedef typename Base_traits_2::Curve_2 Curve_2;
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
@ -2289,6 +2296,9 @@ public:
typedef typename Base::Top_side_category Top_side_category;
typedef typename Base::Right_side_category Right_side_category;
typedef typename Base::Are_all_sides_oblivious_category
Are_all_sides_oblivious_category;
/// \name Construction.
//@{
/*! Default constructor. */
@ -2300,7 +2310,7 @@ public:
// Inherited functors:
typedef typename Base::Compare_x_2 Compare_x_2;
typedef typename Base::Compare_xy_2 Compare_xy_2;
// typedef typename Base::Compare_xy_2 Compare_xy_2;
typedef typename Base::Construct_min_vertex_2 Construct_min_vertex_2;
typedef typename Base::Construct_max_vertex_2 Construct_max_vertex_2;
typedef typename Base::Is_vertical_2 Is_vertical_2;
@ -2317,6 +2327,385 @@ public:
/// \name Overriden functors.
//@{
/*! A functor that compares two points or two x-monotone curves
* lexigoraphically. Twp points are compared firest by their x-coordinates,
* then by their y-coordinates. Two curves are compared first their left-most
* endpoint, then by the graphs, and finally by their right-most endpoint.
*/
class Compare_xy_2 {
public:
/*! Compare two points lexigoraphically: by x, then by y.
* \param p1 the first point.
* \param p2 the second point.
* \return SMALLER - x(p1) < x(p2);
* SMALLER - x(p1) = x(p2) and y(p1) < y(p2);
* EQUAL - x(p1) = x(p2) and y(p1) = y(p2);
* LARGER - x(p1) = x(p2) and y(p1) > y(p2);
* LARGER - x(p1) > x(p2).
* \pre p1 does not lie on the boundary.
* \pre p2 does not lie on the boundary.
*/
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{
Base base(m_self);
return base.compare_xy_2_object()(p1, p2);
}
/*! Compare two x-monotone curves lexigoraphically.
* Input: C1, C2, intersections = empty
* compare(C1, C2, intersections)
* Compare the left-most points of C1 and C2.
* If not equal return the comparison result.
* Otherwise (the left-most points are equal)
* Compare C1 and C2 to the right of the point.
* If not equal return the comparison result.
* Otherwise (they overlap)
* If intersection is empty, compute the intersections,
* Remove the first overlapping section from c1, c2, and intersections.
* If intersections is empty
* Compare the right-most point and return the result.
* return compare(C1, C2, intersections).
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2) const
{
std::list<CGAL::Object> intersections;
return operator()(c1, c2, intersections,
Are_all_sides_oblivious_category());
}
protected:
//! The base traits.
const Self& m_self;
/*! Constructor.
* \param trait The base traits class. It must be passed, to handle non
* stateless traits objects, (which stores data).
* The constructor is declared private to allow only the functor
* obtaining function, which is a member of the nesting class,
* constructing it.
*/
Compare_xy_2(const Self& self) : m_self(self) {}
//! Allow its functor obtaining function calling the private constructor.
friend class Arr_traits_adaptor_2<Base_traits_2>;
/*! Compare the max end of two x-monotone curves lexigoraphically.
*/
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
Arr_all_sides_oblivious_tag tag) const
{
typedef typename Self::Construct_max_vertex_2 Construct_max_vertex_2;
Construct_max_vertex_2 ctr_max =
m_self.construct_max_vertex_2_object();
const Point_2& p1 = ctr_max(c1);
const Point_2& p2 = ctr_max(c2);
return operator()(p1, p2);
}
/*! Compare the max (right) end of two x-monotone curves lexigoraphically.
* \pre the curve overlap
*/
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
Arr_not_all_sides_oblivious_tag tag) const
{
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
Arr_parameter_space px1 = psx(c1, ARR_MAX_END);
Arr_parameter_space py1 = psy(c1, ARR_MAX_END);
Arr_parameter_space px2 = psx(c2, ARR_MAX_END);
Arr_parameter_space py2 = psy(c2, ARR_MAX_END);
// Handle the trivial cases:
if ((px1 == ARR_LEFT_BOUNDARY) && (px2 != ARR_LEFT_BOUNDARY))
return SMALLER;
if ((px2 == ARR_LEFT_BOUNDARY) && (px1 != ARR_LEFT_BOUNDARY))
return LARGER;
if ((px1 == ARR_RIGHT_BOUNDARY) && (px2 != ARR_RIGHT_BOUNDARY))
return LARGER;
if ((px2 == ARR_RIGHT_BOUNDARY) && (px1 != ARR_RIGHT_BOUNDARY))
return SMALLER;
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
if (px1 == ARR_INTERIOR) {
CGAL_assertion(px2 == ARR_INTERIOR);
if ((py1 == ARR_INTERIOR) && (py2 == ARR_INTERIOR))
return compare_max_end(c1, c2, Arr_all_sides_oblivious_tag());
// px1, px2, py1 are interior
if (py1 == ARR_INTERIOR) {
CGAL_assertion(py2 != ARR_INTERIOR);
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
Comparison_result res = cmp_x_on_bnd(c1_max, c2, ARR_MAX_END);
if (res != EQUAL) return res;
return (py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
}
// px1, px2, py2 are interior
if (py2 == ARR_INTERIOR) {
CGAL_assertion(py1 != ARR_INTERIOR);
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
Comparison_result res = cmp_x_on_bnd(c2_max, c1, ARR_MAX_END);
if (res != EQUAL) return CGAL::opposite(res);
return (py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
}
// Both py1 and py2 not interior
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
Comparison_result res = cmp_x_on_bnd(c1, ARR_MAX_END, c2, ARR_MAX_END);
if (res != EQUAL) return res;
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
return LARGER;
return EQUAL;
}
// Both endpoints lie either on the left boundary or on the right
// boundary, which means that their x-coordinates are equal.
// Handle the trivial cases:
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
return LARGER;
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_max, c2_max);
return res;
}
/*! Compare two x-monotone curves lexigoraphically.
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
std::list<CGAL::Object>& intersections,
Arr_all_sides_oblivious_tag tag) const
{
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = operator()(c1_min, c2_min);
if (res != EQUAL) return res;
// Left-most points are equal.
// Compare their slopes to their right:
typedef typename Self::Compare_y_at_x_right_2 Compare_y_at_x_right_2;
Compare_y_at_x_right_2 cmp_y_at_x_right =
m_self.compare_y_at_x_right_2_object();
res = cmp_y_at_x_right(c1, c2, c1_min);
if (res != EQUAL) return res;
// Right-most sections are equal.
// Advance to the next respective sections:
if (intersections.empty()) {
typedef typename Self::Intersect_2 Intersect_2;
Intersect_2 intersect = m_self.intersect_2_object();
intersect(c1, c2, std::back_inserter(intersections));
}
// Verify the first intersection is an overlap, remove it, and
// recursively call.
CGAL::Object first = intersections.front();
X_monotone_curve_2 xcv;
if (!assign(xcv, first)) {
CGAL_error_msg("The first intersection is not an overlap!");
return SMALLER;
}
intersections.pop_front();
if (intersections.empty())
return compare_max_end(c1, c2, Are_all_sides_oblivious_category());
// Otherwise, split and continue.
typedef typename Self::Split_2 Split_2;
Split_2 split = m_self.split_2_object();
X_monotone_curve_2 c11, c12, c21, c22;
Construct_max_vertex_2 ctr_max =
m_self.construct_max_vertex_2_object();
const Point_2& p1 = ctr_max(xcv);
const Point_2& p2 = ctr_max(xcv);
split(c1, p1, c11, c12);
split(c2, p2, c21, c22);
return operator()(c12, c22, intersections, tag);
}
/*!
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
std::list<CGAL::Object>& intersections,
Arr_not_all_sides_oblivious_tag) const
{
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
Arr_parameter_space min_px1 = psx(c1, ARR_MIN_END);
Arr_parameter_space min_py1 = psy(c1, ARR_MIN_END);
Arr_parameter_space min_px2 = psx(c2, ARR_MIN_END);
Arr_parameter_space min_py2 = psy(c2, ARR_MIN_END);
// Handle the trivial cases:
if ((min_px1 == ARR_LEFT_BOUNDARY) && (min_px2 != ARR_LEFT_BOUNDARY))
return SMALLER;
if ((min_px2 == ARR_LEFT_BOUNDARY) && (min_px1 != ARR_LEFT_BOUNDARY))
return LARGER;
if ((min_px1 == ARR_RIGHT_BOUNDARY) && (min_px2 != ARR_RIGHT_BOUNDARY))
return LARGER;
if ((min_px2 == ARR_RIGHT_BOUNDARY) && (min_px1 != ARR_RIGHT_BOUNDARY))
return SMALLER;
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
if (min_px1 == ARR_INTERIOR) {
CGAL_assertion(min_px2 == ARR_INTERIOR);
if ((min_py1 == ARR_INTERIOR) && (min_py2 == ARR_INTERIOR)) {
return operator()(c1, c2, intersections,
Arr_all_sides_oblivious_tag());
}
//
if (min_py1 == ARR_INTERIOR) {
CGAL_assertion(min_py2 != ARR_INTERIOR);
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
Comparison_result res = cmp_x_on_bnd(c1_min, c2, ARR_MIN_END);
if (res != EQUAL) return res;
return (min_py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
}
if (min_py2 == ARR_INTERIOR) {
CGAL_assertion(min_py1 != ARR_INTERIOR);
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_x_on_bnd(c2_min, c1, ARR_MIN_END);
if (res != EQUAL) return CGAL::opposite(res);
return (min_py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
}
// Both min_py1 and min_py2 not interior
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
Comparison_result res = cmp_x_on_bnd(c1, ARR_MIN_END, c2, ARR_MIN_END);
if (res != EQUAL) return res;
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 == ARR_TOP_BOUNDARY))
return SMALLER;
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 == ARR_BOTTOM_BOUNDARY))
return LARGER;
// Left-most points are equal.
// Compare their slopes to their right:
//! \todo
}
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 != ARR_TOP_BOUNDARY))
return LARGER;
// \todo what if open?
if (min_px1 == ARR_LEFT_BOUNDARY) {
// The min points of the two curves lie on the left boundary.
CGAL_assertion(min_px2 == ARR_LEFT_BOUNDARY);
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
if (res != EQUAL) return res;
typedef typename Self::Is_vertical_2 Is_vertical_2;
Is_vertical_2 is_vert = m_self.is_vertical_2_object();
bool vert1 = is_vert(c1);
bool vert2 = is_vert(c2);
if (vert1 && ! vert2) return SMALLER;
if (vert2 && ! vert1) return LARGER;
if (vert1 && vert2) {
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
res = cmp_y_on_bnd(c1_max, c2_max);
if (res == SMALLER) return SMALLER;
}
// Compare slightly to the right near the boundary.
typedef typename Self::Compare_y_near_boundary_2
Compare_y_near_boundary_2;
Compare_y_near_boundary_2 cmp_y_near_bnd =
m_self.compare_y_near_boundary_2_object();
res = cmp_y_near_bnd(c1, c2, CGAL::ARR_MIN_END);
if (res == SMALLER) return SMALLER;
//! \todo
}
// \todo what if open
if (min_px1 == ARR_RIGHT_BOUNDARY) {
// The min points of the two curves lie on the right boundary.
// It implies that the entire curves lie on the right boundary, and
// thus both are vertical.
CGAL_assertion(min_px2 == ARR_RIGHT_BOUNDARY);
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
if (res != EQUAL) return res;
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
res = cmp_y_on_bnd(c1_max, c2_max);
if (res == SMALLER) return SMALLER;
//! \todo
}
return EQUAL;
}
};
/*! Obtain a Compare_xy_2 function object */
Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); }
/*! A functor that tests whether two x-monotone curves can be merged. */
class Are_mergeable_2 {
public:

View File

@ -270,10 +270,9 @@ bool Construction_test<T_Geom_traits, T_Topol_traits>::are_same_results()
typename Xcurve_container::iterator xcit = curves_res.begin();
Edge_const_iterator eit;
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit) {
if (is_interior(eit->source()) && is_interior(eit->target()))
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit)
*xcit++ = eit->curve();
}
Curve_compare<Geom_traits> curve_compare(m_geom_traits);
std::sort(curves_res.begin(), xcit, curve_compare);

View File

@ -6,17 +6,20 @@
#include "Traits_base_test.h"
template <typename Geom_traits_T>
template <typename GeomTraits, typename BaseGeomTraits>
class Traits_adaptor_test :
public Traits_base_test<typename Geom_traits_T::Base>
public Traits_base_test<BaseGeomTraits>
{
public:
typedef Geom_traits_T Geom_traits;
typedef Traits_base_test<typename Geom_traits::Base> Base;
typedef GeomTraits Geom_traits;
typedef BaseGeomTraits Base_geom_traits;
typedef Traits_base_test<Base_geom_traits> Base;
private:
typedef Traits_adaptor_test<Geom_traits, Base_geom_traits> Self;
/*! A map between (strings) commands and (member functions) operations */
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream &);
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream&);
typedef std::map<std::string, Wrapper> Wrapper_map;
typedef typename Wrapper_map::iterator Wrapper_iter;
Wrapper_map m_wrappers;
@ -34,6 +37,8 @@ private:
}
//@{
bool ta_compare_xy(std::istringstream&);
bool ta_compare_xy_imp(std::istringstream&);
bool ta_compare_y_at_x_left_wrapper(std::istringstream&);
bool ta_compare_y_at_x_left_wrapper_imp(std::istringstream&,
@ -61,67 +66,78 @@ protected:
const Geom_traits& m_geom_traits;
public:
/*! Constructor */
/*! Construct.
*/
Traits_adaptor_test(const Geom_traits& geom_traits);
/*! Destructor */
/*! Destruct.
*/
virtual ~Traits_adaptor_test();
};
/*!
* Constructor.
/*! Construct.
* Accepts test data file name.
*/
template <typename Geom_traits_T>
Traits_adaptor_test<Geom_traits_T>::
Traits_adaptor_test(const Geom_traits_T& geom_traits) :
template <typename GeomTraits, typename BaseGeomTraits>
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
Traits_adaptor_test(const GeomTraits& geom_traits) :
Base(geom_traits),
m_geom_traits(geom_traits)
{
typedef Geom_traits_T Geom_traits;
m_wrappers[std::string("compare_xy")] = &Self::ta_compare_xy;
m_wrappers[std::string("compare_y_at_x_left")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_y_at_x_left_wrapper;
m_wrappers[std::string("is_in_x_range")] =
&Traits_adaptor_test<Geom_traits>::ta_is_in_x_range_wrapper;
&Self::ta_compare_y_at_x_left_wrapper;
m_wrappers[std::string("is_in_x_range")] = &Self::ta_is_in_x_range_wrapper;
m_wrappers[std::string("compare_y_position")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_y_position_wrapper;
m_wrappers[std::string("is_between_cw")] =
&Traits_adaptor_test<Geom_traits>::ta_is_between_cw_wrapper;
&Self::ta_compare_y_position_wrapper;
m_wrappers[std::string("is_between_cw")] = &Self::ta_is_between_cw_wrapper;
m_wrappers[std::string("compare_cw_around_point")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_cw_around_point_wrapper;
m_wrappers[std::string("are_mergeable")] =
&Traits_adaptor_test<Geom_traits>::ta_are_mergeable_wrapper;
m_wrappers[std::string("merge")] =
&Traits_adaptor_test<Geom_traits>::ta_merge_wrapper;
&Self::ta_compare_cw_around_point_wrapper;
m_wrappers[std::string("are_mergeable")] = &Self::ta_are_mergeable_wrapper;
m_wrappers[std::string("merge")] = &Self::ta_merge_wrapper;
}
/*!
* Destructor.
/*! Destruct.
* Declares as virtual.
*/
template <typename Geom_traits_T>
Traits_adaptor_test<Geom_traits_T>::~Traits_adaptor_test() {}
template <typename GeomTraits, typename BaseGeomTraits>
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::~Traits_adaptor_test() {}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_xy(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_left_category Has_left_category;
unsigned int id1, id2;
str_stream >> id1 >> id2;
unsigned int exp_answer = this->get_expected_enum(str_stream);
std::cout << "Test: compare_xy( " << this->m_xcurves[id1]
<< "," << this->m_xcurves[id2] << " ) ? " << exp_answer << " ";
unsigned int real_answer =
m_geom_traits.compare_xy_2_object()(this->m_xcurves[id1] ,
this->m_xcurves[id2]);
return this->compare(exp_answer, real_answer);
}
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper(std::istringstream& str_stream)
{
typedef typename Geom_traits::Has_left_category Has_left_category;
return ta_compare_y_at_x_left_wrapper_imp(str_stream, Has_left_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream& str_stream,
CGAL::Tag_true)
{
unsigned int id1, id2, id3;
@ -138,21 +154,18 @@ ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_is_in_x_range_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_is_in_x_range_wrapper(std::istringstream& str_stream)
{
unsigned int id1, id2;
char c;
str_stream >> c >> id1 >> id2;
bool exp_answer = this->get_expected_boolean(str_stream);
std::cout << "Test: is_in_x_range( " << this->m_xcurves[id1] << ",";
if (c == 'p')
std::cout << this->m_points[id2];
else if (c == 'x')
std::cout << this->m_xcurves[id2];
else
CGAL_error();
if (c == 'p') std::cout << this->m_points[id2];
else if (c == 'x') std::cout << this->m_xcurves[id2];
else CGAL_error();
std::cout << " ) ? " << " ";
bool real_answer = (c == 'p') ?
@ -163,9 +176,9 @@ ta_is_in_x_range_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_position_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_position_wrapper(std::istringstream& str_stream)
{
unsigned int id1, id2;
str_stream >> id1 >> id2;
@ -179,9 +192,9 @@ ta_compare_y_position_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_is_between_cw_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_is_between_cw_wrapper(std::istringstream& str_stream)
{
unsigned int xcv , b , xcv1 , b1 , xcv2 , b2 , p;
//note that b_ref1 b_ref2 are outputs so they can be tested also
@ -205,9 +218,9 @@ ta_is_between_cw_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_cw_around_point_wrapper(std::istringstream& str_stream)
{
unsigned int xcv1 , b1 , xcv2 , b2 , p , b3;
str_stream >> xcv1 >> b1 >> xcv2 >> b2 >> p >> b3;
@ -231,25 +244,25 @@ ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
typedef typename GeomTraits::Has_merge_category Has_merge_category;
return ta_are_mergeable_wrapper_imp(str_stream, Has_merge_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
{
unsigned int id1, id2;
str_stream >> id1 >> id2;
@ -263,27 +276,26 @@ ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::ta_merge_wrapper
(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::ta_merge_wrapper
(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
typedef typename GeomTraits::Has_merge_category Has_merge_category;
return ta_merge_wrapper_imp(str_stream, Has_merge_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_merge_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_merge_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_merge_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_merge_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
{
typedef Geom_traits_T Geom_traits;
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Geom_traits::Equal_2 Equal_2;
CGAL_USE_TYPE(Equal_2);

View File

@ -479,6 +479,7 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
set(commands_indicator_PARAMETER_SPACE_X 0)
set(commands_indicator_PARAMETER_SPACE_Y 0)
set(commands_indicator_COMPARE_XY 0)
set(commands_indicator_COMPARE_X_AT_LIMIT 0)
set(commands_indicator_COMPARE_X_NEAR_LIMIT 0)
set(commands_indicator_COMPARE_X_ON_BOUNDARY 0)
@ -508,6 +509,11 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
data/test_adaptor/${data_dir}/parameter_space_y ${traits_type_name})
endif()
if(commands_indicator_COMPARE_XY)
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
data/test_adaptor/${data_dir}/compare_xy ${traits_type_name})
endif()
if(commands_indicator_COMPARE_X_AT_LIMIT)
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
@ -599,7 +605,7 @@ function(test_segment_traits_adaptor)
compile_test_with_flags(test_traits_adaptor segments "${flags}")
# if [ -n "${SUCCESS}" ] ; then
execute_commands_traits_adaptor( segments segments_traits_adaptor
COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
COMPARE_XY COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW)
endfunction()
@ -615,7 +621,7 @@ function(test_linear_traits_adaptor)
compile_test_with_flags( test_traits_adaptor linear "${flags}")
execute_commands_traits_adaptor( linear linear_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()
@ -632,7 +638,7 @@ function(test_spherical_arcs_traits_adaptor)
compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}")
execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()

View File

@ -636,6 +636,7 @@ execute_commands_traits_adaptor()
commands_indicator[PARAMETER_SPACE_X]=0
commands_indicator[PARAMETER_SPACE_Y]=0
commands_indicator[COMPARE_XY]=0
commands_indicator[COMPARE_X_AT_LIMIT]=0
commands_indicator[COMPARE_X_NEAR_LIMIT]=0
commands_indicator[COMPARE_X_ON_BOUNDARY]=0
@ -764,7 +765,7 @@ test_segment_traits_adaptor()
compile_test_with_flags test_traits_adaptor segments "$flags"
if [ -n "${SUCCESS}" ] ; then
execute_commands_traits_adaptor segments segments_traits_adaptor \
COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT \
COMAPRE_XY COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT \
ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW
else
echo " ERROR: not executed test_traits_adaptor segment_traits" >> $ERRORFILE
@ -785,7 +786,7 @@ test_linear_traits_adaptor()
compile_test_with_flags test_traits_adaptor linear "$flags"
if [ -n "${SUCCESS}" ] ; then
execute_commands_traits_adaptor linear linear_traits_adaptor \
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \
COMAPRE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT
else
echo " ERROR: not executed test_traits_adaptor linear_traits" >> $ERRORFILE
@ -807,7 +808,7 @@ test_spherical_arcs_traits_adaptor()
compile_test_with_flags test_traits_adaptor geodesic_arcs_on_sphere "$flags"
if [ -n "${SUCCESS}" ] ; then
execute_commands_traits_adaptor spherical_arcs spherical_arcs_traits_adaptor \
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \
COMAPRE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT
else
echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> $ERRORFILE

View File

@ -0,0 +1 @@
compare_xy 0 8 SMALLER

View File

@ -19,10 +19,10 @@
0 0 1
2 1 0 1 -2 0 0 1
1 -1 1 2 1 0 0 1
1 0 1 2 1 0 0 1
1 1 0 2 1 0 0 1
0 0 1 1 -2 0 0 1
1 -1 1 2 1 0 0 1
1 -1 1 0 0 1 0 1
1 0 1 2 1 0 0 1
1 0 1 0 0 1 0 1
1 1 0 2 1 0 0 1
0 0 1 1 1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -96,9 +94,8 @@ Transform {
aosIsolatedVertexStyle "disc"
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
coord DEF COORD ExactCoordinate {
ratPoint [
0 0 1
coord DEF COORD EpecCoordinate {
exactPoint [0 0 1
1 -2 0
1 -1 1
2 1 0
@ -145,7 +142,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -213,14 +217,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -13,6 +13,6 @@
0 0 1
-1 0 -1 -1 -1 0 0 1
-1 -1 0 0 0 1 0 1
0 0 1 -1 2 0 0 1
-1 2 0 -1 0 -1 0 1
0 0 1 -1 2 0 0 1
-1 1 0 0 0 1 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,8 +96,8 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
@ -136,7 +134,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -204,14 +209,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -11,6 +11,6 @@
1 -1 0
0 0 1
-1 -1 0 1 -1 0 0 1
0 0 1 -1 -1 0 0 1
-1 -2 1 1 -2 1 0 1
1 -1 0 0 0 1 0 1
0 0 1 -1 -1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,8 +96,8 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 -1 0
coord DEF COORD EpecCoordinate {
exactPoint [-1 -1 0
1 -1 0,
0 0 1,
-1 -2 1,
@ -136,7 +134,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -204,14 +209,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -10,6 +10,6 @@
1 -1 0
0 0 1
-1 -1 0 1 -1 0 0 1
1 -1 0 0 0 1 0 1
0 0 1 -1 -1 0 0 1
0 0 1 0 -1 1 0 1
1 -1 0 0 0 1 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,8 +96,8 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 -1 0
coord DEF COORD EpecCoordinate {
exactPoint [-1 -1 0
1 -1 0,
0 0 1,
0 -1 1
@ -135,7 +133,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -203,14 +208,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -14,6 +14,6 @@
0 0 1
-1 0 -1 -1 -1 0 0 1
-1 -1 0 0 0 1 0 1
0 0 1 -1 2 0 0 1
-1 2 0 -1 0 -1 0 1
0 0 1 -1 2 0 0 1
-1 1 0 -1 0 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,8 +96,8 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0 1
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
@ -137,7 +135,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -205,14 +210,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -12,8 +12,8 @@
-1 1 0
-2 1 0
0 0 1
0 1 0 -1 1 0 0 1
-1 0 -1 -2 -1 0 0 1
-2 -1 0 0 0 1 0 1
0 0 1 -2 1 0 0 1
0 1 0 -1 1 0 0 1
-2 1 0 -1 0 -1 0 1
0 0 1 -2 1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,8 +96,8 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-2 -1 0,
0 0 1,
-2 1 0,
@ -137,7 +135,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -205,14 +210,7 @@ Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -0,0 +1,13 @@
3
0 0 -1 0 -1 -1 0
0 -1 1 0 -1 -1 0
0 0 -1 0 -1 0 0
0
4 3 1
0 0 -1
0 -1 -1
0 -1 0
0 -1 1
0 0 -1 0 -1 -1 0 2
0 -1 -1 0 -1 0 0 2
0 -1 1 0 -1 0 0 1

View File

@ -0,0 +1,267 @@
#VRML V2.0 utf8
Configuration {
accumulation Accumulation { enabled TRUE }
}
ColorBackground {
color 1 1 1 1
clearStencil TRUE
}
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
DEF DRAW_OPAQUE_KEY SingleKeySensor { key "o" }
DEF DRAW_HALOED_KEY SingleKeySensor { key "l" state TRUE }
DEF DRAW_SURFACE_KEY SingleKeySensor { key "b" state TRUE }
DEF EXPORT_KEY SingleKeySensor { key "O" }
DEF SNAP_KEY SingleKeySensor { key "S" }
DEF VERTEX_SHAPE_KEY SingleKeySensor {
key "v"
boolean FALSE
numberOfStates 5
intState 2 # disc
}
DEF EDGE_SHAPE_KEY SingleKeySensor {
key "e"
boolean FALSE
numberOfStates 4
intState 2 # strip
}
DEF HIDE_SINGULARITIES_KEY SingleKeySensor {
boolean FALSE
key "s"
}
DEF HIDE_DISCONTINUITY_KEY SingleKeySensor {
boolean FALSE
key "d"
}
DEF SNAP Snapshot {
image Image { }
fileFormat "jpg"
sequence FALSE
dirName "."
fileName "test07"
}
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 2 2 2
children [
Switch {
whichChoice 0
children [
DEF ARRANGMENT Group {
children [
Shape {
drawDepth FALSE
appearance Appearance {
material Material {
diffuseColor 0.5 0.5 0.5
ambientIntensity 0.7
specularColor 0.5 0.5 0.5
}
}
geometry Sphere {
slices 32
stacks 32
}
}
Shape {
appearance Appearance {
material Material {
transparency 0.0001
}
}
geometry DEF GEOM ArrangementOnSphereMarked {
drawSurface FALSE
# drawOpaque TRUE
drawHaloed TRUE
aosEdgeStyle "strip"
aosEdgeRadius 0.03
aosEdgeLineWidth 3
aosVertexStyle "disc"
aosMarkedVertexStyle "none"
aosVertexRadius 0.1
aosVertexPointSize 6
aosIsolatedVertexStyle "disc"
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD EpecCoordinate {
exactPoint [0 0 -1, 0 -1 -1,
0 -1 1, 0 -1 -1,
0 0 -1, 0 -1 0
]
}
# Pointindex [6 7]
curveIndex [0 1 2 3 4 5]
}
}
]
}
]
}
# The singularity points:
DEF SINGULARITIES_SWITCH Switch {
whichChoice 0
children [
Group {
children [
Shape {
appearance DEF BOUNDARY_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.8 0.8 0.8
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 1
radius 0.05
}
}
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
}
}
]
}
]
}
# The discontinuity arc:
DEF DISCONTINUITY_SWITCH Switch {
whichChoice 0
children [
Shape {
appearance USE BOUNDARY_APP
geometry Extrusion {
creaseAngle 2.0
beginCap TRUE
endCap TRUE
loop FALSE
crossSectionRadius 0.025
spine [
0 0 1,
-0.0980171 0 0.995185,
-0.19509 0 0.980785,
-0.290285 0 0.95694,
-0.382683 0 0.92388,
-0.471397 0 0.881921,
-0.55557 0 0.83147,
-0.634393 0 0.77301,
-0.707107 0 0.707107,
-0.77301 0 0.634393,
-0.83147 0 0.55557,
-0.881921 0 0.471397,
-0.92388 0 0.382683,
-0.95694 0 0.290285,
-0.980785 0 0.19509,
-0.995185 0 0.0980171,
-1 0 0,
-0.995185 0 -0.0980171,
-0.980785 0 -0.19509,
-0.95694 0 -0.290285,
-0.92388 0 -0.382683,
-0.881921 0 -0.471397,
-0.83147 0 -0.55557,
-0.77301 0 -0.634393,
-0.707107 0 -0.707107,
-0.634393 0 -0.77301,
-0.55557 0 -0.83147,
-0.471397 0 -0.881921,
-0.382683 0 -0.92388,
-0.290285 0 -0.95694,
-0.19509 0 -0.980785,
-0.0980171 0 -0.995185,
0 0 -1,
]
}
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {
translation 0 1.5 0
children [
Shape {
appearance USE AXES_APP
geometry Cylinder {
radius 0.1
height 3
set_is_bottom_visible FALSE
set_is_top_visible FALSE
}
}
Transform {
translation 0 1.7 0
children [
Shape {
appearance USE AXES_APP
geometry Cone {
bottomRadius 0.2
height 0.4
}
}
]
}
]
}
Transform {
rotation 0 0 -1 1.57
children [ USE CS_AXIS ]
}
Transform {
rotation 1 0 0 1.57
children [ USE CS_AXIS ]
}
]
}
# Transform {
# translation 2 0 0
# children [
# USE ARRANGMENT
# ]
# }
]
}
ROUTE DRAW_OPAQUE_KEY.state TO GEOM.drawOpaque
ROUTE DRAW_HALOED_KEY.state TO GEOM.drawHaloed
ROUTE SNAP_KEY.state TO SNAP.trigger
# ROUTE EXPORT_KEY.press TO GEOM.export
ROUTE HIDE_DISCONTINUITY_KEY.intState TO DISCONTINUITY_SWITCH.whichChoice
ROUTE HIDE_SINGULARITIES_KEY.intState TO SINGULARITIES_SWITCH.whichChoice
ROUTE VERTEX_SHAPE_KEY.intState TO GEOM.aosVertexStyleId
ROUTE EDGE_SHAPE_KEY.intState TO GEOM.aosEdgeStyleId

View File

@ -8,7 +8,7 @@ r 0 0 0 1
3
0 0
0 1
s 0 0 0 1 1
r 0 0 1 0 1
s 0 0 0 1 1
r 0 1 1 1 1
r 0 1 0 2 1

View File

@ -5,3 +5,4 @@
./data/test_construction/geodesic_arcs_on_sphere/test05.txt
./data/test_construction/geodesic_arcs_on_sphere/test06.txt
./data/test_construction/geodesic_arcs_on_sphere/test07.txt
./data/test_construction/geodesic_arcs_on_sphere/test08.txt

View File

@ -11,7 +11,7 @@
int main (int argc, char * argv[])
{
Geom_traits traits;
Traits_adaptor_test<Geom_traits> test(traits);
Traits_adaptor_test<Geom_traits, Base_geom_traits> test(traits);
if (!test.parse(argc, argv)) return -1;
if (!test.init()) return -1;
if (!test.perform()) return -1;

View File

@ -5,7 +5,7 @@
#include "test_geom_traits.h"
typedef CGAL::Arr_traits_basic_adaptor_2<Base_geom_traits> Geom_traits;
typedef CGAL::Arr_traits_adaptor_2<Base_geom_traits> Geom_traits;
typedef Geom_traits::Point_2 Point_2;
typedef Geom_traits::Curve_2 Curve_2;
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve_2;

View File

@ -3,6 +3,7 @@
#include <CGAL/enum.h>
#include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/disable_warnings.h>
@ -103,32 +104,25 @@ private:
}
};
template <typename T_Geom_traits>
template <typename GeomTraits>
class Curve_compare {
private:
typedef T_Geom_traits Traits;
typedef GeomTraits Geom_traits;
const Traits& m_traits;
const Geom_traits& m_traits;
public:
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Traits::Point_2 Point_2;
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
Curve_compare(const Traits& traits) : m_traits(traits) {}
Curve_compare(const Geom_traits& traits) : m_traits(traits) {}
bool operator()(const X_monotone_curve_2& c1, const X_monotone_curve_2& c2)
{
const Point_2& c1_left = m_traits.construct_min_vertex_2_object()(c1);
const Point_2& c2_left = m_traits.construct_min_vertex_2_object()(c2);
CGAL::Comparison_result res =
m_traits.compare_xy_2_object()(c1_left, c2_left);
if (res == CGAL::SMALLER) return true;
if (res == CGAL::LARGER) return false;
CGAL_assertion(res == CGAL::EQUAL);
res = m_traits.compare_y_at_x_right_2_object()(c1, c2, c1_left);
return (res == CGAL::SMALLER) ? true : false;
typedef CGAL::Arr_traits_adaptor_2<Geom_traits> Geom_traits_adaptor;
Geom_traits_adaptor geom_traits_adapter(m_traits);
typedef typename Geom_traits_adaptor::Compare_xy_2 Compare_xy_2;
Compare_xy_2 cmp_xy = geom_traits_adapter.compare_xy_2_object();
return (CGAL::SMALLER == cmp_xy(c1, c2));
}
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -935,6 +935,10 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv,
CGAL_SS_PRINT_CURVE(overlap_sc);
CGAL_SS_PRINT_EOL();
// add the overlapping curve of the right of the left end
_add_curve_to_right(left_event, overlap_sc);
right_event->add_curve_to_left(overlap_sc);
// Remove curves from the left curves of the right end
// and add them on the right otherwise
if (c1->is_end_point(right_event))
@ -947,10 +951,6 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv,
else
_add_curve_to_right(right_event, c2);
// add the overlapping curve of the right of the left end
_add_curve_to_right(left_event, overlap_sc);
right_event->add_curve_to_left(overlap_sc);
this->m_visitor->found_overlap(c1, c2, overlap_sc);
if (!c1->is_end_point(right_event) && !c2->is_end_point(right_event))