Add vertex/face base models

This commit is contained in:
Mael Rouxel-Labbé 2019-12-11 15:09:11 +01:00
parent 0ad161c61d
commit f04042aa96
2 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,84 @@
// Copyright (c) 1997, 2012, 2019 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the Licenxse, 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: GPL-3.0+
//
// Author(s) : Mariette Yvinec, Claudia Werner
#ifndef CGAL_Triangulation_on_sphere_face_base_2_H
#define CGAL_Triangulation_on_sphere_face_base_2_H
#include <CGAL/Triangulation_ds_face_base_2.h>
namespace CGAL {
template <typename Gt,
typename Fb = Triangulation_ds_face_base_2<> >
class Triangulation_on_sphere_face_base_2
: public Fb
{
public:
typedef Gt Geom_traits;
typedef typename Fb::Vertex_handle Vertex_handle;
typedef typename Fb::Face_handle Face_handle;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
typedef Triangulation_on_sphere_face_base_2<Gt, Fb2> Other;
};
public:
void set_in_conflict_flag(unsigned char f) { _in_conflict_flag = f; }
unsigned char get_in_conflict_flag() const { return _in_conflict_flag; }
public:
Triangulation_on_sphere_face_base_2()
: Fb(), _ghost(false)
{
set_in_conflict_flag(0);
}
Triangulation_on_sphere_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2)
: Fb(v0, v1, v2), _ghost(false)
{
set_in_conflict_flag(0);
}
Triangulation_on_sphere_face_base_2(Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2)
: Fb(v0, v1, v2, n0, n1, n2), _ghost(false)
{
set_in_conflict_flag(0);
}
bool is_ghost() const { return _ghost; }
bool& ghost() { return _ghost; }
protected:
bool _ghost;
unsigned char _in_conflict_flag;
};
} // namespace CGAL
#endif //CGAL_Triangulation_on_sphere_face_base_2_H

View File

@ -0,0 +1,82 @@
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
// 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) : Mariette Yvinec
#ifndef CGAL_Triangulation_on_sphere_vertex_base_2_H
#define CGAL_Triangulation_on_sphere_vertex_base_2_H
#include <CGAL/license/Triangulation_2.h>
#include <CGAL/config.h>
#include <CGAL/Triangulation_ds_vertex_base_2.h>
namespace CGAL {
template < typename GT,
typename Vb = Triangulation_ds_vertex_base_2<> >
class Triangulation_on_sphere_vertex_base_2
: public Vb
{
typedef typename Vb::Triangulation_data_structure Tds;
public:
typedef GT Geom_traits;
typedef typename GT::Point_on_sphere Point;
typedef Tds Triangulation_data_structure;
typedef typename Tds::Face_handle Face_handle;
typedef typename Tds::Vertex_handle Vertex_handle;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef Triangulation_on_sphere_vertex_base_2<GT, Vb2> Other;
};
private:
Point _p;
public:
Triangulation_on_sphere_vertex_base_2 () : Vb(), _p() { }
Triangulation_on_sphere_vertex_base_2(const Point & p) : Vb(), _p(p) { }
Triangulation_on_sphere_vertex_base_2(const Point & p, Face_handle f) : Vb(f), _p(p) { }
Triangulation_on_sphere_vertex_base_2(Face_handle f) : Vb(f) { }
void set_point(const Point & p) { _p = p; }
const Point& point() const { return _p; }
// the non-const version of point() is undocument but needed to make the point iterator works
// using Lutz projection scheme
Point& point() { return _p; }
//the following trivial is_valid to allow
// the user of derived face base classes
// to add their own purpose checking
bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const {return true;}
};
template < class GT, class Vb >
std::istream&
operator>>(std::istream &is, Triangulation_on_sphere_vertex_base_2<GT, Vb> &v)
// non combinatorial information. Default = point
{
return is >> static_cast<Vb&>(v) >> v.point();
}
template < class GT, class Vb >
std::ostream&
operator<<(std::ostream &os, const Triangulation_on_sphere_vertex_base_2<GT, Vb> &v)
// non combinatorial information. Default = point
{
return os << static_cast<const Vb&>(v) << v.point();
}
} //namespace CGAL
#endif //CGAL_Triangulation_on_sphere_vertex_base_2_H