mirror of https://github.com/CGAL/cgal
- In order to get rid of Direction_2 at some point, I have added :
- Line_2(Point_2, Vector_2) ConstructLine_2
- Ray_2(Point_2, Vector_2) ConstructRay_2
- Ray_2(Point_2, Line_2) ConstructRay_2
- Vector_2(Line_2) ConstructVector_2
- Vector_2(Ray_2) ConstructVector_2
- Vector_2(Segment_2) ConstructVector_2
- Vector_2 Line_2.to_vector()
- Vector_2 Ray_2.to_vector()
- Vector_2 Segment_2.to_vector()
This commit is contained in:
parent
969a430e5e
commit
014b967764
|
|
@ -1,3 +1,15 @@
|
|||
2.86 (11 May 2003)
|
||||
- In order to get rid of Direction_2 at some point, I have added :
|
||||
- Line_2(Point_2, Vector_2) ConstructLine_2
|
||||
- Ray_2(Point_2, Vector_2) ConstructRay_2
|
||||
- Ray_2(Point_2, Line_2) ConstructRay_2
|
||||
- Vector_2(Line_2) ConstructVector_2
|
||||
- Vector_2(Ray_2) ConstructVector_2
|
||||
- Vector_2(Segment_2) ConstructVector_2
|
||||
- Vector_2 Line_2.to_vector()
|
||||
- Vector_2 Ray_2.to_vector()
|
||||
- Vector_2 Segment_2.to_vector()
|
||||
|
||||
2.85 (9 May 2003) [mh]
|
||||
- Introduce homogeneous kernel functors in their own namespace
|
||||
- Remove some global function calls from the functors
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public:
|
|||
LineH2(const Segment_2& s);
|
||||
LineH2(const Ray_2& r);
|
||||
LineH2(const Point_2& p, const Direction_2& d);
|
||||
LineH2(const Point_2& p, const Vector_2& v);
|
||||
|
||||
bool operator==(const LineH2<R>& l) const ;
|
||||
bool operator!=(const LineH2<R>& l) const ;
|
||||
|
|
@ -71,6 +72,7 @@ public:
|
|||
Point_2 point(int i) const;
|
||||
Point_2 projection(const Point_2& p) const;
|
||||
Direction_2 direction() const;
|
||||
Vector_2 to_vector() const;
|
||||
Oriented_side oriented_side( const Point_2& p ) const;
|
||||
bool has_on( const Point_2& p ) const;
|
||||
bool has_on_boundary( const Point_2& p ) const;
|
||||
|
|
@ -134,6 +136,18 @@ LineH2<R>::LineH2(const typename LineH2<R>::Ray_2& r)
|
|||
p.hx()*q.hy() - p.hy()*q.hx() ) );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
LineH2<R>::LineH2(const typename LineH2<R>::Point_2& p,
|
||||
const typename LineH2<R>::Vector_2& v)
|
||||
{
|
||||
Point_2 q = p + v;
|
||||
initialize_with( rep (
|
||||
p.hy()*q.hw() - p.hw()*q.hy(),
|
||||
p.hw()*q.hx() - p.hx()*q.hw(),
|
||||
p.hx()*q.hy() - p.hy()*q.hx() ) );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
LineH2<R>::LineH2(const typename LineH2<R>::Point_2& p,
|
||||
|
|
@ -199,7 +213,7 @@ template < class R >
|
|||
CGAL_KERNEL_INLINE
|
||||
typename LineH2<R>::Point_2
|
||||
LineH2<R>::point(int i) const
|
||||
{ return point() + RT(i) * (direction().to_vector()); }
|
||||
{ return point() + RT(i) * to_vector(); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
|
|
@ -213,6 +227,15 @@ LineH2<R>::projection(const typename LineH2<R>::Point_2& p) const
|
|||
a()*l.b() - l.a()*b() );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename LineH2<R>::Vector_2
|
||||
LineH2<R>::to_vector() const
|
||||
{
|
||||
CGAL_kernel_precondition( !is_degenerate() );
|
||||
return Vector_2( b(), -a() );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename LineH2<R>::Direction_2
|
||||
|
|
@ -228,7 +251,7 @@ LineH2<R>
|
|||
LineH2<R>::transform(const typename LineH2<R>::Aff_transformation_2& t) const
|
||||
{
|
||||
CGAL_kernel_precondition( !is_degenerate() );
|
||||
Point_2 p = point() + direction().to_vector();
|
||||
Point_2 p = point() + to_vector();
|
||||
return LineH2<R>( t.transform(point() ), t.transform(p) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,11 +49,19 @@ public:
|
|||
|
||||
RayH2()
|
||||
: base(rep()) {}
|
||||
|
||||
RayH2( const Point_2& sp, const Point_2& secondp)
|
||||
: base(rep(sp, secondp)) {}
|
||||
|
||||
RayH2( const Point_2& sp, const Direction_2& d)
|
||||
: base(rep(sp, sp + d.to_vector())) {}
|
||||
|
||||
RayH2( const Point_2& sp, const Vector_2& v)
|
||||
: base(rep(sp, sp + v)) {}
|
||||
|
||||
RayH2( const Point_2& sp, const Line_2& l)
|
||||
: base(rep(sp, sp + l.to_vector())) {}
|
||||
|
||||
bool operator==(const RayH2<R>& r) const;
|
||||
bool operator!=(const RayH2<R>& r) const;
|
||||
|
||||
|
|
@ -62,6 +70,7 @@ public:
|
|||
const Point_2 & second_point() const;
|
||||
Point_2 point(int i) const;
|
||||
Direction_2 direction() const;
|
||||
Vector_2 to_vector() const;
|
||||
Line_2 supporting_line() const;
|
||||
RayH2<R> opposite() const;
|
||||
|
||||
|
|
@ -87,6 +96,15 @@ const typename RayH2<R>::Point_2 &
|
|||
RayH2<R>::start() const
|
||||
{ return source(); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename RayH2<R>::Vector_2
|
||||
RayH2<R>::to_vector() const
|
||||
{
|
||||
CGAL_kernel_precondition( !is_degenerate() );
|
||||
return second_point() - start();
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename RayH2<R>::Direction_2
|
||||
|
|
@ -95,6 +113,7 @@ RayH2<R>::direction() const
|
|||
CGAL_kernel_precondition( !is_degenerate() );
|
||||
return Direction_2( second_point() - start() );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
inline
|
||||
const typename RayH2<R>::Point_2 &
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ CGAL_VC7_BUG_PROTECTED
|
|||
typedef typename R_::Point_2 Point_2;
|
||||
typedef typename R_::Line_2 Line_2;
|
||||
typedef typename R_::Direction_2 Direction_2;
|
||||
typedef typename R_::Vector_2 Vector_2;
|
||||
typedef typename R_::Aff_transformation_2 Aff_transformation_2;
|
||||
|
||||
typedef Twotuple<Point_2> rep;
|
||||
|
|
@ -81,6 +82,7 @@ public:
|
|||
FT squared_length() const;
|
||||
|
||||
Direction_2 direction() const;
|
||||
Vector_2 to_vector() const;
|
||||
Line_2 supporting_line() const;
|
||||
SegmentH2<R> opposite() const;
|
||||
Bbox_2 bbox() const;
|
||||
|
|
@ -165,6 +167,15 @@ typename SegmentH2<R>::FT
|
|||
SegmentH2<R>::squared_length() const
|
||||
{ return (end() - start()) * (end() - start()); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename SegmentH2<R>::Vector_2
|
||||
SegmentH2<R>::to_vector() const
|
||||
{
|
||||
CGAL_kernel_precondition( !is_degenerate() );
|
||||
return end() - start();
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
typename SegmentH2<R>::Direction_2
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ CGAL_VC7_BUG_PROTECTED
|
|||
typedef typename R_::FT FT;
|
||||
typedef typename R_::RT RT;
|
||||
typedef typename R_::Point_2 Point_2;
|
||||
typedef typename R_::Segment_2 Segment_2;
|
||||
typedef typename R_::Ray_2 Ray_2;
|
||||
typedef typename R_::Line_2 Line_2;
|
||||
typedef typename R_::Direction_2 Direction_2;
|
||||
typedef typename R_::Vector_2 Vector_2;
|
||||
typedef typename R_::Aff_transformation_2 Aff_transformation_2;
|
||||
|
|
@ -53,6 +56,15 @@ public:
|
|||
VectorH2(const Point_2& a, const Point_2& b)
|
||||
: base (b-a) {}
|
||||
|
||||
VectorH2(const Segment_2& s)
|
||||
: base (s.to_vector()) {}
|
||||
|
||||
VectorH2(const Ray_2& r)
|
||||
: base (r.to_vector()) {}
|
||||
|
||||
VectorH2(const Line_2& l)
|
||||
: base (l.to_vector()) {}
|
||||
|
||||
VectorH2(const Null_vector &)
|
||||
: base ( rep(RT(0), RT(0), RT(1) )) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1537,6 +1537,7 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef typename K::RT RT;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Vector_2 Vector_2;
|
||||
typedef typename K::Direction_2 Direction_2;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
typedef typename K::Ray_2 Ray_2;
|
||||
|
|
@ -1574,6 +1575,15 @@ namespace HomogeneousKernelFunctors {
|
|||
p.hx()*q.hy() - p.hy()*q.hx() );
|
||||
}
|
||||
|
||||
Line_2
|
||||
operator()(const Point_2& p, const Vector_2& v) const
|
||||
{
|
||||
Point_2 q = p + v;
|
||||
return Line_2( p.hy()*q.hw() - p.hw()*q.hy(),
|
||||
p.hw()*q.hx() - p.hx()*q.hw(),
|
||||
p.hx()*q.hy() - p.hy()*q.hx() );
|
||||
}
|
||||
|
||||
Line_2
|
||||
operator()(const Point_2& p, const Direction_2& d) const
|
||||
{
|
||||
|
|
@ -1782,6 +1792,9 @@ namespace HomogeneousKernelFunctors {
|
|||
{
|
||||
typedef typename K::RT RT;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
typedef typename K::Ray_2 Ray_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
typedef typename K::Vector_2 Vector_2;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
public:
|
||||
|
|
@ -1800,6 +1813,18 @@ namespace HomogeneousKernelFunctors {
|
|||
p.hw()*q.hw() );
|
||||
}
|
||||
|
||||
Vector_2
|
||||
operator()( const Segment_2& s) const
|
||||
{ return Vector_2(s); }
|
||||
|
||||
Vector_2
|
||||
operator()( const Ray_2& r) const
|
||||
{ return Vector_2(r); }
|
||||
|
||||
Vector_2
|
||||
operator()( const Line_2& l) const
|
||||
{ return Vector_2(l); }
|
||||
|
||||
Vector_2
|
||||
operator()( Null_vector) const
|
||||
{ return Vector_2(RT(0), RT(0), RT(1)); }
|
||||
|
|
@ -1820,6 +1845,9 @@ namespace HomogeneousKernelFunctors {
|
|||
{
|
||||
typedef typename K::RT RT;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
typedef typename K::Line_3 Line_3;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
typedef typename K::Point_3 Point_3;
|
||||
public:
|
||||
|
|
@ -1839,6 +1867,18 @@ namespace HomogeneousKernelFunctors {
|
|||
p.hw()*q.hw() );
|
||||
}
|
||||
|
||||
Vector_3
|
||||
operator()( const Segment_3& s) const
|
||||
{ return Vector_3(s); }
|
||||
|
||||
Vector_3
|
||||
operator()( const Ray_3& r) const
|
||||
{ return Vector_3(r); }
|
||||
|
||||
Vector_3
|
||||
operator()( const Line_3& l) const
|
||||
{ return Vector_3(l); }
|
||||
|
||||
Vector_3
|
||||
operator()( const Null_vector&) const
|
||||
{ return Vector_3(RT(0), RT(0), RT(0), RT(1)); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue