From 4e2a83ded1daa6b09335e9c584e246dbc48f45d7 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 25 Jun 2010 09:45:35 +0000 Subject: [PATCH] int -> size_t / Cartesian -> ExactExact --- .../doc_tex/Point_set_2_ref/Point_set_2.tex | 5 +++-- .../Point_set_2_ref/nearest_neighbors.tex | 4 ++-- Point_set_2/include/CGAL/Point_set_2.h | 19 ++++++++++--------- .../CGAL/nearest_neighbor_delaunay_2.h | 9 ++++++--- Point_set_2/test/Point_set_2/nearest_nb1.cpp | 5 ++--- .../test/Point_set_2/nearest_nb_fcn.cpp | 6 ++---- .../test/Point_set_2/rs_check_empty.cpp | 6 +++--- 7 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Point_set_2/doc_tex/Point_set_2_ref/Point_set_2.tex b/Point_set_2/doc_tex/Point_set_2_ref/Point_set_2.tex index 498c13e38a8..b61e930cf26 100644 --- a/Point_set_2/doc_tex/Point_set_2_ref/Point_set_2.tex +++ b/Point_set_2/doc_tex/Point_set_2_ref/Point_set_2.tex @@ -30,6 +30,7 @@ and for the triangulation data structure (Tds). \ccTypedef{typedef Gt::Segment_2 Segment;}{the segment type} \ccTypedef{typedef Gt::Circle_2 Circle;}{the circle type} \ccTypedef{typedef Gt::FT Numb_type;}{the representation field number type.} +\ccNestedType{Triangulation::size_type}{the size type of the underlying triangulation.} \ccNestedType{Triangulation::Vertex}{the vertex type of the underlying triangulation.} \ccNestedType{Triangulation::Edge}{the edge type of the underlying triangulation.} \ccNestedType{Triangulation::Vertex_handle }{handles to vertices.} @@ -71,7 +72,7 @@ If $v$ is the only vertex in \ccVar\ , $NULL$ is returned. } \ccMethod{template -OutputIterator nearest_neighbors(Point p, int k, OutputIterator res);} +OutputIterator nearest_neighbors(Point p, size_type k, OutputIterator res);} { computes the $k$ nearest neighbors of $p$ in \ccVar, and places the handles to the corresponding vertices as a sequence of objects of type Vertex\_handle in a container of value type of $res$ @@ -80,7 +81,7 @@ returns an output iterator pointing to the position beyond the end of the sequence. } \ccMethod{template -OutputIterator nearest_neighbors(Vertex_handle v, int k,OutputIterator res);} +OutputIterator nearest_neighbors(Vertex_handle v, size_type k,OutputIterator res);} { computes the $k$ nearest neighbors of $v$, and places them as a sequence of objects of type Vertex\_handle in a container of value type of $res$ which points to the first object in the sequence. The function diff --git a/Point_set_2/doc_tex/Point_set_2_ref/nearest_neighbors.tex b/Point_set_2/doc_tex/Point_set_2_ref/nearest_neighbors.tex index 0719fb54fc6..ea4bee0f04d 100644 --- a/Point_set_2/doc_tex/Point_set_2_ref/nearest_neighbors.tex +++ b/Point_set_2/doc_tex/Point_set_2_ref/nearest_neighbors.tex @@ -11,7 +11,7 @@ other taking a vertex handle. \ccInclude{CGAL/nearest_neighbor_delaunay_2.h} \ccFunction{template - OutputIterator nearest_neighbors(Dt& delau, const Dt::Point& p, int k, OutputIterator res);} + OutputIterator nearest_neighbors(Dt& delau, const Dt::Point& p, Dt::size_type k, OutputIterator res);} {computes the $k$ nearest neighbors of $p$ in $delau$, and places the handles to the corresponding vertices as a sequence of objects of type Vertex\_handle in a container of value type of $res$ @@ -37,7 +37,7 @@ the Delaunay triangulation data type: \end{itemize} \ccFunction{template - OutputIterator nearest_neighbors(Dt& delau, Dt::Vertex_handle v, int k, OutputIterator res);} + OutputIterator nearest_neighbors(Dt& delau, Dt::Vertex_handle v, Dt::size_type k, OutputIterator res);} {computes the $k$ nearest neighbors of $v$ (including $v$) in $delau$, and places them as a sequence of objects of type Vertex\_handle in a container of value type of $res$ which points to the first object in the sequence. The function diff --git a/Point_set_2/include/CGAL/Point_set_2.h b/Point_set_2/include/CGAL/Point_set_2.h index 15a45e4a7fb..1c602e4c231 100644 --- a/Point_set_2/include/CGAL/Point_set_2.h +++ b/Point_set_2/include/CGAL/Point_set_2.h @@ -54,6 +54,7 @@ public: typedef Triangulation_2 Triangulation; + typedef typename Triangulation::size_type size_type; typedef typename Triangulation::Locate_type Locate_type; typedef typename Triangulation::Face_handle Face_handle; typedef typename Triangulation::Vertex_handle Vertex_handle; @@ -175,9 +176,9 @@ public: } template - OutputIterator nearest_neighbors(Point p, int k, OutputIterator res) + OutputIterator nearest_neighbors(Point p, size_type k, OutputIterator res) { - int n = number_of_vertices(); + size_type n = number_of_vertices(); if ( k <= 0 ) return res; if ( n <= k ) { // return all finite vertices ... @@ -213,9 +214,9 @@ public: } template - OutputIterator nearest_neighbors(Vertex_handle v, int k,OutputIterator res) + OutputIterator nearest_neighbors(Vertex_handle v, size_type k,OutputIterator res) { - int n = number_of_vertices(); + size_type n = number_of_vertices(); if ( k <= 0 ) return res; if ( n <= k ) { // return all (finite) vertices ... @@ -234,10 +235,10 @@ public: void nearest_neighbors_list(Vertex_handle v, - int k, + size_type k, std::list& res) { - int n = number_of_vertices(); + size_type n = number_of_vertices(); if ( k <= 0 ) return; if ( n <= k ) { vertices(std::back_inserter(res)); return; } @@ -290,9 +291,9 @@ public: // dfs // for marking nodes in search procedures - int cur_mark; + size_type cur_mark; - Unique_hash_map mark; + Unique_hash_map mark; void init_vertex_marks() { @@ -303,7 +304,7 @@ public: void init_dfs() { cur_mark++; - if (cur_mark == INT_MAX) init_vertex_marks(); + if (cur_mark == std::numeric_limits::max()) init_vertex_marks(); } void mark_vertex(Vertex_handle vh) diff --git a/Point_set_2/include/CGAL/nearest_neighbor_delaunay_2.h b/Point_set_2/include/CGAL/nearest_neighbor_delaunay_2.h index 7ef7f6ca9b5..6ebfc1948da 100644 --- a/Point_set_2/include/CGAL/nearest_neighbor_delaunay_2.h +++ b/Point_set_2/include/CGAL/nearest_neighbor_delaunay_2.h @@ -99,10 +99,11 @@ template OutputIterator nearest_neighbors(Dt& delau, const typename Dt::Point& p, int k, OutputIterator res) { typedef typename Dt::Geom_traits Gt; + typedef typename Dt::size_type size_type; typedef typename Dt::Vertex_handle Vertex_handle; typedef typename Dt::Vertex_iterator Vertex_iterator; - int n = delau.number_of_vertices(); + size_type n = delau.number_of_vertices(); if ( k <= 0 ) return res; if ( n <= k ) { // return all finite vertices ... @@ -146,10 +147,11 @@ template OutputIterator nearest_neighbors(const Dt& delau, typename Dt::Vertex_handle v, int k, OutputIterator res) { typedef typename Dt::Geom_traits Gt; + typedef typename Dt::size_type size_type; typedef typename Dt::Vertex_handle Vertex_handle; typedef typename Dt::Vertex_iterator Vertex_iterator; - int n = delau.number_of_vertices(); + size_type n = delau.number_of_vertices(); if ( k <= 0 ) return res; if ( n <= k ) { // return all (finite) vertices ... @@ -188,6 +190,7 @@ template void nearest_neighbors_list(const Dt& delau, typename Dt::Vertex_handle v, int k, std::list& res) { typedef typename Dt::Geom_traits Gt; + typedef typename Dt::size_type size_type; typedef typename Dt::Vertex_handle Vertex_handle; typedef typename Dt::Vertex_iterator Vertex_iterator; typedef typename Dt::Vertex_circulator Vertex_circulator; @@ -197,7 +200,7 @@ void nearest_neighbors_list(const Dt& delau, typename Dt::Vertex_handle v, int k typedef typename Gt::Compute_squared_distance_2 Compute_squared_distance_2; typedef Unique_hash_map MAP_TYPE; - int n = delau.number_of_vertices(); + size_type n = delau.number_of_vertices(); if ( k <= 0 ) return; if ( n <= k ) { diff --git a/Point_set_2/test/Point_set_2/nearest_nb1.cpp b/Point_set_2/test/Point_set_2/nearest_nb1.cpp index 6cfb9db6d6b..3dba104428c 100644 --- a/Point_set_2/test/Point_set_2/nearest_nb1.cpp +++ b/Point_set_2/test/Point_set_2/nearest_nb1.cpp @@ -1,13 +1,12 @@ -#include #include #include -#include +#include #include using namespace CGAL; using namespace std; -typedef Cartesian K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Point_set_2::Edge Edge; typedef CGAL::Point_set_2::Edge_iterator Edge_iterator; diff --git a/Point_set_2/test/Point_set_2/nearest_nb_fcn.cpp b/Point_set_2/test/Point_set_2/nearest_nb_fcn.cpp index ae83d554c37..968767bfeb1 100644 --- a/Point_set_2/test/Point_set_2/nearest_nb_fcn.cpp +++ b/Point_set_2/test/Point_set_2/nearest_nb_fcn.cpp @@ -1,14 +1,12 @@ -#include #include #include -#include +#include #include using namespace CGAL; using namespace std; -typedef double coord_type; -typedef CGAL::Cartesian K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Delaunay_triangulation_2 Delaunay; typedef CGAL::Delaunay_triangulation_2::Edge Edge; typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; diff --git a/Point_set_2/test/Point_set_2/rs_check_empty.cpp b/Point_set_2/test/Point_set_2/rs_check_empty.cpp index fb46538c1b9..4701a058664 100644 --- a/Point_set_2/test/Point_set_2/rs_check_empty.cpp +++ b/Point_set_2/test/Point_set_2/rs_check_empty.cpp @@ -1,9 +1,9 @@ -#include +#include #include #include -typedef double coord_type; -typedef CGAL::Simple_cartesian Gt; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; typedef CGAL::Delaunay_triangulation_2 Delaunay; typedef CGAL::Delaunay_triangulation_2::Edge_iterator Edge_iterator; typedef CGAL::Delaunay_triangulation_2::Vertex_handle Vertex_handle;