// ====================================================================== // // Copyright (c) 2000,2001 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.h // revision : $Revision$ // revision_date : $Date$ // author(s) : Sylvain Pion // coordinator : INRIA Sophia-Antipolis (Mariette.Yvinec@sophia.inria.fr) // // ====================================================================== #ifndef CGAL_SIMPLE_CARTESIAN_H #define CGAL_SIMPLE_CARTESIAN_H // Same Rep class as ref-counted Cartesian ? #define CGAL_REP_CLASS_DEFINED #define CGAL_CARTESIAN_CLASS_DEFINED #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 #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_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 handle of each type. 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::Handle Aff_transformation_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; typedef CGAL::Handle Aff_transformation_handle_3; }; template< class FT_ > struct Simple_cartesian : public Simple_cartesian_base< Simple_cartesian, 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 Self; typedef Simple_cartesian_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 typedef typename Kernel_base::Point_handle_2 Point_handle_2; typedef typename Kernel_base::Vector_handle_2 Vector_handle_2; typedef typename Kernel_base::Direction_handle_2 Direction_handle_2; typedef typename Kernel_base::Line_handle_2 Line_handle_2; typedef typename Kernel_base::Ray_handle_2 Ray_handle_2; typedef typename Kernel_base::Segment_handle_2 Segment_handle_2; typedef typename Kernel_base::Circle_handle_2 Circle_handle_2; typedef typename Kernel_base::Triangle_handle_2 Triangle_handle_2; typedef typename Kernel_base::Iso_rectangle_handle_2 Iso_rectangle_handle_2; typedef typename Kernel_base::Aff_transformation_handle_2 Aff_transformation_handle_2; typedef typename Kernel_base::Point_handle_3 Point_handle_3; typedef typename Kernel_base::Vector_handle_3 Vector_handle_3; typedef typename Kernel_base::Direction_handle_3 Direction_handle_3; typedef typename Kernel_base::Line_handle_3 Line_handle_3; typedef typename Kernel_base::Plane_handle_3 Plane_handle_3; typedef typename Kernel_base::Ray_handle_3 Ray_handle_3; typedef typename Kernel_base::Segment_handle_3 Segment_handle_3; typedef typename Kernel_base::Sphere_handle_3 Sphere_handle_3; typedef typename Kernel_base::Triangle_handle_3 Triangle_handle_3; typedef typename Kernel_base::Tetrahedron_handle_3 Tetrahedron_handle_3; typedef typename Kernel_base::Iso_cuboid_handle_3 Iso_cuboid_handle_3; typedef typename Kernel_base::Aff_transformation_handle_3 Aff_transformation_handle_3; // 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_H