From a9d596d6facd72f5881803d4a136572d9b04c1e1 Mon Sep 17 00:00:00 2001 From: Mariette Yvinec Date: Fri, 16 Jul 1999 17:03:26 +0000 Subject: [PATCH] cleaned up --- .../include/CGAL/Triangulation_face_base_2.h | 362 ++++++++++-------- .../CGAL/Triangulation_vertex_base_2.h | 48 +-- 2 files changed, 216 insertions(+), 194 deletions(-) diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_face_base_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_face_base_2.h index 94e6d31ddd5..1cafd2273ee 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_face_base_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_face_base_2.h @@ -36,181 +36,223 @@ class Triangulation_face_base_2 : public Triangulation_cw_ccw_2 { public: - // typedef typename Gt::Triangle Triangle; typedef Triangulation_face_base_2 Face_base; - inline - Triangulation_face_base_2() - { - set_vertices(); - set_neighbors(); - } +private: + void* V[3]; + void* N[3]; - inline - Triangulation_face_base_2( void* v0, void* v1, void* v2) - { - set_vertices(v0, v1, v2); - set_neighbors(); - } - - inline +public: + Triangulation_face_base_2(); + Triangulation_face_base_2(void* v0, void* v1, void* v2); Triangulation_face_base_2(void* v0, void* v1, void* v2, - void* n0, void* n1, void* n2) - { - set_vertices(v0, v1, v2); - set_neighbors(n0, n1, n2); - } + void* n0, void* n1, void* n2); - - inline - void* vertex(int i) const - { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); - return V[i]; - } - - inline - bool has_vertex(const void* v) const - { - return (V[0] == v) || (V[1] == v) || (V[2]== v); - } - - - inline - bool has_vertex(const void* v, int& i) const - { - if (v == V[0]) { - i = 0; - return true; - } - if (v == V[1]) { - i = 1; - return true; - } - if (v == V[2]) { - i = 2; - return true; - } - return false; - } - - - inline - int vertex_index(const void* v) const - { - if (v == V[0]) return 0; - if (v == V[1]) return 1; - CGAL_triangulation_assertion( v == V[2] ); - return 2; - } - - inline - void* neighbor(int i) const - { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); - return N[i]; - } - - - inline - bool has_neighbor(const void* n) const - { - return (N[0] == n) || (N[1] == n) || (N[2] == n); - } - - - inline - bool has_neighbor(const void* n, int& i) const - { - if(n == N[0]){ - i = 0; - return true; - } - if(n == N[1]){ - i = 1; - return true; - } - if(n == N[2]){ - i = 2; - return true; - } - return false; - } - - - inline - int face_index(const void* n) const - { - if (n == N[0]) return 0; - if (n == N[1]) return 1; - CGAL_triangulation_assertion( n == N[2] ); - return 2; - } - + void* vertex(int i) const; + bool has_vertex(const void* v) const; + bool has_vertex(const void* v, int& i) const ; + int vertex_index(const void* v) const ; + void* neighbor(int i) const ; + bool has_neighbor(const void* n) const; + bool has_neighbor(const void* n, int& i) const; + int face_index(const void* n) const; - inline - void set_vertex(int i, void* v) - { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); - V[i] = v; - } - - - inline - void set_neighbor(int i, void* n) - { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); - N[i] = n; - } - - inline - void set_vertices() - { - V[0] = V[1] = V[2] = NULL; - } - - - inline - void set_vertices(void* v0, - void* v1, - void* v2) - { - V[0] = v0; - V[1] = v1; - V[2] = v2; - } - - inline - void set_neighbors() - { - N[0] = N[1] = N[2] = NULL; - } - - inline - void set_neighbors(void* n0, - void* n1, - void* n2) - { - N[0] = n0; - N[1] = n1; - N[2] = n2; - } - - - + void set_vertex(int i, void* v); + void set_vertices(); + void set_vertices(void* v0, void* v1, void* v2); + void set_neighbor(int i, void* n) ; + void set_neighbors(); + void set_neighbors(void* n0, void* n1, void* n2); + //the following trivial is_valid to allow // the user of derived face base classes // to add their own purpose checking bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const {return true;} - -private: - void* V[3]; - void* N[3]; }; +template +Triangulation_face_base_2 :: +Triangulation_face_base_2() +{ + set_vertices(); + set_neighbors(); +} + +template +Triangulation_face_base_2 :: +Triangulation_face_base_2( void* v0, void* v1, void* v2) +{ + set_vertices(v0, v1, v2); + set_neighbors(); +} + +template +Triangulation_face_base_2 :: +Triangulation_face_base_2(void* v0, void* v1, void* v2, + void* n0, void* n1, void* n2) +{ + set_vertices(v0, v1, v2); + set_neighbors(n0, n1, n2); +} + + +template +inline void* +Triangulation_face_base_2 :: +vertex(int i) const +{ + CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + return V[i]; +} + + +template +inline bool +Triangulation_face_base_2 :: +has_vertex(const void* v) const +{ + return (V[0] == v) || (V[1] == v) || (V[2]== v); +} + +template +inline bool +Triangulation_face_base_2 :: +has_vertex(const void* v, int& i) const +{ + if (v == V[0]) { + i = 0; + return true; + } + if (v == V[1]) { + i = 1; + return true; + } + if (v == V[2]) { + i = 2; + return true; + } + return false; +} + +template +inline int +Triangulation_face_base_2 :: +vertex_index(const void* v) const +{ + if (v == V[0]) return 0; + if (v == V[1]) return 1; + CGAL_triangulation_assertion( v == V[2] ); + return 2; +} + +template +inline void* +Triangulation_face_base_2 :: +neighbor(int i) const +{ + CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + return N[i]; +} + +template +inline bool +Triangulation_face_base_2 :: +has_neighbor(const void* n) const +{ + return (N[0] == n) || (N[1] == n) || (N[2] == n); +} + + +template +inline bool +Triangulation_face_base_2 :: +has_neighbor(const void* n, int& i) const +{ + if(n == N[0]){ + i = 0; + return true; + } + if(n == N[1]){ + i = 1; + return true; + } + if(n == N[2]){ + i = 2; + return true; + } + return false; +} + + +template +inline int +Triangulation_face_base_2 :: +face_index(const void* n) const +{ + if (n == N[0]) return 0; + if (n == N[1]) return 1; + CGAL_triangulation_assertion( n == N[2] ); + return 2; +} + +template +inline void +Triangulation_face_base_2 :: +set_vertex(int i, void* v) +{ + CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + V[i] = v; +} + +template +inline void +Triangulation_face_base_2 :: +set_neighbor(int i, void* n) +{ + CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + N[i] = n; +} + +template +inline void +Triangulation_face_base_2 :: +set_vertices() +{ + V[0] = V[1] = V[2] = NULL; +} + +template +inline void +Triangulation_face_base_2 :: +set_vertices(void* v0, void* v1, void* v2) +{ + V[0] = v0; + V[1] = v1; + V[2] = v2; +} + +template +inline void +Triangulation_face_base_2 :: +set_neighbors() +{ + N[0] = N[1] = N[2] = NULL; +} + +template +inline void +Triangulation_face_base_2 :: +set_neighbors(void* n0,void* n1, void* n2) +{ + N[0] = n0; + N[1] = n1; + N[2] = n2; +} + + CGAL_END_NAMESPACE #endif //CGAL_TRIANGULATION_FACE_BASE_2_H diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h index 74d82b02260..d7a0389c5ed 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h @@ -29,54 +29,34 @@ CGAL_BEGIN_NAMESPACE - template < class GT > class Triangulation_vertex_base_2 { public: - typedef typename GT::Point Point; + typedef typename GT::Point Point; - - - Triangulation_vertex_base_2 () - : _f(NULL) + Triangulation_vertex_base_2 () + : _f(NULL) {} - Triangulation_vertex_base_2(const Point & p) - : _p(p), _f(NULL) - {} - - Triangulation_vertex_base_2(const Point & p, void* f) - : _p(p), _f(f) + Triangulation_vertex_base_2(const Point & p, void * f = NULL) + : _p(p), _f(f) {} - inline void set_point(const Point & p) - { - _p = p; - } - - inline void set_face(void* f) - { - _f = f; - } - - inline - const Point& point() const - { - return _p; - } - - - inline void* face() const - { - return _f; - } + inline void set_point(const Point & p) { _p = p; } + inline void set_face(void* f) { _f = f ;} + + inline + const Point& point() const { return _p; } + + inline void* face() const { return _f;} + //the following trivial is_valid to allow // the user of derived face base classes // to add their own purpose checking bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const - {return true;} + {return true;} private: Point _p;