mirror of https://github.com/CGAL/cgal
Vertical decomposition stuff
This commit is contained in:
parent
e79706bb79
commit
c5e1e41ff7
|
|
@ -17,12 +17,11 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||||
typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||||
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||||
typedef Arrangement_2::Face_const_handle Face_const_handle;
|
typedef Arrangement_2::Face_const_handle Face_const_handle;
|
||||||
|
typedef std::pair<CGAL::Object, CGAL::Object> Object_pair;
|
||||||
typedef std::pair<Vertex_const_handle, std::pair<CGAL::Object, CGAL::Object> >
|
typedef std::pair<Vertex_const_handle, Object_pair> Vert_decomp_entry;
|
||||||
Vert_decomp_entry;
|
|
||||||
typedef std::list<Vert_decomp_entry> Vert_decomp_list;
|
typedef std::list<Vert_decomp_entry> Vert_decomp_list;
|
||||||
|
|
||||||
int main ()
|
int main()
|
||||||
{
|
{
|
||||||
// Construct the arrangement.
|
// Construct the arrangement.
|
||||||
Arrangement_2 arr;
|
Arrangement_2 arr;
|
||||||
|
|
@ -38,37 +37,35 @@ int main ()
|
||||||
|
|
||||||
// Perform vertical ray-shooting from every vertex and locate the feature
|
// Perform vertical ray-shooting from every vertex and locate the feature
|
||||||
// that lie below it and the feature that lies above it.
|
// that lie below it and the feature that lies above it.
|
||||||
Vert_decomp_list vd_list;
|
Vert_decomp_list vd_list;
|
||||||
|
CGAL::decompose(arr, std::back_inserter(vd_list));
|
||||||
CGAL::decompose (arr, std::back_inserter(vd_list));
|
|
||||||
|
|
||||||
// Print the results.
|
// Print the results.
|
||||||
Vert_decomp_list::const_iterator vd_iter;
|
Vert_decomp_list::const_iterator vd_iter;
|
||||||
std::pair<CGAL::Object, CGAL::Object> curr;
|
|
||||||
Vertex_const_handle vh;
|
|
||||||
Halfedge_const_handle hh;
|
|
||||||
Face_const_handle fh;
|
|
||||||
|
|
||||||
for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
|
for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
|
||||||
curr = vd_iter->second;
|
const Object_pair& curr = vd_iter->second;
|
||||||
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
|
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
|
||||||
|
|
||||||
|
Vertex_const_handle vh;
|
||||||
|
Halfedge_const_handle hh;
|
||||||
|
Face_const_handle fh;
|
||||||
|
|
||||||
std::cout << " feature below: ";
|
std::cout << " feature below: ";
|
||||||
if (CGAL::assign (hh, curr.first))
|
if (CGAL::assign(hh, curr.first))
|
||||||
std::cout << '[' << hh->curve() << ']';
|
std::cout << '[' << hh->curve() << ']';
|
||||||
else if (CGAL::assign (vh, curr.first))
|
else if (CGAL::assign(vh, curr.first))
|
||||||
std::cout << '(' << vh->point() << ')';
|
std::cout << '(' << vh->point() << ')';
|
||||||
else if (CGAL::assign (fh, curr.first))
|
else if (CGAL::assign(fh, curr.first))
|
||||||
std::cout << "NONE";
|
std::cout << "NONE";
|
||||||
else
|
else
|
||||||
std::cout << "EMPTY";
|
std::cout << "EMPTY";
|
||||||
|
|
||||||
std::cout << " feature above: ";
|
std::cout << " feature above: ";
|
||||||
if (CGAL::assign (hh, curr.second))
|
if (CGAL::assign(hh, curr.second))
|
||||||
std::cout << '[' << hh->curve() << ']' << std::endl;
|
std::cout << '[' << hh->curve() << ']' << std::endl;
|
||||||
else if (CGAL::assign (vh, curr.second))
|
else if (CGAL::assign(vh, curr.second))
|
||||||
std::cout << '(' << vh->point() << ')' << std::endl;
|
std::cout << '(' << vh->point() << ')' << std::endl;
|
||||||
else if (CGAL::assign (fh, curr.second))
|
else if (CGAL::assign(fh, curr.second))
|
||||||
std::cout << "NONE" << std::endl;
|
std::cout << "NONE" << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "EMPTY" << std::endl;
|
std::cout << "EMPTY" << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,6 @@ public:
|
||||||
|
|
||||||
typedef typename Points_vector::iterator Point_iterator;
|
typedef typename Points_vector::iterator Point_iterator;
|
||||||
|
|
||||||
typedef std::vector<CGAL::Object> Objects_vector;
|
|
||||||
typedef Objects_vector::iterator Object_iterator;
|
|
||||||
|
|
||||||
typedef typename boost::variant<Vertex_const_handle,
|
typedef typename boost::variant<Vertex_const_handle,
|
||||||
Halfedge_const_handle,
|
Halfedge_const_handle,
|
||||||
Face_const_handle> Cell_handle;
|
Face_const_handle> Cell_handle;
|
||||||
|
|
@ -80,11 +77,11 @@ protected:
|
||||||
|
|
||||||
/*! print the results.
|
/*! print the results.
|
||||||
*/
|
*/
|
||||||
void print_results(const std::pair<Point_2, Cell_handle>& res);
|
void print(const std::pair<Point_2, Cell_handle>& res);
|
||||||
|
|
||||||
/*! print the results.
|
/*! print the results.
|
||||||
*/
|
*/
|
||||||
void print_results(const std::pair<Point_2, CGAL::Object>& res);
|
void print(const std::pair<Point_2, CGAL::Object>& res);
|
||||||
|
|
||||||
/*! Compare the results.
|
/*! Compare the results.
|
||||||
*/
|
*/
|
||||||
|
|
@ -210,7 +207,7 @@ verify(InputIterator begin, InputIterator end)
|
||||||
typedef TopolTraits_T TopolTraits;
|
typedef TopolTraits_T TopolTraits;
|
||||||
|
|
||||||
if (m_verbose_level > 1) {
|
if (m_verbose_level > 1) {
|
||||||
for (InputIterator it = begin; it != end; ++it) print_results(*it);
|
for (InputIterator it = begin; it != end; ++it) print(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename TopolTraits::Default_point_location_strategy pl(m_arr);
|
typename TopolTraits::Default_point_location_strategy pl(m_arr);
|
||||||
|
|
@ -257,8 +254,7 @@ compare(const Cell_handle& expected, const Cell_handle& actual)
|
||||||
std::cout << "Actual: a vertex." << std::endl;
|
std::cout << "Actual: a vertex." << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::cout << "Actual: an unknowen object."
|
std::cout << "Actual: an unknowen object." << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,7 +433,7 @@ compare(const CGAL::Object& expected, const CGAL::Object& actual)
|
||||||
//! \brief prints the results.
|
//! \brief prints the results.
|
||||||
template <typename GeomTraits_T, typename TopolTraits_T>
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
void Batched_point_location_test<GeomTraits_T, TopolTraits_T>::
|
void Batched_point_location_test<GeomTraits_T, TopolTraits_T>::
|
||||||
print_results(const std::pair<Point_2, Cell_handle>& res)
|
print(const std::pair<Point_2, Cell_handle>& res)
|
||||||
{
|
{
|
||||||
// Print the results.
|
// Print the results.
|
||||||
std::cout << "The point (" << res.first << ") is located ";
|
std::cout << "The point (" << res.first << ") is located ";
|
||||||
|
|
@ -459,7 +455,7 @@ print_results(const std::pair<Point_2, Cell_handle>& res)
|
||||||
//! \brief prints the results.
|
//! \brief prints the results.
|
||||||
template <typename GeomTraits_T, typename TopolTraits_T>
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
void Batched_point_location_test<GeomTraits_T, TopolTraits_T>::
|
void Batched_point_location_test<GeomTraits_T, TopolTraits_T>::
|
||||||
print_results(const std::pair<Point_2, CGAL::Object>& res)
|
print(const std::pair<Point_2, CGAL::Object>& res)
|
||||||
{
|
{
|
||||||
// Print the results.
|
// Print the results.
|
||||||
std::cout << "The point (" << res.first << ") is located ";
|
std::cout << "The point (" << res.first << ") is located ";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
#ifndef CGAL_BATCHED_POINT_LOCATION_TEST_H
|
||||||
|
#define CGAL_BATCHED_POINT_LOCATION_TEST_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include <CGAL/basic.h>
|
||||||
|
#include <CGAL/Arr_vertical_decomposition_2.h>
|
||||||
|
#include <CGAL/Arr_point_location_result.h>
|
||||||
|
|
||||||
|
#include "IO_test.h"
|
||||||
|
|
||||||
|
/*! Point location test */
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
class Vertical_decomposition_test : public IO_test<GeomTraits_T> {
|
||||||
|
public:
|
||||||
|
typedef GeomTraits_T Geom_traits;
|
||||||
|
typedef TopolTraits_T Topol_traits;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef IO_test<Geom_traits> Base;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename Base::Point_2 Point_2;
|
||||||
|
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
||||||
|
typedef typename Base::Curve_2 Curve_2;
|
||||||
|
|
||||||
|
typedef typename Base::Points_vector Points_vector;
|
||||||
|
typedef typename Base::Xcurves_vector Xcurves_vector;
|
||||||
|
typedef typename Base::Curves_vector Curves_vector;
|
||||||
|
|
||||||
|
typedef CGAL::Arrangement_on_surface_2<Geom_traits, Topol_traits>
|
||||||
|
Arrangement;
|
||||||
|
|
||||||
|
typedef typename Arrangement::Vertex_handle Vertex_handle;
|
||||||
|
typedef typename Arrangement::Halfedge_handle Halfedge_handle;
|
||||||
|
typedef typename Arrangement::Face_handle Face_handle;
|
||||||
|
|
||||||
|
typedef typename Arrangement::Vertex_const_handle Vertex_const_handle;
|
||||||
|
typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle;
|
||||||
|
typedef typename Arrangement::Face_const_handle Face_const_handle;
|
||||||
|
|
||||||
|
typedef typename Arrangement::Edge_const_iterator Edge_const_iterator;
|
||||||
|
typedef typename Arrangement::Vertex_const_iterator Vertex_const_iterator;
|
||||||
|
|
||||||
|
typedef typename std::pair<CGAL::Object, CGAL::Object> Object_pair;
|
||||||
|
typedef typename std::pair<Vertex_const_handle, Object_pair>
|
||||||
|
Vert_decomp_entry;
|
||||||
|
typedef typename std::list<Vert_decomp_entry> Vert_decomp_list;
|
||||||
|
|
||||||
|
typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result;
|
||||||
|
typedef typename Point_location_result::Type Result_type;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*! The geometry traits. */
|
||||||
|
const Geom_traits& m_geom_traits;
|
||||||
|
|
||||||
|
/*! The arrangement. */
|
||||||
|
Arrangement m_arr;
|
||||||
|
|
||||||
|
/*! Verbosity */
|
||||||
|
size_t m_verbose_level;
|
||||||
|
|
||||||
|
/*! Verify the results.
|
||||||
|
*/
|
||||||
|
template <typename InputIterator>
|
||||||
|
bool verify(InputIterator begin, InputIterator end);
|
||||||
|
|
||||||
|
/*! Compare the results.
|
||||||
|
*/
|
||||||
|
bool compare(const Result_type& expected, const CGAL::Object& actual);
|
||||||
|
|
||||||
|
/*! print the results.
|
||||||
|
*/
|
||||||
|
void print(const Vert_decomp_entry& result);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/*! Constructor from a geometry traits object.
|
||||||
|
*/
|
||||||
|
Vertical_decomposition_test(const Geom_traits& geom_traits);
|
||||||
|
|
||||||
|
/*! Destructor */
|
||||||
|
virtual ~Vertical_decomposition_test() { clear(); }
|
||||||
|
|
||||||
|
/*! Perform the test.
|
||||||
|
* \return true upon success and false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool perform();
|
||||||
|
|
||||||
|
/*! Clear the data structure. */
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
|
/*! Initialize the data structure.
|
||||||
|
* \return true upon success and false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
|
/*! Set the verbosity level.
|
||||||
|
*/
|
||||||
|
void set_verbose_level(size_t verbose_level);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Constructor from a geometry traits object.
|
||||||
|
*/
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::
|
||||||
|
Vertical_decomposition_test(const Geom_traits& geom_traits) :
|
||||||
|
Base(geom_traits),
|
||||||
|
m_geom_traits(geom_traits),
|
||||||
|
m_verbose_level(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! \brief sets the verbosity level.
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
void Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::
|
||||||
|
set_verbose_level(size_t verbose_level)
|
||||||
|
{ m_verbose_level = verbose_level; }
|
||||||
|
|
||||||
|
/*! Clear the data structures */
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
void Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::clear()
|
||||||
|
{
|
||||||
|
m_arr.clear();
|
||||||
|
Base::clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
bool Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::init()
|
||||||
|
{
|
||||||
|
// Initialize the input.
|
||||||
|
if (!Base::init()) return false;
|
||||||
|
|
||||||
|
// Insert all into the arrangement
|
||||||
|
CGAL::insert(m_arr, this->m_xcurves.begin(), this->m_xcurves.end());
|
||||||
|
// insert(*m_arr, m_points.begin(), m_points.end());
|
||||||
|
CGAL::insert(m_arr, this->m_curves.begin(), this->m_curves.end());
|
||||||
|
|
||||||
|
// Print the size of the arrangement.
|
||||||
|
if (m_verbose_level > 1)
|
||||||
|
std::cout << "V = " << m_arr.number_of_vertices()
|
||||||
|
<< ", E = " << m_arr.number_of_edges()
|
||||||
|
<< ", F = " << m_arr.number_of_faces() << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief performs the test.
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
bool Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::perform()
|
||||||
|
{
|
||||||
|
// Apply vertical decomposition.
|
||||||
|
Vert_decomp_list results;
|
||||||
|
CGAL::decompose(m_arr, std::back_inserter(results));
|
||||||
|
|
||||||
|
// Verify the results.
|
||||||
|
return verify(results.begin(), results.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief verifies the results.
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
template <typename InputIterator>
|
||||||
|
bool Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::
|
||||||
|
verify(InputIterator begin, InputIterator end)
|
||||||
|
{
|
||||||
|
typedef TopolTraits_T TopolTraits;
|
||||||
|
|
||||||
|
InputIterator it;
|
||||||
|
if (m_verbose_level > 1) for (it = begin; it != end; ++it) print(*it);
|
||||||
|
|
||||||
|
// Compare the results.
|
||||||
|
typename TopolTraits::Default_vertical_ray_shooting_strategy vs(m_arr);
|
||||||
|
for (it = begin; it != end; ++it) {
|
||||||
|
Vertex_const_handle vh = it->first;
|
||||||
|
const Object_pair& res = it->second;
|
||||||
|
const CGAL::Object& obj_below_actual = res.first;
|
||||||
|
const CGAL::Object& obj_above_actual = res.second;
|
||||||
|
|
||||||
|
Result_type obj_below_expected = vs.ray_shoot_down(vh->point());
|
||||||
|
Result_type obj_above_expected = vs.ray_shoot_up(vh->point());
|
||||||
|
|
||||||
|
if (!compare(obj_below_expected, obj_below_actual)) return false;
|
||||||
|
if (!compare(obj_above_expected, obj_above_actual)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
bool Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::
|
||||||
|
compare(const Result_type& expected, const CGAL::Object& actual)
|
||||||
|
{
|
||||||
|
// Assign object to a fase.
|
||||||
|
const Face_const_handle* fh_expected =
|
||||||
|
boost::get<Face_const_handle>(&(expected));
|
||||||
|
if (fh_expected) {
|
||||||
|
Vertex_const_handle vh_actual;
|
||||||
|
if (CGAL::assign(vh_actual, actual)) {
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a face." << std::endl;
|
||||||
|
std::cout << "Actual: a vertex." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Halfedge_const_handle hh_actual;
|
||||||
|
if (CGAL::assign(hh_actual, actual)) {
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a face." << std::endl;
|
||||||
|
std::cout << "Actual: a halfedge." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign object to a halfedge.
|
||||||
|
const Halfedge_const_handle* hh_expected =
|
||||||
|
boost::get<Halfedge_const_handle>(&(expected));
|
||||||
|
if (hh_expected) {
|
||||||
|
Halfedge_const_handle hh_actual;
|
||||||
|
if (CGAL::assign(hh_actual, actual)) {
|
||||||
|
if (*hh_expected == hh_actual) return true;
|
||||||
|
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a halfedge, " << (*hh_expected)->curve()
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "Actual: a different halfedge." << hh_actual->curve()
|
||||||
|
<< std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a halfedge, " << (*hh_expected)->curve()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
Vertex_const_handle vh_actual;
|
||||||
|
if (CGAL::assign(vh_actual, actual)) {
|
||||||
|
std::cout << "Actual: a vertex, " << vh_actual->point() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Face_const_handle fh_actual;
|
||||||
|
if (CGAL::assign(fh_actual, actual)) {
|
||||||
|
std::cout << "Actual: a face." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Actual: an unknowen object." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign object to a vertex.
|
||||||
|
const Vertex_const_handle* vh_expected =
|
||||||
|
boost::get<Vertex_const_handle>(&(expected));
|
||||||
|
if (vh_expected) {
|
||||||
|
Vertex_const_handle vh_actual;
|
||||||
|
if (CGAL::assign(vh_actual, actual)) {
|
||||||
|
if (*vh_expected == vh_actual) return true;
|
||||||
|
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a vertex, " << (*vh_expected)->point()
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "Actual: a different vertex, " << vh_actual->point()
|
||||||
|
<< std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Error: vertical decomposition!" << std::endl;
|
||||||
|
std::cout << "Expected: a vertex, " << (*vh_expected)->point() << std::endl;
|
||||||
|
|
||||||
|
Halfedge_const_handle hh_actual;
|
||||||
|
if (CGAL::assign(hh_actual, actual)) {
|
||||||
|
std::cout << "Actual: a halfedge, " << hh_actual->curve() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Face_const_handle fh_actual;
|
||||||
|
if (CGAL::assign(fh_actual, actual)) {
|
||||||
|
std::cout << "Actual: a face." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Actual: an unknowen object." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Error: Unknown!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief prints the results.
|
||||||
|
template <typename GeomTraits_T, typename TopolTraits_T>
|
||||||
|
void Vertical_decomposition_test<GeomTraits_T, TopolTraits_T>::
|
||||||
|
print(const Vert_decomp_entry& result)
|
||||||
|
{
|
||||||
|
// Print the result.
|
||||||
|
Vertex_const_handle vh;
|
||||||
|
Halfedge_const_handle hh;
|
||||||
|
Face_const_handle fh;
|
||||||
|
|
||||||
|
const Object_pair& res = result.second;
|
||||||
|
std::cout << "Vertex (" << result.first->point() << ") : ";
|
||||||
|
|
||||||
|
std::cout << " feature below: ";
|
||||||
|
if (CGAL::assign(hh, res.first)) std::cout << '[' << hh->curve() << ']';
|
||||||
|
else if (CGAL::assign(vh, res.first)) std::cout << '(' << vh->point() << ')';
|
||||||
|
else if (CGAL::assign(fh, res.first)) std::cout << "NONE";
|
||||||
|
else std::cout << "EMPTY";
|
||||||
|
|
||||||
|
std::cout << " feature above: ";
|
||||||
|
if (CGAL::assign(hh, res.second)) std::cout << '[' << hh->curve() << ']';
|
||||||
|
else if (CGAL::assign(vh, res.second)) std::cout << '(' << vh->point() << ')';
|
||||||
|
else if (CGAL::assign(fh, res.second)) std::cout << "NONE";
|
||||||
|
else std::cout << "EMPTY";
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <CGAL/basic.h>
|
||||||
|
|
||||||
|
#include "test_configuration.h"
|
||||||
|
|
||||||
|
#if ((TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS) || \
|
||||||
|
(TEST_GEOM_TRAITS == BEZIER_GEOM_TRAITS) || \
|
||||||
|
(TEST_GEOM_TRAITS == RATIONAL_ARC_GEOM_TRAITS)) && !defined(CGAL_USE_CORE)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED;
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "NOTE: Core is not installed, "
|
||||||
|
<< "skipping the test ..."
|
||||||
|
<< std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \
|
||||||
|
(TEST_NT == LEDA_INT_NT || TEST_NT == LEDA_RAT_NT) && \
|
||||||
|
(! CGAL_USE_LEDA)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// bool UNTESTED_TRAITS_AS_LEDA_IS_NOT_INSTALLED;
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "NOTE: LEDA is not installed, "
|
||||||
|
<< "skipping the test ..."
|
||||||
|
<< std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \
|
||||||
|
(TEST_NT == CGAL_GMPZ_NT || TEST_NT == CGAL_GMPQ_NT) && \
|
||||||
|
! (CGAL_USE_GMP && CGAL_USE_MPFI)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
// bool UNTESTED_TRAITS_AS_GMP_OR_MPFI_IS_NOT_INSTALLED;
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "NOTE: GMP and/or MPFI are not installed, "
|
||||||
|
<< "skipping the test ..."
|
||||||
|
<< std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \
|
||||||
|
(TEST_NT == CORE_INT_NT) && \
|
||||||
|
!CGAL_USE_CORE
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED;
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "NOTE: CORE is not installed, "
|
||||||
|
<< "skipping the test ..."
|
||||||
|
<< std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include "test_traits.h"
|
||||||
|
#include "Vertical_decomposition_test.h"
|
||||||
|
|
||||||
|
bool test(const char* points_filename, const char* xcurves_filename,
|
||||||
|
const char* curves_filename, size_t verbose_level)
|
||||||
|
{
|
||||||
|
Geom_traits geom_traits;
|
||||||
|
Vertical_decomposition_test<Geom_traits, Topol_traits> pl_test(geom_traits);
|
||||||
|
pl_test.set_verbose_level(verbose_level);
|
||||||
|
pl_test.set_filenames(points_filename, xcurves_filename, curves_filename);
|
||||||
|
|
||||||
|
if (!pl_test.init()) return false;
|
||||||
|
if (!pl_test.perform()) return false;
|
||||||
|
pl_test.clear();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
|
||||||
|
CGAL::set_pretty_mode(std::cout);
|
||||||
|
CGAL::set_pretty_mode(std::cerr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
size_t verbose_level = 0;
|
||||||
|
int success = 0;
|
||||||
|
size_t i = 1;
|
||||||
|
|
||||||
|
// Test 1
|
||||||
|
if ((argc > 2) && (std::strncmp(argv[1], "-v", 2) == 0)) {
|
||||||
|
verbose_level = boost::lexical_cast<size_t>(argv[2]);
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc < (i + 3)) {
|
||||||
|
std::cout << "Usage: " << argv[0]
|
||||||
|
<< " point-file xcurve-file curve-file"
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "point-file - the input point file" << std::endl;
|
||||||
|
std::cout << "xcurve-file - the input x-monotone curves file" << std::endl;
|
||||||
|
std::cout << "curve-file - the input curve file" << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < argc; i += 3) {
|
||||||
|
const char* points_filename = argv[i];
|
||||||
|
const char* xcurves_filename = argv[i+1];
|
||||||
|
const char* curves_filename = argv[i+2];
|
||||||
|
|
||||||
|
if (!test(points_filename, xcurves_filename, curves_filename, verbose_level))
|
||||||
|
{
|
||||||
|
std::cout << "ERROR : " << argv[0] << " "
|
||||||
|
<< points_filename << " " << xcurves_filename << " "
|
||||||
|
<< curves_filename << std::endl;
|
||||||
|
success = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue