// ============================================================================ // // Copyright (c) 1997-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 : $CGAL_Revision: CGAL-I $ // release_date : $CGAL_Date$ // // file : include/CGAL/Optimisation/Construct_point_2.h // package : $CGAL_Package: Optimisation_basic $ // // revision : $Revision$ // revision_date : $Date$ // // author(s) : Sven Schönherr // coordinator : ETH Zürich (Bernd Gärtner ) // // implementation: 2D construction `point' // ============================================================================ #ifndef CGAL_OPTIMISATION_CONSTRUCT_POINT_2_H #define CGAL_OPTIMISATION_CONSTRUCT_POINT_2_H // includes #ifndef CGAL_POINT_2_H # include #endif #ifndef CGAL_PROTECT_VECTOR # include # define CGAL_PROTECT_VECTOR #endif #ifndef CGAL_PROTECT_FUNCTIONAL # include # define CGAL_PROTECT_FUNCTIONAL #endif #ifndef CGAL_PROTECT_ITERATOR # include # define CGAL_PROTECT_ITERATOR #endif CGAL_BEGIN_NAMESPACE // Class declaration // ================= template < class R > class Construct_point_2; // Class interface // =============== template < class R_ > class Construct_point_2 { public: // self typedef R_ R; typedef Construct_point_2 Self; // types typedef typename R::Point_2 Point; // creation Construct_point_2( ) { } // operations template < class InputIterator > Point operator() ( int, InputIterator first, InputIterator last) const { std::vector coords; std::copy( first, last, std::back_inserter( coords)); if ( coords.size() < 3) { return Point( coords[ 0], coords[ 1]); } else { return Point( coords[ 0], coords[ 1], coords[ 2]); } } }; CGAL_END_NAMESPACE #endif // CGAL_OPTIMISATION_CONSTRUCT_POINT_2_H // ===== EOF ==================================================================