- Got rid of the various new_rep().

This commit is contained in:
Sylvain Pion 2000-10-12 17:26:03 +00:00
parent 187d0166ef
commit 495dde3c7f
5 changed files with 42 additions and 148 deletions

View File

@ -6,18 +6,22 @@ Stuff to look at, as time permits:
- It must have the same interface than Handle_for<>
- Must use the allocator, see Stefan's mail.
- Aff_tranformations can't use Handle_for<> yet.
- Replace ptr by ptr() ?
- Provide dummy_Handle_for<>.
*** Before submitting : check the test-suite on M$, especially for
CGAL_TYPENAME_BUG stuff...
- What's this new_rep() ?
- LineC3 stores a Twotuple<Point_3>, but the second point is in fact a vector,
the direction of the line. It's dirty, and should be changed to match
LineH3 which is cleaner.
- Finish merging .C files in corresponding .h files.
- Write a Checker for full kernels, like Pm_traits_checker.h ?
- Use CGAL_TYPENAME_MSVC_NULL instead of "#define typename".
Only in the template parameters, right ?
- Rename CGAL_CFG_NO_ADVANCED_KERNEL to CGAL_USE_ADVANCED_KERNEL, definable on
the command line, and not in config.h...
- Merging Cartesian and SimpleCartesian : mail to Stefan [+ the list ?]
- Merging Cartesian and SimpleCartesian :
Currently, there are 10000 lines of code in SimpleCartesian kernel, mostly
copy-pasted and adapted from the Cartesian kernel. This is evil in itself
from the maintainance point of view. I think only the low level (FT-based)
@ -50,6 +54,7 @@ Stuff to look at, as time permits:
PointC2 : public R::Handled_Point_2
And similarly for SimpleCartesian.
Try it...
This will allow to pass an Allocator parameter via the kernel traits.
- ::bbox() robustness issues : it's not robust, since basically, we use
to_double().
The homogeneous kernel uses an epsilon to get this right, in the case
@ -133,6 +138,7 @@ Stuff to look at, as time permits:
Why do Point.x(), y(), hx(), hy(), hw() return FT instead of a "const FT &" ?
- Status of the scripts create_symlinks and remove_symlinks ?
- Status of the test/ directories in the old C2, C3, Cartesian_basic ?
What's in it ? Should it be kept or thrown ?
- include/CGAL/smallest_radiusC2.h should use the kernel code.
Check if it's ok (correct and as efficient), and tell Frank to do so.
The name of this file doesn't have anything to do with what is inside anyway.

View File

@ -10,7 +10,7 @@ Version 6.0 (?? ????? 00)
- Call identical() in all operator==() in order to be consistent.
- Sphere_3 is back to life.
- Ctors don't use "new (static_cast<void *> (ptr)) ...", but proper
construction via the Handle_for.
construction via the Handle_for. Got rid of the various new_rep().
- Various cleanups.
--- CGAL 2.2 is out ---

View File

@ -108,10 +108,6 @@ public:
bool is_degenerate() const;
Self transform(const Aff_transformation_2 &t) const;
private:
void new_rep(const Point_2 &p, const Point_2 &q);
void new_rep(const FT &a, const FT &b, const FT &c);
};
template < class R >
@ -119,70 +115,39 @@ CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2()
: Handle_for<Threetuple<FT> >( Threetuple<FT>() ) {}
template < class R >
CGAL_KERNEL_INLINE
void
LineC2<R CGAL_CTAG>::new_rep(const typename LineC2<R CGAL_CTAG>::FT &a,
const typename LineC2<R CGAL_CTAG>::FT &b,
const typename LineC2<R CGAL_CTAG>::FT &c)
{
new ( static_cast< void*>(ptr)) Threetuple<FT>(a, b, c);
}
template < class R >
CGAL_KERNEL_INLINE
void
LineC2<R CGAL_CTAG>::new_rep(const typename LineC2<R CGAL_CTAG>::Point_2 &p,
const typename LineC2<R CGAL_CTAG>::Point_2 &q)
{
LineC2<R CGAL_CTAG> l = line_from_points(p,q);
new_rep(l.a(), l.b(), l.c());
}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const LineC2<R CGAL_CTAG> &l)
LineC2<R CGAL_CTAG>::LineC2(const LineC2<R CGAL_CTAG> &l)
: Handle_for<Threetuple<FT> >(l) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const typename LineC2<R CGAL_CTAG>::Point_2 &p,
const typename LineC2<R CGAL_CTAG>::Point_2 &q)
{
new_rep(p,q);
}
: Handle_for<Threetuple<FT> >( line_from_points(p, q) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const typename LineC2<R CGAL_CTAG>::FT &a,
const typename LineC2<R CGAL_CTAG>::FT &b,
const typename LineC2<R CGAL_CTAG>::FT &c)
{
new_rep(a, b, c);
}
: Handle_for<Threetuple<FT> >( Threetuple<FT>(a, b, c) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const typename LineC2<R CGAL_CTAG>::Segment_2 &s)
{
new_rep(s.source(), s.target());
}
: Handle_for<Threetuple<FT> >( line_from_points(s.source(), s.target()) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const typename LineC2<R CGAL_CTAG>::Ray_2 &r)
{
new_rep(r.point(0), r.point(1));
}
: Handle_for<Threetuple<FT> >( line_from_points(r.point(0), r.point(1)) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC2<R CGAL_CTAG>::LineC2(const typename LineC2<R CGAL_CTAG>::Point_2 &p,
const typename LineC2<R CGAL_CTAG>::Direction_2 &d)
{
LineC2<R CGAL_CTAG> l = line_from_point_direction(p,d);
new_rep(l.a(), l.b(), l.c());
}
: Handle_for<Threetuple<FT> >( line_from_point_direction(p,d) ) {}
template < class R >
CGAL_KERNEL_MEDIUM_INLINE

View File

@ -85,22 +85,8 @@ public:
bool is_degenerate() const;
Self transform(const Aff_transformation_3 &t) const;
private:
void new_rep(const Point_3 &p, const Vector_3 &v);
};
template < class R >
inline
void
LineC3<R CGAL_CTAG>::
new_rep(const typename LineC3<R CGAL_CTAG>::Point_3 &p,
const typename LineC3<R CGAL_CTAG>::Vector_3 &v)
{
// CGAL_kernel_precondition( v != NULL_VECTOR );
new ( static_cast< void*>(ptr)) Twotuple<typename R::Point_3 > (p, ORIGIN+v);
}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC3<R CGAL_CTAG>::LineC3()
@ -113,37 +99,26 @@ LineC3<R CGAL_CTAG>::LineC3(const LineC3<R CGAL_CTAG> &l)
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC3<R CGAL_CTAG>::
LineC3(const typename LineC3<R CGAL_CTAG>::Point_3 &p,
const typename LineC3<R CGAL_CTAG>::Point_3 &q)
{
new_rep(p, q-p);
}
LineC3<R CGAL_CTAG>::LineC3(const typename LineC3<R CGAL_CTAG>::Point_3 &p,
const typename LineC3<R CGAL_CTAG>::Point_3 &q)
: Handle_for<Twotuple<typename R::Point_3 > >( Twotuple<typename R::Point_3>(p, ORIGIN+(q-p)) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC3<R CGAL_CTAG>::
LineC3(const typename LineC3<R CGAL_CTAG>::Segment_3 &s)
{
new_rep(s.start(), s.end() - s.start());
}
LineC3<R CGAL_CTAG>::LineC3(const typename LineC3<R CGAL_CTAG>::Segment_3 &s)
: Handle_for<Twotuple<typename R::Point_3 > >( Twotuple<typename R::Point_3>(s.start(), ORIGIN+(s.end() - s.start()))) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC3<R CGAL_CTAG>::
LineC3(const typename LineC3<R CGAL_CTAG>::Ray_3 &r)
{
new_rep(r.start(), r.point(1) - r.start());
}
LineC3<R CGAL_CTAG>::LineC3(const typename LineC3<R CGAL_CTAG>::Ray_3 &r)
: Handle_for<Twotuple<typename R::Point_3 > >( Twotuple<typename R::Point_3>(r.start(), ORIGIN+( r.point(1) - r.start()))) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
LineC3<R CGAL_CTAG>::
LineC3(const typename LineC3<R CGAL_CTAG>::Point_3 &p,
const typename LineC3<R CGAL_CTAG>::Direction_3 &d)
{
new_rep(p, d.to_vector());
}
: Handle_for<Twotuple<typename R::Point_3 > >( Twotuple<typename R::Point_3>(p, ORIGIN+d.to_vector())) {}
template < class R >
inline
@ -165,8 +140,7 @@ LineC3<R CGAL_CTAG>::operator!=(const LineC3<R CGAL_CTAG> &l) const
template < class R >
inline
typename LineC3<R CGAL_CTAG>::Direction_3
LineC3<R CGAL_CTAG>::
direction() const
LineC3<R CGAL_CTAG>::direction() const
{
return ((ptr->e1) - ORIGIN).direction();
}
@ -174,8 +148,7 @@ direction() const
template < class R >
inline
typename LineC3<R CGAL_CTAG>::Point_3
LineC3<R CGAL_CTAG>::
point(int i) const
LineC3<R CGAL_CTAG>::point(int i) const
{
return point_on_line(i,*this);
}
@ -192,8 +165,7 @@ perpendicular_plane(const typename LineC3<R CGAL_CTAG>::Point_3 &p) const
template < class R >
inline
LineC3<R CGAL_CTAG>
LineC3<R CGAL_CTAG>::
opposite() const
LineC3<R CGAL_CTAG>::opposite() const
{
return LineC3<R CGAL_CTAG>(point(), -direction());
}
@ -210,8 +182,7 @@ projection(const typename LineC3<R CGAL_CTAG>::Point_3 &p) const
template < class R >
inline
bool
LineC3<R CGAL_CTAG>::
has_on(const typename LineC3<R CGAL_CTAG>::Point_3 &p) const
LineC3<R CGAL_CTAG>::has_on(const typename LineC3<R CGAL_CTAG>::Point_3 &p) const
{
return collinear(point(), point()+direction().to_vector(), p);
}

View File

@ -115,38 +115,8 @@ public:
bool has_on(const Point_3 &p) const;
bool is_degenerate() const;
private:
void new_rep(const Point_3 &p,
const Point_3 &q,
const Point_3 &r);
void new_rep(const FT &a, const FT &b,
const FT &c, const FT &d);
};
template < class R >
inline
void
PlaneC3<R CGAL_CTAG>::
new_rep(const typename PlaneC3<R CGAL_CTAG>::FT &a,
const typename PlaneC3<R CGAL_CTAG>::FT &b,
const typename PlaneC3<R CGAL_CTAG>::FT &c,
const typename PlaneC3<R CGAL_CTAG>::FT &d)
{
new ( static_cast< void*>(ptr)) Fourtuple<FT>(a, b, c, d);
}
template < class R >
inline
void
PlaneC3<R CGAL_CTAG>::new_rep(const typename PlaneC3<R CGAL_CTAG>::Point_3 &p,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &q,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &r)
{
PlaneC3<R CGAL_CTAG> h = plane_from_points(p,q,r);
new_rep(h.a(), h.b(), h.c(), h.d());
}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::PlaneC3()
@ -157,74 +127,57 @@ CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::PlaneC3(const PlaneC3<R CGAL_CTAG> &p)
: Handle_for<Fourtuple<FT> >(p) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::FT &a,
const typename PlaneC3<R CGAL_CTAG>::FT &b,
const typename PlaneC3<R CGAL_CTAG>::FT &c,
const typename PlaneC3<R CGAL_CTAG>::FT &d)
: Handle_for<Fourtuple<FT> >( Fourtuple<FT>(a, b, c, d) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Point_3 &p,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &q,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &r)
{
new_rep(p, q, r);
}
: Handle_for<Fourtuple<FT> >( plane_from_points(p, q, r) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Point_3 &p,
const typename PlaneC3<R CGAL_CTAG>::Direction_3 &d)
{
PlaneC3<R CGAL_CTAG> h = plane_from_point_direction(p,d);
new_rep(h.a(), h.b(), h.c(), h.d());
}
: Handle_for<Fourtuple<FT> >( plane_from_point_direction(p, d) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Point_3 &p,
const typename PlaneC3<R CGAL_CTAG>::Vector_3 &v)
{
FT a, b, c, d;
plane_from_point_directionC3(p.x(),p.y(),p.z(),v.x(),v.y(),v.z(),a,b,c,d);
new_rep(a, b, c, d);
}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::FT &a,
const typename PlaneC3<R CGAL_CTAG>::FT &b,
const typename PlaneC3<R CGAL_CTAG>::FT &c,
const typename PlaneC3<R CGAL_CTAG>::FT &d)
{
new_rep(a, b, c, d);
}
: Handle_for<Fourtuple<FT> >( plane_from_point_direction(p, v.direction()) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Line_3 &l,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &p)
{
new_rep(l.point(), l.point()+l.direction().to_vector(), p);
}
: Handle_for<Fourtuple<FT> >( plane_from_points( l.point(), l.point()+l.direction().to_vector(), p)) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Segment_3 &s,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &p)
{
new_rep(s.start(), s.end(), p);
}
: Handle_for<Fourtuple<FT> >( plane_from_points( s.start(), s.end(), p) ) {}
template < class R >
CGAL_KERNEL_CTOR_INLINE
PlaneC3<R CGAL_CTAG>::
PlaneC3(const typename PlaneC3<R CGAL_CTAG>::Ray_3 &r,
const typename PlaneC3<R CGAL_CTAG>::Point_3 &p)
{
new_rep(r.start(), r.second_point(), p);
}
: Handle_for<Fourtuple<FT> >( plane_from_points( r.start(), r.second_point(), p) ) {}
template < class R >
CGAL_KERNEL_INLINE
@ -234,7 +187,6 @@ PlaneC3<R CGAL_CTAG>::operator==(const PlaneC3<R CGAL_CTAG> &p) const
if ( identical(p) ) return true;
return has_on_boundary(p.point()) &&
(orthogonal_direction() == p.orthogonal_direction());
}
template < class R >