// Copyright (c) 2014 // INRIA Saclay-Ile de France (France) // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 3 of the License, // or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ // // Author(s) : Marc Glisse #ifndef CGAL_KD_COAFFINE_H #define CGAL_KD_COAFFINE_H #include #include #include #include #include namespace CGAL { namespace CartesianDKernelFunctors { struct Flat_orientation { std::vector proj; std::vector rest; bool reverse; }; // For debugging purposes inline std::ostream& operator<< (std::ostream& o, Flat_orientation const& f) { o << "Proj: "; for(std::vector::const_iterator i=f.proj.begin(); i!=f.proj.end(); ++i) o << *i << ' '; o << "\nRest: "; for(std::vector::const_iterator i=f.rest.begin(); i!=f.rest.end(); ++i) o << *i << ' '; o << "\nInv: " << f.reverse; return o << '\n'; } namespace internal { namespace coaffine { template inline void debug_matrix(std::ostream& o, Mat const&mat) { for(int i=0;i struct Construct_flat_orientation : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Construct_flat_orientation) typedef R_ R; typedef typename Get_type::type FT; typedef typename Get_type::type Point; typedef typename Increment_dimension::type Dplusone; typedef typename R::LA::template Rebind_dimension::Other LA; typedef typename LA::Square_matrix Matrix; typedef typename Get_functor::type CCC; typedef typename Get_functor::type PD; typedef Flat_orientation result_type; // This implementation is going to suck. Maybe we should push the // functionality into LA. And we should check (in debug mode) that // the points are affinely independent. template result_type operator()(Iter f, Iter e)const{ Iter f_save = f; PD pd (this->kernel()); CCC ccc (this->kernel()); int dim = pd(*f); Matrix coord (dim+1, dim+1); // use distance(f,e)? This matrix doesn't need to be square. int col = 0; Flat_orientation o; std::vector& proj=o.proj; std::vector& rest=o.rest; rest.reserve(dim+1); for(int i=0; i