Use boost::array instead of Twotuple

This commit is contained in:
Sylvain Pion 2008-07-25 11:19:03 +00:00
parent edaa883845
commit b02bc7921b
9 changed files with 76 additions and 77 deletions

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_ISO_CUBOID_3_H
#define CGAL_CARTESIAN_ISO_CUBOID_3_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
#include <CGAL/Handle_for.h>
#include <CGAL/Cartesian/predicates_on_points_3.h>
@ -39,7 +39,7 @@ class Iso_cuboidC3
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Construct_point_3 Construct_point_3;
typedef Twotuple<Point_3> Rep;
typedef boost::array<Point_3, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -50,7 +50,7 @@ public:
Iso_cuboidC3() {}
Iso_cuboidC3(const Point_3 &p, const Point_3 &q, int)
: base(p, q)
: base(CGALi::make_array(p, q))
{
// I have to remove the assertions, because of Cartesian_converter.
// CGAL_kernel_assertion(p.x()<=q.x());
@ -68,15 +68,15 @@ public:
else { miny = q.y(); maxy = p.y(); }
if (p.z() < q.z()) { minz = p.z(); maxz = q.z(); }
else { minz = q.z(); maxz = p.z(); }
base = Rep(construct_point_3(minx, miny, minz),
construct_point_3(maxx, maxy, maxz));
base = Rep(CGALi::make_array(construct_point_3(minx, miny, minz),
construct_point_3(maxx, maxy, maxz)));
}
Iso_cuboidC3(const Point_3 &left, const Point_3 &right,
const Point_3 &bottom, const Point_3 &top,
const Point_3 &far_, const Point_3 &close)
: base(Construct_point_3()(left.x(), bottom.y(), far_.z()),
Construct_point_3()(right.x(), top.y(), close.z()))
: base(CGALi::make_array(Construct_point_3()(left.x(), bottom.y(), far_.z()),
Construct_point_3()(right.x(), top.y(), close.z())))
{
CGAL_kernel_precondition(!less_x(right, left));
CGAL_kernel_precondition(!less_y(top, bottom));
@ -85,8 +85,8 @@ public:
Iso_cuboidC3(const FT& min_x, const FT& min_y, const FT& min_z,
const FT& max_x, const FT& max_y, const FT& max_z)
: base(Construct_point_3()(min_x, min_y, min_z),
Construct_point_3()(max_x, max_y, max_z))
: base(CGALi::make_array(Construct_point_3()(min_x, min_y, min_z),
Construct_point_3()(max_x, max_y, max_z)))
{
CGAL_kernel_precondition(min_x <= max_x);
CGAL_kernel_precondition(min_y <= max_y);
@ -98,11 +98,11 @@ public:
const FT& hw)
{
if (hw == FT(1))
base = Rep(Construct_point_3()(min_hx, min_hy, min_hz),
Construct_point_3()(max_hx, max_hy, max_hz));
base = Rep(CGALi::make_array(Construct_point_3()(min_hx, min_hy, min_hz),
Construct_point_3()(max_hx, max_hy, max_hz)));
else
base = Rep(Construct_point_3()(min_hx/hw, min_hy/hw, min_hz/hw),
Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw));
base = Rep(CGALi::make_array(Construct_point_3()(min_hx/hw, min_hy/hw, min_hz/hw),
Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw)));
}
typename R::Bool_type operator==(const Iso_cuboidC3& s) const;
@ -110,11 +110,11 @@ public:
const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return get(base).e0;
return get(base)[0];
}
const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return get(base).e1;
return get(base)[1];
}
Point_3 vertex(int i) const;
Point_3 operator[](int i) const;

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_ISO_RECTANGLE_2_H
#define CGAL_CARTESIAN_ISO_RECTANGLE_2_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
CGAL_BEGIN_NAMESPACE
@ -36,7 +36,7 @@ class Iso_rectangleC2
typedef typename R_::Iso_rectangle_2 Iso_rectangle_2;
typedef typename R_::Construct_point_2 Construct_point_2;
typedef Twotuple<Point_2> Rep;
typedef boost::array<Point_2, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -50,7 +50,7 @@ public:
// : base(p, q) {}
Iso_rectangleC2(const Point_2 &p, const Point_2 &q, int)
: base(p, q)
: base(CGALi::make_array(p, q))
{
// I have to remove the assertions, because of Cartesian_converter.
// CGAL_kernel_assertion(p<=q);
@ -58,11 +58,11 @@ public:
const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return get(base).e0;
return get(base)[0];
}
const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return get(base).e1;
return get(base)[1];
}
};

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_RAY_2_H
#define CGAL_CARTESIAN_RAY_2_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
CGAL_BEGIN_NAMESPACE
@ -35,7 +35,7 @@ class RayC2
typedef typename R_::Point_2 Point_2;
typedef typename R_::Ray_2 Ray_2;
typedef Twotuple<Point_2> Rep;
typedef boost::array<Point_2, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -47,20 +47,20 @@ public:
{}
RayC2(const Point_2 &sp, const Point_2 &secondp)
: base(sp, secondp)
: base(CGALi::make_array(sp, secondp))
{}
const Point_2&
source() const
{
return get(base).e0;
return get(base)[0];
}
const Point_2 &
second_point() const
{
return get(base).e1;
return get(base)[1];
}
typename R_::Bool_type is_degenerate() const

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_RAY_3_H
#define CGAL_CARTESIAN_RAY_3_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
#include <CGAL/Handle_for.h>
CGAL_BEGIN_NAMESPACE
@ -39,7 +39,7 @@ class RayC3
typedef typename R_::Line_3 Line_3;
typedef typename R_::Ray_3 Ray_3;
typedef Twotuple<Point_3> Rep;
typedef boost::array<Point_3, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -50,27 +50,27 @@ public:
RayC3() {}
RayC3(const Point_3 &sp, const Point_3 &secondp)
: base(sp, secondp) {}
: base(CGALi::make_array(sp, secondp)) {}
RayC3(const Point_3 &sp, const Vector_3 &v)
: base(sp, sp + v) {}
: base(CGALi::make_array(sp, sp + v)) {}
RayC3(const Point_3 &sp, const Direction_3 &d)
: base(sp, sp + d.to_vector()) {}
: base(CGALi::make_array(sp, sp + d.to_vector())) {}
RayC3(const Point_3 &sp, const Line_3 &l)
: base(sp, sp + l.to_vector()) {}
: base(CGALi::make_array(sp, sp + l.to_vector())) {}
typename R::Bool_type operator==(const RayC3 &r) const;
typename R::Bool_type operator!=(const RayC3 &r) const;
const Point_3 & source() const
{
return get(base).e0;
return get(base)[0];
}
const Point_3 & second_point() const
{
return get(base).e1;
return get(base)[1];
}
Point_3 point(int i) const;

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_SEGMENT_2_H
#define CGAL_CARTESIAN_SEGMENT_2_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
#include <CGAL/Cartesian/predicates_on_points_2.h>
CGAL_BEGIN_NAMESPACE
@ -34,7 +34,7 @@ class SegmentC2
typedef typename R_::Point_2 Point_2;
typedef typename R_::Segment_2 Segment_2;
typedef Twotuple<Point_2> Rep;
typedef boost::array<Point_2, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -46,19 +46,19 @@ public:
{}
SegmentC2(const Point_2 &sp, const Point_2 &ep)
: base(sp, ep)
: base(CGALi::make_array(sp, ep))
{}
const Point_2 &
source() const
{
return get(base).e0;
return get(base)[0];
}
const Point_2 &
target() const
{
return get(base).e1;
return get(base)[1];
}
};

View File

@ -24,7 +24,7 @@
#ifndef CGAL_CARTESIAN_SEGMENT_3_H
#define CGAL_CARTESIAN_SEGMENT_3_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
#include <CGAL/Handle_for.h>
CGAL_BEGIN_NAMESPACE
@ -38,7 +38,7 @@ class SegmentC3
typedef typename R_::Line_3 Line_3;
typedef typename R_::Segment_3 Segment_3;
typedef Twotuple<Point_3> Rep;
typedef boost::array<Point_3, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -49,7 +49,7 @@ public:
SegmentC3() {}
SegmentC3(const Point_3 &sp, const Point_3 &ep)
: base(sp, ep) {}
: base(CGALi::make_array(sp, ep)) {}
bool has_on(const Point_3 &p) const;
bool collinear_has_on(const Point_3 &p) const;
@ -59,11 +59,11 @@ public:
const Point_3 & source() const
{
return get(base).e0;
return get(base)[0];
}
const Point_3 & target() const
{
return get(base).e1;
return get(base)[1];
}
const Point_3 & start() const;

View File

@ -24,7 +24,7 @@
#ifndef CGAL_ISO_CUBOIDH3_H
#define CGAL_ISO_CUBOIDH3_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
CGAL_BEGIN_NAMESPACE
@ -36,7 +36,7 @@ class Iso_cuboidH3
typedef typename R_::Point_3 Point_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef Twotuple<Point_3> Rep;
typedef boost::array<Point_3, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -47,7 +47,7 @@ public:
Iso_cuboidH3() {}
Iso_cuboidH3(const Point_3& p, const Point_3& q, int)
: base(p, q)
: base(CGALi::make_array(p, q))
{
CGAL_kernel_assertion(p.x()<=q.x());
CGAL_kernel_assertion(p.y()<=q.y());
@ -145,8 +145,8 @@ Iso_cuboidH3(const typename Iso_cuboidH3<R>::Point_3& p,
minz = q.hz()*p.hw();
maxz = p.hz()*q.hw();
}
base = Rep(Point_3(minx, miny, minz, minw),
Point_3(maxx, maxy, maxz, maxw));
base = Rep(CGALi::make_array(Point_3(minx, miny, minz, minw),
Point_3(maxx, maxy, maxz, maxw)));
}
template < class R >
@ -158,14 +158,14 @@ Iso_cuboidH3(const typename Iso_cuboidH3<R>::Point_3& left,
const typename Iso_cuboidH3<R>::Point_3& top,
const typename Iso_cuboidH3<R>::Point_3& far_,
const typename Iso_cuboidH3<R>::Point_3& close)
: base(Point_3(left.hx() * bottom.hw() * far_.hw(),
bottom.hy() * left.hw() * far_.hw(),
far_.hz() * left.hw() * bottom.hw(),
left.hw() * bottom.hw() * far_.hw()),
Point_3(right.hx() * top.hw() * close.hw(),
top.hy() * right.hw() * close.hw(),
close.hz() * right.hw() * top.hw(),
right.hw() * top.hw() * close.hw()))
: base(CGALi::make_array(Point_3(left.hx() * bottom.hw() * far_.hw(),
bottom.hy() * left.hw() * far_.hw(),
far_.hz() * left.hw() * bottom.hw(),
left.hw() * bottom.hw() * far_.hw()),
Point_3(right.hx() * top.hw() * close.hw(),
top.hy() * right.hw() * close.hw(),
close.hz() * right.hw() * top.hw(),
right.hw() * top.hw() * close.hw())))
{
CGAL_kernel_precondition(!less_x(right, left));
CGAL_kernel_precondition(!less_y(top, bottom));
@ -177,8 +177,8 @@ CGAL_KERNEL_LARGE_INLINE
Iso_cuboidH3<R>::
Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz)
: base(Point_3(min_hx, min_hy, min_hz, RT(1)),
Point_3(max_hx, max_hy, max_hz, RT(1)))
: base(CGALi::make_array(Point_3(min_hx, min_hy, min_hz, RT(1)),
Point_3(max_hx, max_hy, max_hz, RT(1))))
{}
template < class R >
@ -187,8 +187,8 @@ Iso_cuboidH3<R>::
Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz,
const RT& hw)
: base(Point_3(min_hx, min_hy, min_hz, hw),
Point_3(max_hx, max_hy, max_hz, hw))
: base(CGALi::make_array(Point_3(min_hx, min_hy, min_hz, hw),
Point_3(max_hx, max_hy, max_hz, hw)))
{}
template < class R >
@ -209,13 +209,13 @@ template < class R >
inline
const typename Iso_cuboidH3<R>::Point_3 &
Iso_cuboidH3<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ return get(base).e0; }
{ return get(base)[0]; }
template < class R >
inline
const typename Iso_cuboidH3<R>::Point_3 &
Iso_cuboidH3<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ return get(base).e1; }
{ return get(base)[1]; }
template < class R >
inline

View File

@ -24,7 +24,7 @@
#ifndef CGAL_ISO_RECTANGLEH2_H
#define CGAL_ISO_RECTANGLEH2_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
CGAL_BEGIN_NAMESPACE
@ -36,7 +36,7 @@ class Iso_rectangleH2
typedef typename R_::Point_2 Point_2;
typedef typename R_::Iso_rectangle_2 Iso_rectangle_2;
typedef Twotuple<Point_2> Rep;
typedef boost::array<Point_2, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -49,7 +49,7 @@ public:
Iso_rectangleH2() {}
Iso_rectangleH2(const Point_2& p, const Point_2& q, int)
: base(p, q)
: base(CGALi::make_array(p, q))
{
// I have to remove the assertions, because of Homogeneous_converter.
// CGAL_kernel_assertion(p.x()<=q.x());
@ -68,13 +68,13 @@ template < class R >
inline
const typename Iso_rectangleH2<R>::Point_2 &
Iso_rectangleH2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ return get(base).e0; }
{ return get(base)[0]; }
template < class R >
inline
const typename Iso_rectangleH2<R>::Point_2 &
Iso_rectangleH2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ return get(base).e1; }
{ return get(base)[1]; }
template < class R >
CGAL_KERNEL_INLINE

View File

@ -21,11 +21,10 @@
//
// Author(s) : Stefan Schirra
#ifndef CGAL_RAYH2_H
#define CGAL_RAYH2_H
#include <CGAL/Twotuple.h>
#include <CGAL/array.h>
CGAL_BEGIN_NAMESPACE
@ -39,7 +38,7 @@ class RayH2
typedef typename R_::Line_2 Line_2;
typedef typename R_::Vector_2 Vector_2;
typedef Twotuple<Point_2> Rep;
typedef boost::array<Point_2, 2> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -50,16 +49,16 @@ public:
RayH2() {}
RayH2( const Point_2& sp, const Point_2& secondp)
: base(sp, secondp) {}
: base(CGALi::make_array(sp, secondp)) {}
RayH2( const Point_2& sp, const Direction_2& d)
: base(sp, sp + d.to_vector()) {}
: base(CGALi::make_array(sp, sp + d.to_vector())) {}
RayH2( const Point_2& sp, const Vector_2& v)
: base(sp, sp + v) {}
: base(CGALi::make_array(sp, sp + v)) {}
RayH2( const Point_2& sp, const Line_2& l)
: base(sp, sp + l.to_vector()) {}
: base(CGALi::make_array(sp, sp + l.to_vector())) {}
bool operator==(const RayH2<R>& r) const;
bool operator!=(const RayH2<R>& r) const;
@ -86,7 +85,7 @@ template < class R >
inline
const typename RayH2<R>::Point_2 &
RayH2<R>::source() const
{ return get(base).e0; }
{ return get(base)[0]; }
template < class R >
inline
@ -118,7 +117,7 @@ const typename RayH2<R>::Point_2 &
RayH2<R>::second_point() const
{
CGAL_kernel_precondition( !is_degenerate() );
return get(base).e1;
return get(base)[1];
}
template < class R >
@ -175,7 +174,7 @@ template < class R >
CGAL_KERNEL_INLINE
bool
RayH2<R>::is_degenerate() const
{ return start() == get(base).e1; }
{ return start() == get(base)[1]; }
template < class R >
inline