diff --git a/Old_Packages/C3/changes.txt b/Old_Packages/C3/changes.txt index c647b6ba4b9..555a7f738ff 100644 --- a/Old_Packages/C3/changes.txt +++ b/Old_Packages/C3/changes.txt @@ -1,3 +1,9 @@ +Version 3.3.4 (September 16 1999) +- Use the new CGAL_CFG_TYPENAME_BUG +- Added Monique's predicate coplanar_orientation +- Fixed some missing std:: for cerr +- Avoid using in Tetrahedron_3.C + Version 3.3.3 (September 9 1999) - Renamed the script to spare the work for Geert-Jan (otherwise clash with C2) diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_3.C index 2396ddb80c6..c78a3000235 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -281,7 +281,7 @@ std::ostream &operator<<(std::ostream &os, CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_rep_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_rep_3.C index 7ba7ed86118..f6671584d67 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_rep_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Aff_transformation_rep_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -82,7 +82,7 @@ Aff_transformation_repC3::transpose() const CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Direction_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Direction_3.C index aa36eb91379..3001f7fca42 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Direction_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Direction_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -233,8 +233,8 @@ std::istream &operator>>(std::istream &is, DirectionC3 &p) read(is, z); break; default: - cerr << "" << std::endl; - cerr << "Stream must be in ascii or binary mode" << std::endl; + std::cerr << "" << std::endl; + std::cerr << "Stream must be in ascii or binary mode" << std::endl; break; } p = DirectionC3(x, y, z); @@ -244,7 +244,7 @@ std::istream &operator>>(std::istream &is, DirectionC3 &p) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Line_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Line_3.C index ac0d5bb0398..a01a9588046 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Line_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Line_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -241,7 +241,7 @@ std::istream &operator>>(std::istream &is, LineC3 &l) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Plane_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Plane_3.C index 1fb5eeb90df..0abada4e1bb 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Plane_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Plane_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -448,8 +448,8 @@ std::istream &operator>>(std::istream &is, PlaneC3 &p) read(is, d); break; default: - cerr << "" << std::endl; - cerr << "Stream must be in ascii or binary mode" << std::endl; + std::cerr << "" << std::endl; + std::cerr << "Stream must be in ascii or binary mode" << std::endl; break; } p = PlaneC3(a, b, c, d); @@ -460,7 +460,7 @@ std::istream &operator>>(std::istream &is, PlaneC3 &p) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Point_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Point_3.C index da21eb9d8cb..5e494e2bf16 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Point_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Point_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -286,8 +286,8 @@ std::istream &operator>>(std::istream &is, PointC3 &p) read(is, z); break; default: - cerr << "" << std::endl; - cerr << "Stream must be in ascii or binary mode" << std::endl; + std::cerr << "" << std::endl; + std::cerr << "Stream must be in ascii or binary mode" << std::endl; break; } p = PointC3(x, y, z); @@ -298,7 +298,7 @@ std::istream &operator>>(std::istream &is, PointC3 &p) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Ray_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Ray_3.C index ab1462955af..50dc05f66bb 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Ray_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Ray_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -249,7 +249,7 @@ std::istream &operator>>(std::istream &is, RayC3 &r) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Segment_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Segment_3.C index 946befd3b40..e00c48c06d8 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Segment_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Segment_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -273,7 +273,7 @@ collinear_has_on(const typename SegmentC3::Point_3 &p) const CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Sphere_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Sphere_3.C index 9490c13b4a4..44b324924dd 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Sphere_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Sphere_3.C @@ -26,7 +26,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -369,8 +369,8 @@ std::istream& operator>>(std::istream &is, SphereC3 &c) is >> o; break; default: - cerr << "" << std::endl; - cerr << "Stream must be in ascii or binary mode" << endl; + std::cerr << "" << std::endl; + std::cerr << "Stream must be in ascii or binary mode" << endl; break; } c = SphereC3(center, squared_radius, (Orientation)o); @@ -380,7 +380,7 @@ std::istream& operator>>(std::istream &is, SphereC3 &c) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Tetrahedron_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Tetrahedron_3.C index 8c8c265d7dc..491ee464ae4 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Tetrahedron_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Tetrahedron_3.C @@ -26,7 +26,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -34,7 +34,6 @@ #define CGAL_CARTESIAN_TETRAHEDRON_3_C #include -#include #include #include @@ -83,6 +82,22 @@ TetrahedronC3::operator=(const TetrahedronC3 &t) Handle::operator=(t); return *this; } + +template < class Point_3 > +struct Less_xyzC3 { + // cannot reuse it from predicate_classes, because of + // problems with file inclusions... + bool operator() (Point_3 const &p, Point_3 const &q) { + if (p.x() bool TetrahedronC3::operator==(const TetrahedronC3 &t) const @@ -97,8 +112,8 @@ TetrahedronC3::operator==(const TetrahedronC3 &t) cons int k; for ( k=0; k < 4; k++) V1.push_back( vertex(k)); for ( k=0; k < 4; k++) V2.push_back( t.vertex(k)); - std::sort(V1.begin(), V1.end(), Less_xyz< Point_3 >()); - std::sort(V2.begin(), V2.end(), Less_xyz< Point_3 >()); + std::sort(V1.begin(), V1.end(), Less_xyzC3()); + std::sort(V2.begin(), V2.end(), Less_xyzC3()); uniq_end1 = std::unique( V1.begin(), V1.end()); uniq_end2 = std::unique( V2.begin(), V2.end()); V1.erase( uniq_end1, V1.end()); @@ -126,7 +141,6 @@ template < class R > typename TetrahedronC3::Point_3 TetrahedronC3::vertex(int i) const { - // modulo 4 is a logical operation, hence cheap if (i<0) i=(i%4)+4; else if (i>3) i=i%4; switch (i) @@ -295,7 +309,7 @@ std::istream &operator>>(std::istream &is, TetrahedronC3 &t) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Triangle_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Triangle_3.C index 78835c74fc2..88f566e1f48 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Triangle_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Triangle_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -201,7 +201,7 @@ std::istream &operator>>(std::istream &is, TriangleC3 &t) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/Vector_3.C b/Old_Packages/C3/include/CGAL/Cartesian/Vector_3.C index 650089cf6a8..6d5bacb5d9b 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/Vector_3.C +++ b/Old_Packages/C3/include/CGAL/Cartesian/Vector_3.C @@ -25,7 +25,7 @@ #define CGAL_CTAG #endif -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #define typename #endif @@ -324,8 +324,8 @@ std::istream &operator>>(std::istream &is, VectorC3 &p) read(is, z); break; default: - cerr << "" << std::endl; - cerr << "Stream must be in ascii or binary mode" << std::endl; + std::cerr << "" << std::endl; + std::cerr << "Stream must be in ascii or binary mode" << std::endl; break; } p = VectorC3(x, y, z); @@ -335,7 +335,7 @@ std::istream &operator>>(std::istream &is, VectorC3 &p) CGAL_END_NAMESPACE -#ifdef _MSC_VER +#ifdef CGAL_CFG_TYPENAME_BUG #undef typename #endif diff --git a/Old_Packages/C3/include/CGAL/Cartesian/predicates_on_points_3.h b/Old_Packages/C3/include/CGAL/Cartesian/predicates_on_points_3.h index 8f6986bd7c8..d482de70488 100644 --- a/Old_Packages/C3/include/CGAL/Cartesian/predicates_on_points_3.h +++ b/Old_Packages/C3/include/CGAL/Cartesian/predicates_on_points_3.h @@ -147,9 +147,33 @@ coplanar(const PointC3 &p, const PointC3 &r, const PointC3 &s) { - return orientation(p, q, r, s) == COLLINEAR; + return orientation(p, q, r, s) == COPLANAR; } +template < class R > +inline +Orientation +coplanar_orientation(const PointC3 &q, + const PointC3 &r, + const PointC3 &s, + const PointC3 &p) +{ + // p,q,r,s supposed to be coplanar + // q,r,s supposed to be non collinear + // tests whether p is on the same side of q,r as s + // returns : + // COLLINEAR if pqr collinear + // POSITIVE if qrp and qrs have the same orientation + // NEGATIVE if qrp and qrs have opposite orientations + CGAL_kernel_exactness_precondition( ! collinear(q, r, s) ); + CGAL_kernel_exactness_precondition( coplanar(p, q, r, s) ); + return coplanar_orientationC3(q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + s.x(), s.y(), s.z(), + p.x(), p.y(), p.z()); +} + + template < class R> inline bool diff --git a/Old_Packages/C3/include/CGAL/predicates/kernel_ftC3.h b/Old_Packages/C3/include/CGAL/predicates/kernel_ftC3.h index c72623a398e..296b377ff07 100644 --- a/Old_Packages/C3/include/CGAL/predicates/kernel_ftC3.h +++ b/Old_Packages/C3/include/CGAL/predicates/kernel_ftC3.h @@ -29,6 +29,9 @@ #ifndef CGAL_DETERMINANT_H #include #endif // CGAL_DETERMINANT_H +#ifndef CGAL_PREDICATES_KERNEL_FTC2_H +#include +#endif // CGAL_PREDICATES_KERNEL_FTC2_H #ifndef CGAL_CONSTRUCTIONS_KERNEL_FTC3_H #include #endif // CGAL_CONSTRUCTIONS_KERNEL_FTC3_H @@ -81,6 +84,25 @@ orientationC3(const FT &px, const FT &py, const FT &pz, qz-pz,rz-pz,sz-pz)); } +template < class FT > +CGAL_KERNEL_MEDIUM_INLINE +Orientation +coplanar_orientationC3(const FT &qx, const FT &qy, const FT &qz, + const FT &rx, const FT &ry, const FT &rz, + const FT &sx, const FT &sy, const FT &sz, + const FT &px, const FT &py, const FT &pz) +{ + Orientation oxy_qrs = orientationC2(qx,qy,rx,ry,sx,sy); + if (oxy_qrs != COLLINEAR) + return Orientation( oxy_qrs * orientationC2(qx,qy,rx,ry,px,py)); + Orientation oyz_qrs = orientationC2(qy,qz,ry,rz,sy,sz); + if (oyz_qrs != COLLINEAR) + return Orientation( oyz_qrs * orientationC2(qy,qz,ry,rz,py,pz)); + Orientation oxz_qrs = orientationC2(qx,qz,rx,rz,sx,sz); + assert(oxz_qrs != COLLINEAR); + return Orientation( oxz_qrs * orientationC2(qx,qz,rx,rz,px,pz)); +} + template < class FT > CGAL_KERNEL_MEDIUM_INLINE bool diff --git a/Old_Packages/C3/test/Kernel/test_kernelC3.C b/Old_Packages/C3/test/Kernel/test_kernelC3.C index 486bccb2b5f..08f01152d0f 100644 --- a/Old_Packages/C3/test/Kernel/test_kernelC3.C +++ b/Old_Packages/C3/test/Kernel/test_kernelC3.C @@ -26,7 +26,7 @@ #endif // CGAL_BASIC_H #include #ifndef CGAL_CARTESIAN_H -#include +#include #endif // CGAL_CARTESIAN_H #include #include @@ -34,7 +34,7 @@ int main() { - typedef CGAL::Cartesian_3 Cls; + typedef CGAL::Cartesian Cls; cout << "Testing 3d with Cartesian :" << endl; _test_3( Cls() ); return 0; diff --git a/Old_Packages/C3/version b/Old_Packages/C3/version index bfcf71515c3..b4e8a1122f6 100644 --- a/Old_Packages/C3/version +++ b/Old_Packages/C3/version @@ -1 +1 @@ -3.3.3 ( 9 Sep 1999 ) +3.3.4 ( 17 Sep 1999 )