From b4b7b077b61d870135e96d9994d623e322f9224e Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Thu, 21 Jun 2001 16:08:47 +0000 Subject: [PATCH] Added constructor Direction from Line, Ray and Segment. --- Old_Packages/_2/include/CGAL/Direction_2.h | 22 +++++++++++++++++-- Packages/H2/include/CGAL/PVDH2.h | 18 +++++++++++++++ Packages/H3/include/CGAL/PVDH3.h | 9 ++++++++ Packages/Kernel_23/include/CGAL/Direction_2.h | 22 +++++++++++++++++-- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/Old_Packages/_2/include/CGAL/Direction_2.h b/Old_Packages/_2/include/CGAL/Direction_2.h index 460541cb5f7..009797eb4d7 100644 --- a/Old_Packages/_2/include/CGAL/Direction_2.h +++ b/Old_Packages/_2/include/CGAL/Direction_2.h @@ -25,6 +25,9 @@ #define CGAL_DIRECTION_2_H #include +#include +#include +#include CGAL_BEGIN_NAMESPACE @@ -35,8 +38,11 @@ public: typedef R_ R; typedef typename R::RT RT; typedef typename R::FT FT; - typedef typename R::Vector_2_base RVector_2; - typedef typename R::Direction_2_base RDirection_2; + typedef typename R::Vector_2_base RVector_2; + typedef typename R::Direction_2_base RDirection_2; + typedef typename R::Line_2_base RLine_2; + typedef typename R::Ray_2_base RRay_2; + typedef typename R::Segment_2_base RSegment_2; Direction_2() {} @@ -53,6 +59,18 @@ public: : RDirection_2(v) {} + Direction_2(const RLine_2& l) + : RDirection_2(l) + {} + + Direction_2(const RRay_2& r) + : RDirection_2(r) + {} + + Direction_2(const RSegment_2& s) + : RDirection_2(s) + {} + Direction_2(const RT &x, const RT &y) : RDirection_2(x,y) {} diff --git a/Packages/H2/include/CGAL/PVDH2.h b/Packages/H2/include/CGAL/PVDH2.h index b5a3ebe17e9..6c11936ac3d 100644 --- a/Packages/H2/include/CGAL/PVDH2.h +++ b/Packages/H2/include/CGAL/PVDH2.h @@ -146,6 +146,9 @@ public: DirectionH2(const DirectionH2& d ); DirectionH2(const PointH2 & p ); DirectionH2(const VectorH2 & v ); + DirectionH2(const LineH2 & l ); + DirectionH2(const RayH2 & r ); + DirectionH2(const SegmentH2 & s ); DirectionH2(const RT& x, const RT& y); DirectionH2(const RT& x, const RT& y, const RT& w ); @@ -418,6 +421,21 @@ CGAL_KERNEL_CTOR_INLINE DirectionH2::DirectionH2(const VectorH2 & v ) : Direction_handle_2_ ( v) {} +template +CGAL_KERNEL_CTOR_INLINE +DirectionH2::DirectionH2(const LineH2 & l ) + : Direction_handle_2_ ( l.direction()) {} + +template +CGAL_KERNEL_CTOR_INLINE +DirectionH2::DirectionH2(const RayH2 & r ) + : Direction_handle_2_ ( r.direction()) {} + +template +CGAL_KERNEL_CTOR_INLINE +DirectionH2::DirectionH2(const SegmentH2 & s ) + : Direction_handle_2_ ( s.direction()) {} + template CGAL_KERNEL_CTOR_INLINE DirectionH2::DirectionH2(const RT& x, const RT& y) diff --git a/Packages/H3/include/CGAL/PVDH3.h b/Packages/H3/include/CGAL/PVDH3.h index d4d87588a71..d09a0fe3361 100644 --- a/Packages/H3/include/CGAL/PVDH3.h +++ b/Packages/H3/include/CGAL/PVDH3.h @@ -172,6 +172,15 @@ class DirectionH3 DirectionH3(const VectorH3 & v ) : Direction_handle_3_(v) {} + DirectionH3(const LineH3 & l ) + : Direction_handle_3_(l.direction()) {} + + DirectionH3(const RayH3 & r ) + : Direction_handle_3_(r.direction()) {} + + DirectionH3(const SegmentH3 & s ) + : Direction_handle_3_(s.direction()) {} + DirectionH3(const RT& x, const RT& y, const RT& z, const RT& w = RT(1) ); diff --git a/Packages/Kernel_23/include/CGAL/Direction_2.h b/Packages/Kernel_23/include/CGAL/Direction_2.h index 460541cb5f7..009797eb4d7 100644 --- a/Packages/Kernel_23/include/CGAL/Direction_2.h +++ b/Packages/Kernel_23/include/CGAL/Direction_2.h @@ -25,6 +25,9 @@ #define CGAL_DIRECTION_2_H #include +#include +#include +#include CGAL_BEGIN_NAMESPACE @@ -35,8 +38,11 @@ public: typedef R_ R; typedef typename R::RT RT; typedef typename R::FT FT; - typedef typename R::Vector_2_base RVector_2; - typedef typename R::Direction_2_base RDirection_2; + typedef typename R::Vector_2_base RVector_2; + typedef typename R::Direction_2_base RDirection_2; + typedef typename R::Line_2_base RLine_2; + typedef typename R::Ray_2_base RRay_2; + typedef typename R::Segment_2_base RSegment_2; Direction_2() {} @@ -53,6 +59,18 @@ public: : RDirection_2(v) {} + Direction_2(const RLine_2& l) + : RDirection_2(l) + {} + + Direction_2(const RRay_2& r) + : RDirection_2(r) + {} + + Direction_2(const RSegment_2& s) + : RDirection_2(s) + {} + Direction_2(const RT &x, const RT &y) : RDirection_2(x,y) {}