// Copyright (c) 2021 GeometryFactory Sarl // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Andreas Fabri #ifndef CGAL_INDEXED_TRIANGLE_SET_H #define CGAL_INDEXED_TRIANGLE_SET_H #include #include #include #include #include namespace CGAL { template struct Indexed_triangle_set { std::vector

vertices; std::vector > faces; }; template void make_tetrahedron(const P& p0, const P&p1, const P& p2, const P& p3, Indexed_triangle_set

& its) { CGAL_assertion(its.vertices.empty()); its.vertices = {p0, p1, p2, p3}; its.faces = { {0, 1, 2}, {1, 0, 3}, {3, 0, 2}, {2, 1, 3} }; } template void clear(Indexed_triangle_set

& its) { its.vertices.clear(); its.faces.clear(); } template std::ostream& operator<<(std::ostream& os, const Indexed_triangle_set

& its) { os << "OFF\n"; os << its.vertices.size() << " " << its.faces.size() << " \n"; for(const P& p : its.vertices){ os << p << "\n"; } for(const std::array f : its.faces){ os << f[0] << " "<< f[1] << " "<< f[2] << "\n"; } os << std::flush; return os; } namespace Convex_hull_3 { namespace internal { template void add_isolated_points(const P& point, Indexed_triangle_set

& its) { its.vertices.push_back(point); } template void copy_ch2_to_face_graph(const std::list

& CH_2, Indexed_triangle_set

& its) { std::cout << "copy_ch2_to_face_graph" << std::endl; } template void copy_face_graph(const TDS& tds, Indexed_triangle_set

& its) { typedef typename TDS::Vertex_iterator Vertex_iterator; typedef typename TDS::Face_iterator Face_iterator; int i = 0; its.vertices.reserve(tds.number_of_vertices()); its.faces.reserve(tds.number_of_faces()); for(Vertex_iterator vit = tds.vertices_begin(); vit != tds.vertices_end(); ++vit){ its.vertices.push_back(vit->point()); vit->info() = i++; } for (Face_iterator fit = tds.faces_begin(); fit != tds.faces_end(); ++fit) { its.faces.push_back({fit->vertex(0)->info(), fit->vertex(1)->info(), fit->vertex(2)->info()}); } } } } } // namespace CGAL namespace boost { // this partial specialization is needed so that the general overload // for make_tetrahedron can be eliminated as halfedge_descriptor is // used in the returned type template struct graph_traits> { typedef void* halfedge_descriptor; }; } // namespace boost #endif // CGAL_INDEXED_TRIANGLE_SET_H