From 7b331e2a7f8fc4171e25ffb9a6dfd391a254a522 Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Fri, 3 Nov 2000 12:12:44 +0000 Subject: [PATCH] - Moved ctors definition in class body. --- .../include/CGAL/Cartesian/Vector_2.h | 86 ++++++----------- .../include/CGAL/Cartesian/Vector_3.h | 92 ++++++------------- 2 files changed, 58 insertions(+), 120 deletions(-) diff --git a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h index 874376ca1cf..56748d15409 100644 --- a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h +++ b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h @@ -23,7 +23,6 @@ #define CGAL_CARTESIAN_VECTOR_2_H #include -#include CGAL_BEGIN_NAMESPACE @@ -63,12 +62,28 @@ public: typedef typename R::Circle_2_base Circle_2; #endif - VectorC2(); - VectorC2(const Null_vector &); - VectorC2(const Point_2 &p); - VectorC2(const Direction_2 &d); - VectorC2(const FT &hx, const FT &hy, const FT &hw); - VectorC2(const FT &x, const FT &y); + VectorC2() + : Vector_handle_2(Vector_ref_2()) {} + + VectorC2(const Null_vector &) + : Vector_handle_2(Vector_ref_2(FT(0), FT(0))) {} + + VectorC2(const Point_2 &p) + : Vector_handle_2(p) {} + + VectorC2(const Direction_2 &d) + : Vector_handle_2(d) {} + + VectorC2(const FT &x, const FT &y) + : Vector_handle_2(Vector_ref_2(x, y)) {} + + VectorC2(const FT &hx, const FT &hy, const FT &hw) + { + if (hw != FT(1)) + initialize_with(Vector_ref_2(hx/hw, hy/hw)); + else + initialize_with(Vector_ref_2(hx, hy)); + } bool operator==(const Self &v) const; bool operator!=(const Self &v) const; @@ -115,55 +130,19 @@ public: Direction_2 direction() const; Self perpendicular(const Orientation &o) const; - Self transform(const Aff_transformation_2 &) const; + Self transform(const Aff_transformation_2 &t) const + { + return t.transform(*this); + } }; -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC2::VectorC2() - : Vector_handle_2(Vector_ref_2()) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC2::VectorC2(const Null_vector &) - : Vector_handle_2(Vector_ref_2(FT(0), FT(0)) ) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC2::VectorC2(const typename VectorC2::FT &x, - const typename VectorC2::FT &y) - : Vector_handle_2(Vector_ref_2(x, y) ) {} - -template < class R > -CGAL_KERNEL_CTOR_MEDIUM_INLINE -VectorC2::VectorC2(const typename VectorC2::FT &hx, - const typename VectorC2::FT &hy, - const typename VectorC2::FT &hw) -{ - if( hw != FT(1)) - initialize_with( Vector_ref_2(hx/hw, hy/hw) ); - else - initialize_with( Vector_ref_2(hx, hy) ); -} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC2:: -VectorC2(const typename VectorC2::Point_2 &p) - : Vector_handle_2(p) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC2:: -VectorC2(const typename VectorC2::Direction_2 &d) - : Vector_handle_2(d) {} - template < class R > CGAL_KERNEL_INLINE bool VectorC2::operator==(const VectorC2 &v) const { - if ( identical(v) ) return true; + if (identical(v)) + return true; return x() == v.x() && y() == v.y(); } @@ -285,15 +264,6 @@ VectorC2::perpendicular(const Orientation &o) const return VectorC2(y(), -x()); } -template < class R > -inline -VectorC2 -VectorC2:: -transform(const typename VectorC2::Aff_transformation_2 &t) const -{ - return t.transform(*this); -} - #ifndef CGAL_NO_OSTREAM_INSERT_VECTORC2 template < class R > std::ostream & diff --git a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index a6fed3eede6..331e328168b 100644 --- a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -23,7 +23,6 @@ #define CGAL_CARTESIAN_VECTOR_3_H #include -#include CGAL_BEGIN_NAMESPACE @@ -51,12 +50,28 @@ public: typedef typename R::Aff_transformation_3_base Aff_transformation_3; #endif - VectorC3(); - VectorC3(const Null_vector &); - VectorC3(const Point_3 &p); - VectorC3(const Direction_3 &p); - VectorC3(const FT &x, const FT &y, const FT &z); - VectorC3(const FT &x, const FT &y, const FT &z, const FT &w); + VectorC3() + : Vector_handle_3(Vector_ref_3()) {} + + VectorC3(const Null_vector &) + : Vector_handle_3(Vector_ref_3(FT(0), FT(0), FT(0))) {} + + VectorC3(const Point_3 &p) + : Vector_handle_3(p) {} + + VectorC3(const Direction_3 &d) + : Vector_handle_3(d) {} + + VectorC3(const FT &x, const FT &y, const FT &z) + : Vector_handle_3(Vector_ref_3(x, y, z)) {} + + VectorC3(const FT &x, const FT &y, const FT &z, const FT &w) + { + if (w != FT(1)) + initialize_with(Vector_ref_3(x/w, y/w, z/w)); + else + initialize_with(Vector_ref_3(x, y, z)); + } bool operator==(const Self &p) const; bool operator!=(const Self &p) const; @@ -103,6 +118,7 @@ public: return 3; } + // FIXME: why not like the other operators in global_operators_[23].h ? Self operator+(const Self &w) const; Self operator-(const Self &w) const; Self operator-() const; @@ -110,59 +126,19 @@ public: FT operator*(const Self &w) const; FT squared_length() const; Direction_3 direction() const; - Self transform(const Aff_transformation_3 &) const; + Self transform(const Aff_transformation_3 &t) const + { + return t.transform(*this); + } }; -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3::VectorC3() - : Vector_handle_3(Vector_ref_3()) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3::VectorC3(const Null_vector &) - : Vector_handle_3(Vector_ref_3(FT(0), FT(0), FT(0))) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3:: -VectorC3(const typename VectorC3::FT &x, - const typename VectorC3::FT &y, - const typename VectorC3::FT &z) - : Vector_handle_3(Vector_ref_3(x, y, z)) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3:: -VectorC3(const typename VectorC3::FT &x, - const typename VectorC3::FT &y, - const typename VectorC3::FT &z, - const typename VectorC3::FT &w) -{ - if (w != FT(1)) - initialize_with(Vector_ref_3(x/w, y/w, z/w) ); - else - initialize_with(Vector_ref_3(x, y, z) ); -} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3:: -VectorC3(const typename VectorC3::Point_3 &p) - : Vector_handle_3(p) {} - -template < class R > -CGAL_KERNEL_CTOR_INLINE -VectorC3:: -VectorC3(const typename VectorC3::Direction_3 &d) - : Vector_handle_3(d) {} - template < class R > inline bool VectorC3::operator==(const VectorC3 &v) const { - if ( identical(v) ) return true; + if (identical(v)) + return true; return x() == v.x() && y() == v.y() && z() == v.z(); } @@ -265,7 +241,7 @@ VectorC3 VectorC3:: operator/(const typename VectorC3::FT &c) const { - return VectorC3( x()/c, y()/c, z()/c); + return VectorC3(x()/c, y()/c, z()/c); } template < class R > @@ -276,14 +252,6 @@ VectorC3::direction() const return Direction_3(*this); } -template < class R > -VectorC3 -VectorC3:: -transform(const typename VectorC3::Aff_transformation_3 &t) const -{ - return t.transform(*this); -} - #ifndef CGAL_CARTESIAN_NO_OSTREAM_INSERT_VECTORC3 template < class R > std::ostream &