From 2f756b0af92db97d342d548d64f75441c0a540df Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Fri, 10 Nov 2000 16:17:22 +0000 Subject: [PATCH] - New file. --- .../include/CGAL/Simple_Cartesian_v2.h | 351 ++++++++++++++++++ 1 file changed, 351 insertions(+) create mode 100644 Packages/Cartesian_kernel/include/CGAL/Simple_Cartesian_v2.h diff --git a/Packages/Cartesian_kernel/include/CGAL/Simple_Cartesian_v2.h b/Packages/Cartesian_kernel/include/CGAL/Simple_Cartesian_v2.h new file mode 100644 index 00000000000..ed94605c0c1 --- /dev/null +++ b/Packages/Cartesian_kernel/include/CGAL/Simple_Cartesian_v2.h @@ -0,0 +1,351 @@ +// ====================================================================== +// +// Copyright (c) 2000 The CGAL Consortium +// +// This software and related documentation is part of an INTERNAL release +// of the Computational Geometry Algorithms Library (CGAL). It is not +// intended for general use. +// +// ---------------------------------------------------------------------- +// +// release : +// release_date : +// +// file : include/CGAL/Simple_Cartesian_v2.h +// revision : $Revision$ +// revision_date : $Date$ +// author(s) : Sylvain Pion +// coordinator : INRIA Sophia-Antipolis (Mariette.Yvinec@sophia.inria.fr) +// +// ====================================================================== + +#ifndef CGAL_SIMPLE_CARTESIAN_V2_H +#define CGAL_SIMPLE_CARTESIAN_V2_H + +#include +#include +#include + +#include +#include +#include + +#ifdef CGAL_CFG_NO_ADVANCED_KERNEL + // Because we cannot use Michael's scheme, we need the wrapper classes + // We include them (they are common to Cartesian and Homogeneous) +#include +#endif // CGAL_CFG_NO_ADVANCED_KERNEL + +// Same Rep class as ref-counted Cartesian ? +#define CGAL_REP_CLASS_DEFINED +#define CGAL_CARTESIAN_CLASS_DEFINED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +// #include +// #include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +// #include +// #include + +CGAL_BEGIN_NAMESPACE + +template< class R, class FT_ > +struct Simple_Cartesian_v2_base : + public Cartesian_base_dynamic_d +{ + typedef FT_ RT; + typedef FT_ FT; + typedef Cartesian_tag Rep_tag; + typedef Cartesian_tag Kernel_tag; + + // Maybe Cd should be merged like C2 and C3 ? + typedef Cartesian_base_dynamic_d Kernel_base_d; + + typedef CGAL::Object Object_2; + typedef CGAL::Object Object_3; + +#ifndef CGAL_CFG_NO_ADVANCED_KERNEL + typedef CGAL::Point_2 Point_2; + typedef CGAL::Vector_2 Vector_2; + typedef CGAL::Direction_2 Direction_2; + typedef CGAL::Segment_2 Segment_2; + typedef CGAL::Line_2 Line_2; + typedef CGAL::Ray_2 Ray_2; + typedef CGAL::Triangle_2 Triangle_2; + typedef CGAL::Circle_2 Circle_2; + typedef CGAL::Iso_rectangle_2 Iso_rectangle_2; + typedef CGAL::Aff_transformation_2 Aff_transformation_2; + typedef CGAL::Data_accessor_2 Data_accessor_2; + typedef CGAL::ConicCPA2 Conic_2; + + typedef CGAL::Point_3 Point_3; + typedef CGAL::Vector_3 Vector_3; + typedef CGAL::Direction_3 Direction_3; + typedef CGAL::Line_3 Line_3; + typedef CGAL::Plane_3 Plane_3; + typedef CGAL::Ray_3 Ray_3; + typedef CGAL::Segment_3 Segment_3; + typedef CGAL::Triangle_3 Triangle_3; + typedef CGAL::Tetrahedron_3 Tetrahedron_3; + typedef CGAL::Iso_cuboid_3 Iso_cuboid_3; + typedef CGAL::Sphere_3 Sphere_3; + typedef CGAL::Aff_transformation_3 Aff_transformation_3; +#else + typedef PointC2 Point_2; + typedef VectorC2 Vector_2; + typedef DirectionC2 Direction_2; + typedef SegmentC2 Segment_2; + typedef LineC2 Line_2; + typedef RayC2 Ray_2; + typedef TriangleC2 Triangle_2; + typedef CircleC2 Circle_2; + typedef Iso_rectangleC2 Iso_rectangle_2; + typedef Aff_transformationC2 Aff_transformation_2; + typedef Data_accessorC2 Data_accessor_2; + typedef ConicCPA2 Conic_2; + + typedef PointC3 Point_3; + typedef VectorC3 Vector_3; + typedef DirectionC3 Direction_3; + typedef LineC3 Line_3; + typedef PlaneC3 Plane_3; + typedef RayC3 Ray_3; + typedef SegmentC3 Segment_3; + typedef TriangleC3 Triangle_3; + typedef TetrahedronC3 Tetrahedron_3; + typedef Iso_cuboidC3 Iso_cuboid_3; + typedef SphereC3 Sphere_3; + typedef Aff_transformationC3 Aff_transformation_3; +#endif // CGAL_CFG_NO_ADVANCED_KERNEL + + typedef typename Kernel_base_d::Point_d Point_d; + + // The typedefs that allow to specify the representation and the handle + // of each type. + typedef CGAL::Simple_Twotuple Point_ref_2; + typedef CGAL::Simple_Twotuple Vector_ref_2; + typedef CGAL::Simple_Twotuple Direction_ref_2; + typedef CGAL::Simple_Threetuple Line_ref_2; + typedef CGAL::Simple_Twotuple Ray_ref_2; + typedef CGAL::Simple_Twotuple Segment_ref_2; + typedef CGAL::Circle_repC2 Circle_ref_2; + typedef CGAL::Simple_Threetuple Triangle_ref_2; + typedef CGAL::Simple_Twotuple Iso_rectangle_ref_2; + + typedef CGAL::Simple_Threetuple Point_ref_3; + typedef CGAL::Simple_Threetuple Vector_ref_3; + typedef CGAL::Simple_Threetuple Direction_ref_3; + typedef CGAL::Line_repC3 Line_ref_3; + typedef CGAL::Simple_Fourtuple Plane_ref_3; + typedef CGAL::Simple_Twotuple Ray_ref_3; + typedef CGAL::Simple_Twotuple Segment_ref_3; + typedef CGAL::Sphere_repC3 Sphere_ref_3; + typedef CGAL::Simple_Threetuple Triangle_ref_3; + typedef CGAL::Simple_Fourtuple Tetrahedron_ref_3; + typedef CGAL::Simple_Twotuple Iso_cuboid_ref_3; + + typedef CGAL::Simple_Handle_for Point_handle_2; + typedef CGAL::Simple_Handle_for Vector_handle_2; + typedef CGAL::Simple_Handle_for Direction_handle_2; + typedef CGAL::Simple_Handle_for Line_handle_2; + typedef CGAL::Simple_Handle_for Ray_handle_2; + typedef CGAL::Simple_Handle_for Segment_handle_2; + typedef CGAL::Simple_Handle_for Circle_handle_2; + typedef CGAL::Simple_Handle_for Triangle_handle_2; + typedef CGAL::Simple_Handle_for Iso_rectangle_handle_2; + + typedef CGAL::Simple_Handle_for Point_handle_3; + typedef CGAL::Simple_Handle_for Vector_handle_3; + typedef CGAL::Simple_Handle_for Direction_handle_3; + typedef CGAL::Simple_Handle_for Line_handle_3; + typedef CGAL::Simple_Handle_for Plane_handle_3; + typedef CGAL::Simple_Handle_for Ray_handle_3; + typedef CGAL::Simple_Handle_for Segment_handle_3; + typedef CGAL::Simple_Handle_for Sphere_handle_3; + typedef CGAL::Simple_Handle_for Triangle_handle_3; + typedef CGAL::Simple_Handle_for Tetrahedron_handle_3; + typedef CGAL::Simple_Handle_for Iso_cuboid_handle_3; +}; + + +template< class FT_ > +struct Simple_Cartesian_v2 + : public Simple_Cartesian_v2_base< Simple_Cartesian_v2, FT_ > +{ + // Number types and representation tag (to avoid ambiguity) + typedef FT_ RT; + typedef FT_ FT; + typedef Cartesian_tag Rep_tag; + typedef Cartesian_tag Kernel_tag; + + typedef Simple_Cartesian_v2 Self; + typedef Simple_Cartesian_v2_base Kernel_base; + + typedef typename Kernel_base::Object_2 Object_2; + typedef typename Kernel_base::Object_3 Object_3; + + +#ifndef CGAL_CFG_NO_ADVANCED_KERNEL + // The other classes are inherited and because of partial specialization, + // Cartesian::Point_2 is exactly CGAL::Point_2< Cartesian > + + // All the classes are inherited, but because we inherit from a + // template parameter, we need to explicitly write the inheritance + // (see mail from Michael Hoffmann of July 28th 1999 in cgal-develop) + + typedef typename Kernel_base::Point_2 Point_2; + typedef typename Kernel_base::Vector_2 Vector_2; + typedef typename Kernel_base::Direction_2 Direction_2; + typedef typename Kernel_base::Segment_2 Segment_2; + typedef typename Kernel_base::Line_2 Line_2; + typedef typename Kernel_base::Ray_2 Ray_2; + typedef typename Kernel_base::Triangle_2 Triangle_2; + typedef typename Kernel_base::Circle_2 Circle_2; + typedef typename Kernel_base::Iso_rectangle_2 Iso_rectangle_2; + typedef typename Kernel_base::Aff_transformation_2 Aff_transformation_2; + + typedef typename Kernel_base::Data_accessor_2 Data_accessor_2; + typedef typename Kernel_base::Conic_2 Conic_2; + + typedef typename Kernel_base::Point_3 Point_3; + typedef typename Kernel_base::Vector_3 Vector_3; + typedef typename Kernel_base::Direction_3 Direction_3; + typedef typename Kernel_base::Line_3 Line_3; + typedef typename Kernel_base::Plane_3 Plane_3; + typedef typename Kernel_base::Ray_3 Ray_3; + typedef typename Kernel_base::Segment_3 Segment_3; + typedef typename Kernel_base::Triangle_3 Triangle_3; + typedef typename Kernel_base::Tetrahedron_3 Tetrahedron_3; + typedef typename Kernel_base::Sphere_3 Sphere_3; + typedef typename Kernel_base::Iso_cuboid_3 Iso_cuboid_3; + typedef typename Kernel_base::Aff_transformation_3 Aff_transformation_3; + + typedef typename Kernel_base::Point_d Point_d; + +#else + // Now CGAL::Point_2 is only a wrapper around CGAL::PointC2 + // It is necessary to redefine here the classes to ensure that + // Cartesian::Point_2 is exactly CGAL::Point_2< Cartesian > + + // Cartesian::Base is needed so that CGAL::Point_2< Cartesian > + // can inherit from Cartesian::Point_2_base + + typedef typename Kernel_base::Point_2 Point_2_base; + typedef typename Kernel_base::Vector_2 Vector_2_base; + typedef typename Kernel_base::Direction_2 Direction_2_base; + typedef typename Kernel_base::Segment_2 Segment_2_base; + typedef typename Kernel_base::Line_2 Line_2_base; + typedef typename Kernel_base::Ray_2 Ray_2_base; + typedef typename Kernel_base::Triangle_2 Triangle_2_base; + typedef typename Kernel_base::Circle_2 Circle_2_base; + typedef typename Kernel_base::Iso_rectangle_2 Iso_rectangle_2_base; + typedef typename Kernel_base::Aff_transformation_2 + Aff_transformation_2_base; + + typedef typename Kernel_base::Point_3 Point_3_base; + typedef typename Kernel_base::Vector_3 Vector_3_base; + typedef typename Kernel_base::Direction_3 Direction_3_base; + typedef typename Kernel_base::Line_3 Line_3_base; + typedef typename Kernel_base::Plane_3 Plane_3_base; + typedef typename Kernel_base::Ray_3 Ray_3_base; + typedef typename Kernel_base::Segment_3 Segment_3_base; + typedef typename Kernel_base::Triangle_3 Triangle_3_base; + typedef typename Kernel_base::Tetrahedron_3 Tetrahedron_3_base; + typedef typename Kernel_base::Sphere_3 Sphere_3_base; + typedef typename Kernel_base::Iso_cuboid_3 Iso_cuboid_3_base; + typedef typename Kernel_base::Aff_transformation_3 + Aff_transformation_3_base; + + typedef typename Kernel_base::Point_d Point_d_base; + + // Note: necessary to qualify Point_2 by CGAL:: to disambiguate between + // Point_2 in the current namespace (nested within CGAL) and + // CGAL::Point_2< Cartesian > (which is in the CGAL namespace) + + typedef CGAL::Point_2 Point_2; + typedef CGAL::Vector_2 Vector_2; + typedef CGAL::Direction_2 Direction_2; + typedef CGAL::Line_2 Line_2; + typedef CGAL::Ray_2 Ray_2; + typedef CGAL::Segment_2 Segment_2; + typedef CGAL::Triangle_2 Triangle_2; + typedef CGAL::Circle_2 Circle_2; + typedef CGAL::Iso_rectangle_2 Iso_rectangle_2; + typedef CGAL::Aff_transformation_2 Aff_transformation_2; + + typedef Data_accessorC2 Data_accessor_2; + typedef ConicCPA2 Conic_2; + + typedef CGAL::Point_3 Point_3; + typedef CGAL::Vector_3 Vector_3; + typedef CGAL::Direction_3 Direction_3; + typedef CGAL::Line_3 Line_3; + typedef CGAL::Plane_3 Plane_3; + typedef CGAL::Ray_3 Ray_3; + typedef CGAL::Segment_3 Segment_3; + typedef CGAL::Triangle_3 Triangle_3; + typedef CGAL::Tetrahedron_3 Tetrahedron_3; + typedef CGAL::Sphere_3 Sphere_3; + typedef CGAL::Iso_cuboid_3 Iso_cuboid_3; + typedef CGAL::Aff_transformation_3 Aff_transformation_3; + + typedef CGAL::Point_d Point_d; + +#endif // CGAL_CFG_NO_ADVANCED_KERNEL + + // TODO: cleanup + static FT make_FT(const RT & num, const RT& denom) { return num/denom;} + static FT make_FT(const RT & num) { return num;} + static RT FT_numerator(const FT &r) { return r;} + static RT FT_denominator(const FT &) { return RT(1);} + +#include + +}; + +CGAL_END_NAMESPACE + +#include + +#endif // CGAL_SIMPLE_CARTESIAN_V2_H