diff --git a/Point_set_2/demo/Point_set_2/Makefile b/Point_set_2/demo/Point_set_2/Makefile deleted file mode 100644 index c00d77141d2..00000000000 --- a/Point_set_2/demo/Point_set_2/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE -include $(CGAL_MAKEFILE) - -CC = $(CGAL_CXX) $(CGAL_WINDOW_LIBPATH) - -CGALCFLAGS = $(CGAL_CXXFLAGS) - -CGDL = $(CGAL_LDFLAGS) - -all: nearest_neighbor ps_test1_cgal nn_functions rs_functions rs_check_empty_circle rs_check_empty_triangle rs_check_empty_rectangle - -ps_test1_cgal$(EXE_EXT) : ps_test1_cgal$(OBJ_EXT) - $(CC) $(EXE_OPT)ps_test1_cgal ps_test1_cgal$(OBJ_EXT) $(CGDL) - -nearest_neighbor$(EXE_EXT) : nearest_neighbor$(OBJ_EXT) - $(CC) $(EXE_OPT)nearest_neighbor nearest_neighbor$(OBJ_EXT) $(CGDL) - -nn_functions$(EXE_EXT): nn_functions$(OBJ_EXT) - $(CC) $(EXE_OPT)nn_functions nn_functions$(OBJ_EXT) $(CGDL) - -rs_functions$(EXE_EXT): rs_functions$(OBJ_EXT) - $(CC) $(EXE_OPT)rs_functions rs_functions$(OBJ_EXT) $(CGDL) - -rs_check_empty_circle$(EXE_EXT): rs_check_empty_circle$(OBJ_EXT) - $(CC) $(EXE_OPT)rs_check_empty_circle rs_check_empty_circle$(OBJ_EXT) $(CGDL) - -rs_check_empty_triangle$(EXE_EXT): rs_check_empty_triangle$(OBJ_EXT) - $(CC) $(EXE_OPT)rs_check_empty_triangle rs_check_empty_triangle$(OBJ_EXT) $(CGDL) - -rs_check_empty_rectangle$(EXE_EXT): rs_check_empty_rectangle$(OBJ_EXT) - $(CC) $(EXE_OPT)rs_check_empty_rectangle rs_check_empty_rectangle$(OBJ_EXT) $(CGDL) - -rs_check_empty$(EXE_EXT): rs_check_empty$(OBJ_EXT) - $(CC) $(EXE_OPT)rs_check_empty rs_check_empty$(OBJ_EXT) $(CGDL) - -clean : - rm -f tt *~ *.o *.obj *.exe core - rm -f nearest_neighbor ps_test1_cgal nn_functions rs_functions rs_check_empty_circle rs_check_empty_triangle rs_check_empty_rectangle - -cleano : - rm -f *~ *.o - - -#---------------------------------------------------------------------# -# suffix rules -#---------------------------------------------------------------------# - -.cpp$(OBJ_EXT): - $(CGAL_CXX) $(CGALCFLAGS) $(OBJ_OPT) $< - - diff --git a/Point_set_2/demo/Point_set_2/nearest_neighbor.cpp b/Point_set_2/demo/Point_set_2/nearest_neighbor.cpp deleted file mode 100644 index 17fd6d7e792..00000000000 --- a/Point_set_2/demo/Point_set_2/nearest_neighbor.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; - -typedef CGAL::Point_set_2::Edge_iterator Edge_iterator; -typedef CGAL::Point_set_2::Vertex_handle Vertex_handle; - -CGAL::Point_set_2 PSet; - -void output(CGAL::Window_stream& W, const CGAL::Point_set_2& PS) -{ - W.clear(); - Edge_iterator eit = PS.finite_edges_begin(); - - for(;eit != PS.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PS.segment(*eit); - W << s; - } -} - - -void redraw(CGAL::Window_stream* wptr) -{ - output(*wptr,PSet); -} - -int main() -{ - CGAL::Window_stream W(600,500, "Finding nearest neighbor / k nearest neighbors"); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 actual; - /*std::cout << sizeof(actual) << "\n";*/ - - int i=0; - - while (W >> actual){ - PSet.insert(actual); - output(W,PSet); - i++; - } - - std::cout << i << " points were inserted !\n"; - - // nearest neighbor ... - W.draw_text(-450,-350, "Input a point; we display the nearest neighbor ... "); - - for (i=0; i<5; i++){ - W >> actual; - Vertex_handle v = PSet.nearest_neighbor(actual); - - if (v != NULL) { - - CGAL::Segment_2 my_seg(actual,v->point()); - - W << CGAL::RED << v->point() << CGAL::BLACK; - W << CGAL::BLUE << my_seg << CGAL::BLACK; - } - } - - // k nearest neighbors ... - std::list L; - std::list::const_iterator it; - - output(W,PSet); - W.draw_text(-450,-350, "Input a point; we display the 5 nearest neighbors ... "); - - for (i=0; i<5; i++){ - L.clear(); - W >> actual; - PSet.nearest_neighbors(actual,5, std::back_inserter(L)); - std::cout << "actual point: " << actual << "\n"; - - W.clear(); - W.draw_text(-450,-350, "Input a point; we display the 5 nearest neighbors ... "); - output(W,PSet); - W << CGAL::RED << actual << CGAL::BLACK; - - for (it=L.begin();it != L.end(); it++){ - W << CGAL::GREEN << (*it)->point() << CGAL::BLACK; - std::cout << (*it)->point() << "\n"; - } - std::cout << "\n"; - } - - W.read_mouse(); - - return 1; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/nn_functions.cpp b/Point_set_2/demo/Point_set_2/nn_functions.cpp deleted file mode 100644 index 2b2bce08fc3..00000000000 --- a/Point_set_2/demo/Point_set_2/nn_functions.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; -typedef Gt::FT coord_type; -typedef CGAL::Delaunay_triangulation_2 Delaunay; -typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; -typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle; - -Delaunay PSet; - -void output(CGAL::Window_stream& W, const Delaunay& PS) -{ - W.clear(); - Edge_iterator eit = PS.finite_edges_begin(); - - for(;eit != PS.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PS.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ - output(*wptr,PSet); -} - - -int main() -{ - CGAL::Window_stream W(600,500, "Finding nearest neighbor / k nearest neighbors"); - - W.init(-500,500,-400); - W.set_grid_dist(10.0); - W.set_grid_mode(10); - W.set_redraw(redraw); - - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 actual; - int i=0; - - while (W >> actual){ - PSet.insert(actual); - output(W,PSet); - i++; - } - - std::cout << i << " points were inserted !\n"; - - std::list L; - std::list::const_iterator it, it2; - - W.draw_text(-450,-350, "Input a point; we display the 5 nearest neighbors ... "); - - for (i=0; i<10; i++){ - L.clear(); - W >> actual; - - CGAL::nearest_neighbors(PSet, actual, 5, std::back_inserter(L)); - std::cout << "actual point: " << actual << "\n"; - - W.clear(); - W.draw_text(-450,-350, "Input a point; we display the 5 nearest neighbors ... "); - output(W,PSet); - W << CGAL::RED << actual << CGAL::BLACK; - - for (it=L.begin();it != L.end(); it++){ - W << CGAL::GREEN << (*it)->point() << CGAL::BLACK; - std::cout << (*it)->point() << "\n"; - } - std::cout << "\n"; - } - - output(W,PSet); - W.draw_text(-450,-350, "Input a point; we perform the lookup operation ... "); - - for (i=0; i<10; i++){ - W >> actual; - - Vertex_handle vh = CGAL::lookup(PSet, actual); - if (vh != NULL) { - W << CGAL::GREEN << vh->point() << CGAL::BLACK; - } - } - - W.read_mouse(); - - // k nearest neighbors of all vertices ... - L.clear(); - - CGAL::get_vertices(PSet, std::back_inserter(L)); - for (it=L.begin();it != L.end(); it++){ - output(W,PSet); - W.draw_text(-450,-350, "We display the 7 nearest neighbors of every vertex (the number 7 includes the vertex) ... "); - Vertex_handle v = *it; - std::list act; - CGAL::nearest_neighbors(PSet, v, 7, std::back_inserter(act)); - std::cout << "actual point: " << (*it)->point() << "\n"; - for (it2=act.begin();it2 != act.end(); it2++){ - W << CGAL::GREEN << (*it2)->point() << CGAL::BLACK; - std::cout << (*it2)->point() << "\n"; - } - W << CGAL::RED << (*it)->point() << CGAL::BLACK; - W.read_mouse(); - } - - - return 1; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/ps_test1_cgal.cpp b/Point_set_2/demo/Point_set_2/ps_test1_cgal.cpp deleted file mode 100644 index 9184ce16d3d..00000000000 --- a/Point_set_2/demo/Point_set_2/ps_test1_cgal.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; - -typedef CGAL::Point_set_2::Edge_iterator Edge_iterator; -typedef CGAL::Point_set_2::Vertex_handle Vertex_handle; - -typedef CGAL::Iso_rectangle_2 Rectangle; -typedef CGAL::Triangle_2 Triangle; - - -CGAL::Point_set_2 PS; - -void output(CGAL::Window_stream& W, const CGAL::Point_set_2& PSet) -{ - W.clear(); - Edge_iterator eit = PSet.finite_edges_begin(); - - for(;eit != PSet.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PSet.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ - output(*wptr,PS); -} - -int main() -{ - CGAL::Window_stream W(600,500,"Range search operations on a point set"); - //CGAL::cgalize( W); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 pnew; - - while (W >> pnew) { - PS.insert(pnew); - output(W,PS); - } - - std::list::const_iterator vit; - std::list LV; - - std::cout << "circular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Circle_2 rc; - - while (W >> rc) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform a range search (quit: right mouse button) ... "); - W << rc; - - PS.range_search(rc,std::back_inserter(LV)); - W << CGAL::RED; - - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - std::cout << "triangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Point_2 pt1,pt2,pt3,pt4; - Triangle Tr; - - while (W >> Tr){ - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform a range search (quit: right mouse button) ... "); - W << Tr; - - pt1=Tr[0]; pt2=Tr[1]; pt3=Tr[2]; - - PS.range_search(pt1,pt2,pt3,std::back_inserter(LV)); - W << CGAL::GREEN; - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - W << CGAL::BLACK; - - std::cout << "rectangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform a range search (quit: right mouse button) ... "); - - Rectangle Rect; - while (W >> Rect) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform a range search (quit: right mouse button) ... "); - W << Rect; - - pt1=Rect[3]; pt2=Rect[0]; pt3=Rect[1]; pt4=Rect[2]; - - PS.range_search(pt1,pt2,pt3,pt4,std::back_inserter(LV)); - W << CGAL::YELLOW; - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - return 1; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/rs_check_empty_circle.cpp b/Point_set_2/demo/Point_set_2/rs_check_empty_circle.cpp deleted file mode 100644 index af963513163..00000000000 --- a/Point_set_2/demo/Point_set_2/rs_check_empty_circle.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; -typedef Gt::FT coord_type; -typedef CGAL::Delaunay_triangulation_2 Delaunay; -typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; -typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle; - -typedef Gt::Point_2 Point; -typedef Gt::Circle_2 Circle; - -Delaunay PS; - -void output(CGAL::Window_stream& W, const Delaunay& PSet) -{ - W.clear(); - Edge_iterator eit = PSet.finite_edges_begin(); - - for(;eit != PSet.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PSet.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ output(*wptr,PS); } - - -class check_empty { -public: - bool result; - Circle c; - - check_empty(Circle cact) : result(false), c(cact) { } - - bool get_result() const { return result; } - void set_result(bool nr) { result=nr; } - - bool operator()(const Point& p) - { - return ! c.has_on_unbounded_side(p); - } -}; - -int main() -{ - CGAL::Window_stream W(600,500,"Range search operations on a point set checking emptiness of circles"); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 pnew; - - while (W >> pnew) { - PS.insert(pnew); - output(W,PS); - } - - std::list LV; - - std::cout << "circular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Circle_2 rc; - - while (W >> rc) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform an empty circle check (quit: right mouse button) ... "); - W << CGAL::RED; W << rc; W << CGAL::BLACK; - - check_empty checker(rc); - - CGAL::range_search(PS,rc,std::back_inserter(LV),checker,true); - - if (checker.get_result()) std::cout << "circle not empty !\n"; - else std::cout << "circle was empty !\n"; - - /* - W << CGAL::RED; - - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - */ - - LV.clear(); - } - - return 0; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/rs_check_empty_rectangle.cpp b/Point_set_2/demo/Point_set_2/rs_check_empty_rectangle.cpp deleted file mode 100644 index 2ed3fa7b32c..00000000000 --- a/Point_set_2/demo/Point_set_2/rs_check_empty_rectangle.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; -typedef Gt::FT coord_type; -typedef CGAL::Delaunay_triangulation_2 Delaunay; -typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; -typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle; - -typedef Gt::Point_2 Point; -typedef Gt::Circle_2 Circle; -typedef Gt::Iso_rectangle_2 Rectangle; - -Delaunay PS; - -void output(CGAL::Window_stream& W, const Delaunay& PSet) -{ - W.clear(); - Edge_iterator eit = PSet.finite_edges_begin(); - - for(;eit != PSet.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PSet.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ output(*wptr,PS); } - - -class check_empty_rectangle { -public: - bool result; - Rectangle r; - - check_empty_rectangle(Rectangle ract) : result(false), r(ract) { } - - bool get_result() const { return result; } - void set_result(bool nr) { result=nr; } - - bool operator()(const Point& p) - { - return ! r.has_on_unbounded_side(p); - } -}; - -int main() -{ - CGAL::Window_stream W(600,500,"Range search operations on a point set checking emptiness of triangles"); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 pnew; - - while (W >> pnew) { - PS.insert(pnew); - output(W,PS); - } - - std::list LV; - - std::cout << "rectangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Iso_rectangle_2 rc; - - while (W >> rc) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform an empty rectangle check (quit: right mouse button) ... "); - W << CGAL::RED; W << rc; W << CGAL::BLACK; - - check_empty_rectangle checker(rc); - - CGAL::range_search(PS,rc.vertex(0),rc.vertex(1),rc.vertex(2),rc.vertex(3),std::back_inserter(LV),checker,true); - - if (checker.get_result()) std::cout << "rectangle not empty !\n"; - else std::cout << "rectangle was empty !\n"; - - /* - W << CGAL::RED; - - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - */ - - LV.clear(); - } - - return 0; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/rs_check_empty_triangle.cpp b/Point_set_2/demo/Point_set_2/rs_check_empty_triangle.cpp deleted file mode 100644 index 67b396c84a2..00000000000 --- a/Point_set_2/demo/Point_set_2/rs_check_empty_triangle.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; -typedef Gt::FT coord_type; -typedef CGAL::Delaunay_triangulation_2 Delaunay; -typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; -typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle; - -typedef Gt::Point_2 Point; -typedef Gt::Circle_2 Circle; -typedef Gt::Triangle_2 Triangle; - -Delaunay PS; - -void output(CGAL::Window_stream& W, const Delaunay& PSet) -{ - W.clear(); - Edge_iterator eit = PSet.finite_edges_begin(); - - for(;eit != PSet.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PSet.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ output(*wptr,PS); } - - -class check_empty_triangle { -public: - bool result; - Triangle t; - - check_empty_triangle(Triangle tact) : result(false), t(tact) { } - - bool get_result() const { return result; } - void set_result(bool nr) { result=nr; } - - bool operator()(const Point& p) - { - return ! t.has_on_unbounded_side(p); - } -}; - -int main() -{ - CGAL::Window_stream W(600,500,"Range search operations on a point set checking emptiness of triangles"); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 pnew; - - while (W >> pnew) { - PS.insert(pnew); - output(W,PS); - } - - std::list LV; - - std::cout << "triangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Triangle_2 tc; - - while (W >> tc) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform an empty triangle check (quit: right mouse button) ... "); - W << CGAL::RED; W << tc; W << CGAL::BLACK; - - check_empty_triangle checker(tc); - - CGAL::range_search(PS,tc.vertex(0),tc.vertex(1),tc.vertex(2),std::back_inserter(LV),checker,true); - - if (checker.get_result()) std::cout << "triangle not empty !\n"; - else std::cout << "triangle was empty !\n"; - - /* - W << CGAL::RED; - - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - */ - - LV.clear(); - } - - return 0; -} - -#endif diff --git a/Point_set_2/demo/Point_set_2/rs_functions.cpp b/Point_set_2/demo/Point_set_2/rs_functions.cpp deleted file mode 100644 index f481534150c..00000000000 --- a/Point_set_2/demo/Point_set_2/rs_functions.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 2001, 2003 Martin-Luther-University Halle-Wittenberg (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Matthias Baesken - -#include - -#ifndef CGAL_USE_LEDA -int main(){ - return 0; -} -#else - -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; -typedef Gt::FT coord_type; -typedef CGAL::Delaunay_triangulation_2 Delaunay; -typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; -typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle; - -Delaunay PS; - -void output(CGAL::Window_stream& W, const Delaunay& PSet) -{ - W.clear(); - Edge_iterator eit = PSet.finite_edges_begin(); - - for(;eit != PSet.finite_edges_end(); eit++) { - CGAL::Segment_2 s= PSet.segment(*eit); - W << s; - } -} - -void redraw(CGAL::Window_stream* wptr) -{ - output(*wptr,PS); -} - -int main() -{ - CGAL::Window_stream W(600,500,"Range search operations on a point set"); - - W.init(-500,500,-400); - W.set_redraw(redraw); - W.display(100,100); - -#if defined(CGAL_USE_CGAL_WINDOW) - W.set_point_style(CGAL::disc_point); -#else - W.set_point_style(leda_disc_point); -#endif - - W.draw_text(-260,20, "Input some points; quit input with the right mouse button"); - - CGAL::Point_2 pnew; - - while (W >> pnew) { - PS.insert(pnew); - output(W,PS); - } - - std::list::const_iterator vit; - std::list LV; - - std::cout << "circular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Circle_2 rc; - - while (W >> rc) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a circle; we perform a range search (quit: right mouse button) ... "); - W << rc; - - CGAL::range_search(PS,rc,std::back_inserter(LV)); - W << CGAL::RED; - - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - std::cout << "triangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Point_2 pt1,pt2,pt3,pt4; - CGAL::Triangle_2 Tr; - - while (W >> Tr){ - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a triangle; we perform a range search (quit: right mouse button) ... "); - W << Tr; - - pt1=Tr[0]; pt2=Tr[1]; pt3=Tr[2]; - - CGAL::range_search(PS,pt1,pt2,pt3,std::back_inserter(LV)); - W << CGAL::GREEN; - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - W << CGAL::BLACK; - - std::cout << "rectangular range search !\n"; - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform a range search (quit: right mouse button) ... "); - - CGAL::Iso_rectangle_2 Rect; - while (W >> Rect) { - W << CGAL::BLACK; - output(W,PS); - W.draw_text(-450,-350, "Input a rectangle; we perform a range search (quit: right mouse button) ... "); - W << Rect; - - pt1=Rect[3]; pt2=Rect[0]; pt3=Rect[1]; pt4=Rect[2]; - - CGAL::range_search(PS,pt1,pt2,pt3,pt4,std::back_inserter(LV)); - W << CGAL::YELLOW; - for(vit=LV.begin(); vit!=LV.end(); vit++){ - W << (*vit)->point(); - } - LV.clear(); - } - - return 1; -} - -#endif