// Copyright (c) 2014 // INRIA Saclay-Ile de France (France) // // This file is part of CGAL (www.cgal.org) // // $URL: https://github.com/CGAL/cgal/blob/v5.1/NewKernel_d/include/CGAL/NewKernel_d/Coaffine.h $ // $Id: Coaffine.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // 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(int i : f.proj) o << i << ' '; o << "\nRest: "; for(int i : f.rest) 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