From f95bbbccc2c2f19df93e46a7f7823eb8c253c502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Mar 2025 10:35:55 +0100 Subject: [PATCH] Do not use underscore prefixes --- .../window.cpp | 88 +++--- .../window.h | 12 +- .../include/CGAL/Complex_number.h | 86 +++--- .../CGAL/Hyperbolic_fundamental_domain_2.h | 36 +-- .../Hyperbolic_fundamental_domain_factory_2.h | 88 +++--- .../include/CGAL/Hyperbolic_isometry_2.h | 10 +- .../Triangulation_on_hyperbolic_surface_2.h | 262 +++++++++--------- 7 files changed, 291 insertions(+), 291 deletions(-) diff --git a/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.cpp b/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.cpp index 1d1abc7ea3d..001e69b2fe7 100644 --- a/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.cpp +++ b/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.cpp @@ -16,16 +16,16 @@ DemoWindowItem::DemoWindowItem() : CGAL::Qt::GraphicsItem() { // Clear - _edges.clear(); + edges_.clear(); // Prepare the pens - _poincare_disk_pen.setStyle(Qt::SolidLine); - _poincare_disk_pen.setWidth(8); - _poincare_disk_pen.setBrush(Qt::black); + poincare_disk_pen_.setStyle(Qt::SolidLine); + poincare_disk_pen_.setWidth(8); + poincare_disk_pen_.setBrush(Qt::black); - _edges_pen.setStyle(Qt::SolidLine); - _edges_pen.setWidth(6); - _edges_pen.setBrush(Qt::blue); + edges_pen_.setStyle(Qt::SolidLine); + edges_pen_.setWidth(6); + edges_pen_.setBrush(Qt::blue); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -35,27 +35,27 @@ void DemoWindowItem::paint(QPainter *painter, QWidget *widget) { // 1. Draw the poincaré disk - QRectF circle_rect = QRectF(-_poincare_disk_radius_in_pixels-3, - -_poincare_disk_radius_in_pixels-3, - 2*_poincare_disk_radius_in_pixels+6, - 2*_poincare_disk_radius_in_pixels+6); - painter->setPen(_poincare_disk_pen); + QRectF circle_rect = QRectF(-poincare_disk_radius_in_pixels_-3, + -poincare_disk_radius_in_pixels_-3, + 2*poincare_disk_radius_in_pixels_+6, + 2*poincare_disk_radius_in_pixels_+6); + painter->setPen(poincare_disk_pen_); painter->setBrush(QBrush()); painter->drawEllipse(circle_rect); // 2. Draw the edges painter->setBrush(QBrush()); - painter->setPen(_edges_pen); - for (std::size_t i=0; i<_edges.size(); i++) { - draw_edge(painter, _edges[i].first, _edges[i].second); + painter->setPen(edges_pen_); + for (std::size_t i=0; i(*it); point_3 = std::get<3>(*it); - _edges.push_back(std::make_pair(point_1, point_2)); - _edges.push_back(std::make_pair(point_2, point_3)); - _edges.push_back(std::make_pair(point_3, point_1)); + edges_.push_back(std::make_pair(point_1, point_2)); + edges_.push_back(std::make_pair(point_2, point_3)); + edges_.push_back(std::make_pair(point_3, point_1)); } } @@ -87,8 +87,8 @@ void DemoWindowItem::draw_triangulation(Triangulation& triangulation) void DemoWindowItem::draw_point(QPainter* painter, Point position) { // First convert the point in doubles, well-scaled - double point_x = _poincare_disk_radius_in_pixels * CGAL::to_double(position.x()); - double point_y = _poincare_disk_radius_in_pixels * CGAL::to_double(position.y()); + double point_x = poincare_disk_radius_in_pixels_ * CGAL::to_double(position.x()); + double point_y = poincare_disk_radius_in_pixels_ * CGAL::to_double(position.y()); // Then draw a small circle QRectF circle_rect = QRectF(point_x-1, point_y-1, 3, 3); @@ -161,10 +161,10 @@ void DemoWindowItem::draw_line(QPainter* painter, double point_2_x, double point_2_y) { // Convert to doubles and scale by the radius of the poincaré disk - double src_x = _poincare_disk_radius_in_pixels * point_1_x; - double src_y = _poincare_disk_radius_in_pixels * point_1_y; - double tar_x = _poincare_disk_radius_in_pixels * point_2_x; - double tar_y = _poincare_disk_radius_in_pixels * point_2_y; + double src_x = poincare_disk_radius_in_pixels_ * point_1_x; + double src_y = poincare_disk_radius_in_pixels_ * point_1_y; + double tar_x = poincare_disk_radius_in_pixels_ * point_2_x; + double tar_y = poincare_disk_radius_in_pixels_ * point_2_y; // Actual drawing QLineF line (src_x, src_y, tar_x, tar_y); @@ -180,23 +180,23 @@ void DemoWindowItem::draw_arc(QPainter* painter, // 1. Scale by the radius of the poincaré disk - double src_x = _poincare_disk_radius_in_pixels * point_1_x; - double src_y = _poincare_disk_radius_in_pixels * point_1_y; + double src_x = poincare_disk_radius_in_pixels_ * point_1_x; + double src_y = poincare_disk_radius_in_pixels_ * point_1_y; - double tar_x = _poincare_disk_radius_in_pixels * point_2_x; - double tar_y = _poincare_disk_radius_in_pixels * point_2_y; + double tar_x = poincare_disk_radius_in_pixels_ * point_2_x; + double tar_y = poincare_disk_radius_in_pixels_ * point_2_y; - double xc = _poincare_disk_radius_in_pixels * center_x; - double yc = _poincare_disk_radius_in_pixels * center_y; + double xc = poincare_disk_radius_in_pixels_ * center_x; + double yc = poincare_disk_radius_in_pixels_ * center_y; // 2. Define the radius of the circle and the box [xm, xM] \times [ym, yM] bounding the circle double circle_radius = sqrt((point_1_x-center_x)*(point_1_x-center_x) + (point_1_y-center_y)*(point_1_y-center_y)); - double xm = _poincare_disk_radius_in_pixels * (center_x - circle_radius); - double xM = _poincare_disk_radius_in_pixels * (center_x + circle_radius); - double ym = _poincare_disk_radius_in_pixels * (center_y - circle_radius); - double yM = _poincare_disk_radius_in_pixels * (center_y + circle_radius); + double xm = poincare_disk_radius_in_pixels_ * (center_x - circle_radius); + double xM = poincare_disk_radius_in_pixels_ * (center_x + circle_radius); + double ym = poincare_disk_radius_in_pixels_ * (center_y - circle_radius); + double yM = poincare_disk_radius_in_pixels_ * (center_y + circle_radius); // If the source and the target are too close from each other (less than 10 pixels) or if the circle is very big then just draw a line double dist_sq = (src_x-tar_x)*(src_x-tar_x) + (src_y - tar_y)*(src_y-tar_y); @@ -251,11 +251,11 @@ double DemoWindowItem::deg_angle(double x, double y) DemoWindow::DemoWindow() : DemosMainWindow() { setupUi(this); // Method automatically generated by the ui file and here inherited from Ui::MainWindow. Builds the window and the contents for us... - this->graphicsView->setScene(&_scene); // ... in particular graphicsView is already constructed : we just put our scene in it and then do things within the scene - _scene.setItemIndexMethod(QGraphicsScene::NoIndex); - _scene.setSceneRect(-600, -600, 1200, 1200); - _item = new DemoWindowItem(); - _scene.addItem(_item); + this->graphicsView->setScene(&scene_); // ... in particular graphicsView is already constructed : we just put our scene in it and then do things within the scene + scene_.setItemIndexMethod(QGraphicsScene::NoIndex); + scene_.setSceneRect(-600, -600, 1200, 1200); + item_ = new DemoWindowItem(); + scene_.addItem(item_); this->graphicsView->scale(0.5, -0.5); // Y-axis inversion setWindowTitle("Hyperbolic surfaces triangulation 2 Demo"); @@ -263,7 +263,7 @@ DemoWindow::DemoWindow() : DemosMainWindow() DemoWindowItem& DemoWindow::item() { - return *_item; + return *item_; } void DemoWindow::keyPressEvent(QKeyEvent* event) {} diff --git a/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.h b/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.h index 628af162002..18748f12f31 100644 --- a/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.h +++ b/Triangulation_on_hyperbolic_surface_2/demo/Triangulation_on_hyperbolic_surface_2/window.h @@ -44,14 +44,14 @@ private: typedef CGAL::Bbox_2 Bbox_2; // "Bounding box": just a box type used for drawing // Edges to draw - std::vector> _edges; + std::vector > edges_; // Pens for drawing - QPen _poincare_disk_pen; - QPen _edges_pen; + QPen poincare_disk_pen_; + QPen edges_pen_; // radius of the poincaré disk - const int _poincare_disk_radius_in_pixels = 600; + const int poincare_disk_radius_in_pixels_ = 600; // Approximation treshold: used to decide when to simplify a computation (ex: draw a line // instead of an arc if an hyperbolic segment is very small) @@ -93,8 +93,8 @@ class DemoWindow // (Q_OBJECT does not support templates) private: - QGraphicsScene _scene; - DemoWindowItem* _item; + QGraphicsScene scene_; + DemoWindowItem* item_; public: DemoWindow(); diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Complex_number.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Complex_number.h index 40831267bf8..52baafdcdda 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Complex_number.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Complex_number.h @@ -25,19 +25,19 @@ Templated by a field FT. Represents a complex number over FT. template class Complex_number { - typedef Complex_number _Self; + typedef Complex_number Self; - FT _real, _imag; + FT real_, imag_; public: Complex_number(const FT& real_part) - : _real(real_part), - _imag(0) + : real_(real_part), + imag_(0) {} Complex_number(const FT& real_part, const FT& imaginary_part) - : _real(real_part), - _imag(imaginary_part) + : real_(real_part), + imag_(imaginary_part) {} Complex_number() @@ -46,75 +46,75 @@ public: template Complex_number(U&& real_part, V&& imaginary_part) - : _real(std::forward(real_part)), - _imag(std::forward(imaginary_part)) + : real_(std::forward(real_part)), + imag_(std::forward(imaginary_part)) {} void real(const FT& real_part) { - _real = real_part; + real_ = real_part; } void imag(const FT& imaginary_part) { - _imag = imaginary_part; + imag_ = imaginary_part; } FT real() const { - return _real; + return real_; } FT imag() const { - return _imag; + return imag_; } - _Self& operator+=(const _Self& other); - _Self& operator-=(const _Self& other); - _Self& operator*=(const _Self& other); - _Self& operator/=(const _Self& other); + Self& operator+=(const Self& other); + Self& operator-=(const Self& other); + Self& operator*=(const Self& other); + Self& operator/=(const Self& other); // These member versions are not working ? - /* _Self operator+(const _Self& z) const; */ - /* _Self operator-(const _Self& z) const; */ + /* Self operator+(const Self& z) const; */ + /* Self operator-(const Self& z) const; */ // Hidden friends - friend _Self operator+(const _Self& z) { + friend Self operator+(const Self& z) { return z; } - friend _Self operator-(const _Self& z) { - return _Self(-z._real,-z._imag); + friend Self operator-(const Self& z) { + return Self(-z.real_,-z.imag_); } - friend bool operator==(const _Self& z1, const _Self& z2) { - return (z1._real==z2._real && z1._imag==z2._imag); + friend bool operator==(const Self& z1, const Self& z2) { + return (z1.real_==z2.real_ && z1.imag_==z2.imag_); } - friend bool operator!=(const _Self& z1, const _Self& z2) { + friend bool operator!=(const Self& z1, const Self& z2) { return !operator==(z1, z2); } - friend _Self operator+(const _Self& z1, const _Self& z2) { - return _Self(z1._real+z2._real, z1._imag+z2._imag); + friend Self operator+(const Self& z1, const Self& z2) { + return Self(z1.real_+z2.real_, z1.imag_+z2.imag_); } - friend _Self operator-(const _Self& z1, const _Self& z2) { - return _Self(z1._real-z2._real, z1._imag-z2._imag); + friend Self operator-(const Self& z1, const Self& z2) { + return Self(z1.real_-z2.real_, z1.imag_-z2.imag_); } - friend _Self operator*(const _Self& z1, const _Self& z2) { - return _Self(z1._real*z2._real-z1._imag*z2._imag, z1._real*z2._imag+z1._imag*z2._real); + friend Self operator*(const Self& z1, const Self& z2) { + return Self(z1.real_*z2.real_-z1.imag_*z2.imag_, z1.real_*z2.imag_+z1.imag_*z2.real_); } - friend _Self operator/(const _Self& z1, const _Self& z2) { + friend Self operator/(const Self& z1, const Self& z2) { FT m2 = norm(z2); - return _Self(z1._real/m2, z1._imag/m2)*conj(z2); + return Self(z1.real_/m2, z1.imag_/m2)*conj(z2); } - friend std::ostream& operator<<(std::ostream& s, const _Self& z) { - s << z._real << std::endl << z._imag << std::endl; + friend std::ostream& operator<<(std::ostream& s, const Self& z) { + s << z.real_ << std::endl << z.imag_ << std::endl; return s; } - friend void operator>>(std::istream& s, _Self& z) { + friend void operator>>(std::istream& s, Self& z) { FT ft; s >> ft; z.real(ft); @@ -127,24 +127,24 @@ public: template Complex_number& Complex_number::operator+=(const Complex_number& other) { - _real += other.real(); - _imag += other.imag(); + real_ += other.real(); + imag_ += other.imag(); return *this; } template Complex_number& Complex_number::operator-=(const Complex_number& other) { - _real -= other.real(); - _imag -= other.imag(); + real_ -= other.real(); + imag_ -= other.imag(); return *this; } template Complex_number& Complex_number::operator*=(const Complex_number& other) { - _real = _real*other.real() - _imag*other.imag(); - _imag = _real*other.imag() + _imag*other.real(); + real_ = real_*other.real() - imag_*other.imag(); + imag_ = real_*other.imag() + imag_*other.real(); return *this; } @@ -152,8 +152,8 @@ template Complex_number& Complex_number::operator/=(const Complex_number& other) { FT m2 = norm(other); - _real /= m2; - _imag /= m2; + real_ /= m2; + imag_ /= m2; this *= conj(other); return *this; } diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_2.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_2.h index 99f854f81c3..5f1a8edb88d 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_2.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_2.h @@ -42,8 +42,8 @@ public: template Hyperbolic_fundamental_domain_2(PointRange & vertices, PairingRange & pairings) { - _vertices = std::vector(vertices.begin(), vertices.end()); - _pairings = std::vector(pairings.begin(), pairings.end()); + vertices_ = std::vector(vertices.begin(), vertices.end()); + pairings_ = std::vector(pairings.begin(), pairings.end()); } // returns the number of vertices (equivalently, the number of sides) @@ -64,8 +64,8 @@ public: bool is_valid() const; private: - std::vector _vertices; - std::vector _pairings; + std::vector vertices_; + std::vector pairings_; }; //template std::ostream& operator<<(std::ostream& s, const Hyperbolic_fundamental_domain_2& domain); @@ -82,7 +82,7 @@ Hyperbolic_fundamental_domain_2:: size() const { CGAL_precondition(is_valid()); - return _vertices.size(); + return vertices_.size(); } template @@ -91,7 +91,7 @@ Hyperbolic_fundamental_domain_2:: vertex(std::size_t index) const { CGAL_precondition(is_valid()); - return _vertices[index]; + return vertices_[index]; } template @@ -100,7 +100,7 @@ Hyperbolic_fundamental_domain_2:: paired_side(std::size_t index) const { CGAL_precondition(is_valid()); - return _pairings[index]; + return pairings_[index]; } template @@ -148,24 +148,24 @@ std::istream& Hyperbolic_fundamental_domain_2:: from_stream(std::istream& s) { - _vertices.clear(); - _pairings.clear(); + vertices_.clear(); + pairings_.clear(); std::string line; s >> line; std::size_t size = std::stoi(line); - _vertices.reserve(size); - _pairings.reserve(size); + vertices_.reserve(size); + pairings_.reserve(size); for (std::size_t k=0; k> line; - _pairings.push_back(std::stoi(line)); + pairings_.push_back(std::stoi(line)); } for (std::size_t k=0; k> p; - _vertices.push_back(p); + vertices_.push_back(p); } return s; } @@ -178,7 +178,7 @@ Hyperbolic_fundamental_domain_2:: is_valid()const { // Get the number of vertices - std::size_t n = _vertices.size(); + std::size_t n = vertices_.size(); // Check that the number of vertices is even if (n%2) { @@ -186,17 +186,17 @@ is_valid()const } // Check that there are as many side pairings as vertices - if (_pairings.size() != n) { + if (pairings_.size() != n) { return false; } - // Check that the _pairings vector encodes a perfect matching of the set {0,1,\dots,n-1} + // Check that the pairings_ vector encodes a perfect matching of the set {0,1,\dots,n-1} std::vector already_paired(n); for (std::size_t k=0; k=n) { return false; } @@ -208,7 +208,7 @@ is_valid()const // Check that the vertices all lie within the open unit disk for (std::size_t k=0; k= typename Traits::FT(1)) { + if (norm(Complex_number(vertices_[k].x(), vertices_[k].y())) >= typename Traits::FT(1)) { return false; } } diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_factory_2.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_factory_2.h index 57d9225641a..76a106378ef 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_factory_2.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_fundamental_domain_factory_2.h @@ -33,11 +33,11 @@ template class Hyperbolic_fundamental_domain_factory_2 { private: - typedef typename Traits::FT _FT; - typedef typename Traits::Complex _Cmplx; - typedef typename Traits::Hyperbolic_point_2 _Point; + typedef typename Traits::FT FT; + typedef typename Traits::Complex Cmplx; + typedef typename Traits::Hyperbolic_point_2 Point; - Random _random; + Random random_; public: Hyperbolic_fundamental_domain_factory_2(); @@ -48,13 +48,13 @@ private: float random_float(); // returns number in [-1,1] Complex_number random_complex_float(); // returns complex z such that modulus(z) < 1 and imag(z) > 0 - _FT exact_number_from_float(float x); - _Cmplx exact_complex_from_float_complex(const Complex_number& z); + FT exact_number_from_float(float x); + Cmplx exact_complex_from_float_complex(const Complex_number& z); bool try_to_compute_inexact_z0_from_z1_z2_z3(Complex_number& z0, Complex_number& z1, Complex_number& z2, Complex_number& z3); - bool try_to_compute_exact_z3_from_z0_z1_z2(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx& z3); + bool try_to_compute_exact_z3_from_z0_z1_z2(Cmplx& z0, Cmplx& z1, Cmplx& z2, Cmplx& z3); - bool sanity_check(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx& z3); + bool sanity_check(Cmplx& z0, Cmplx& z1, Cmplx& z2, Cmplx& z3); const int CGAL_DENOMINATOR_FOR_GENERATION = 10000; }; @@ -73,9 +73,9 @@ Hyperbolic_fundamental_domain_2 Hyperbolic_fundamental_domain_factory_2:: make_hyperbolic_fundamental_domain_g2(unsigned int seed) { - _random = Random(seed); + random_ = Random(seed); bool is_domain_generated = false; - _Cmplx exact_z0, exact_z1, exact_z2, exact_z3; + Cmplx exact_z0, exact_z1, exact_z2, exact_z3; while (!is_domain_generated) { // 1. Generate inexact z0,z1,z2,z3 @@ -103,16 +103,16 @@ make_hyperbolic_fundamental_domain_g2(unsigned int seed) } } - _Cmplx exact_zero(_FT(0), _FT(0)); - std::vector<_Point> vertices; - vertices.push_back(_Point(exact_z0.real(), exact_z0.imag())); - vertices.push_back(_Point(exact_z1.real(), exact_z1.imag())); - vertices.push_back(_Point(exact_z2.real(), exact_z2.imag())); - vertices.push_back(_Point(exact_z3.real(), exact_z3.imag())); - vertices.push_back(_Point(-exact_z0.real(), -exact_z0.imag())); - vertices.push_back(_Point(-exact_z1.real(), -exact_z1.imag())); - vertices.push_back(_Point(-exact_z2.real(), -exact_z2.imag())); - vertices.push_back(_Point(-exact_z3.real(), -exact_z3.imag())); + Cmplx exact_zero(FT(0), FT(0)); + std::vector vertices; + vertices.push_back(Point(exact_z0.real(), exact_z0.imag())); + vertices.push_back(Point(exact_z1.real(), exact_z1.imag())); + vertices.push_back(Point(exact_z2.real(), exact_z2.imag())); + vertices.push_back(Point(exact_z3.real(), exact_z3.imag())); + vertices.push_back(Point(-exact_z0.real(), -exact_z0.imag())); + vertices.push_back(Point(-exact_z1.real(), -exact_z1.imag())); + vertices.push_back(Point(-exact_z2.real(), -exact_z2.imag())); + vertices.push_back(Point(-exact_z3.real(), -exact_z3.imag())); std::vector pairings; for (int k=0; k<8; ++k) { @@ -127,12 +127,12 @@ make_hyperbolic_fundamental_domain_g2(unsigned int seed) template float Hyperbolic_fundamental_domain_factory_2::random_positive_float() { - return _random.uniform_01(); + return random_.uniform_01(); } template float Hyperbolic_fundamental_domain_factory_2::random_float() { - return _random.uniform_01() * 2 - 1; + return random_.uniform_01() * 2 - 1; } template @@ -157,9 +157,9 @@ Hyperbolic_fundamental_domain_factory_2:: exact_number_from_float(float x) { if (x < 0) { - return _FT(0)-exact_number_from_float(-x); + return FT(0)-exact_number_from_float(-x); } - return _FT(int(x*CGAL_DENOMINATOR_FOR_GENERATION)%CGAL_DENOMINATOR_FOR_GENERATION)/_FT(CGAL_DENOMINATOR_FOR_GENERATION); + return FT(int(x*CGAL_DENOMINATOR_FOR_GENERATION)%CGAL_DENOMINATOR_FOR_GENERATION)/FT(CGAL_DENOMINATOR_FOR_GENERATION); } template @@ -167,7 +167,7 @@ typename Traits::Complex Hyperbolic_fundamental_domain_factory_2:: exact_complex_from_float_complex(const Complex_number& z) { - return _Cmplx(exact_number_from_float(z.real()), exact_number_from_float(z.imag())); + return Cmplx(exact_number_from_float(z.real()), exact_number_from_float(z.imag())); } //////////////////////////////////////////////////////////////////////////////// @@ -202,10 +202,10 @@ try_to_compute_inexact_z0_from_z1_z2_z3(Complex_number& z0, template bool Hyperbolic_fundamental_domain_factory_2:: -try_to_compute_exact_z3_from_z0_z1_z2(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx& z3) +try_to_compute_exact_z3_from_z0_z1_z2(Cmplx& z0, Cmplx& z1, Cmplx& z2, Cmplx& z3) { - _FT zero_number (0); - _FT one_number (1); + FT zero_number (0); + FT one_number (1); if ((z0.real()<=zero_number) || (z1.imag()<=zero_number) || (z2.imag()<=zero_number) || (z3.imag()<=zero_number)) { return false; } @@ -218,24 +218,24 @@ try_to_compute_exact_z3_from_z0_z1_z2(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx return false; } - _Cmplx one_cmplx (_FT(1), _FT(0)); - _Cmplx two_cmplx(_FT(2), _FT(0)); + Cmplx one_cmplx (FT(1), FT(0)); + Cmplx two_cmplx(FT(2), FT(0)); - _Cmplx f_of_z0 = two_cmplx * z0 / (z0*z0 + one_cmplx); - _Cmplx f_of_z1 = (z0 + z1) / (z0*z1 + one_cmplx); - _Cmplx f_of_z2 = (z0 + z2) / (z0*z2 + one_cmplx); - _Cmplx f_of_z3 = (z0 + z3) / (z0*z3 + one_cmplx); + Cmplx f_of_z0 = two_cmplx * z0 / (z0*z0 + one_cmplx); + Cmplx f_of_z1 = (z0 + z1) / (z0*z1 + one_cmplx); + Cmplx f_of_z2 = (z0 + z2) / (z0*z2 + one_cmplx); + Cmplx f_of_z3 = (z0 + z3) / (z0*z3 + one_cmplx); - _Cmplx intermediate = (one_cmplx - f_of_z0*conj(f_of_z1)) * (one_cmplx - f_of_z1*conj(f_of_z2)); - _FT P_of_zero = intermediate.imag(); - _FT P_of_one = (intermediate * (one_cmplx-f_of_z2*conj(f_of_z3))).imag(); + Cmplx intermediate = (one_cmplx - f_of_z0*conj(f_of_z1)) * (one_cmplx - f_of_z1*conj(f_of_z2)); + FT P_of_zero = intermediate.imag(); + FT P_of_one = (intermediate * (one_cmplx-f_of_z2*conj(f_of_z3))).imag(); if (P_of_one == P_of_zero) { return false; } - _FT lbda = P_of_zero / (P_of_zero - P_of_one); - _Cmplx V (lbda*(f_of_z3.real()), lbda*(f_of_z3.imag())); + FT lbda = P_of_zero / (P_of_zero - P_of_one); + Cmplx V (lbda*(f_of_z3.real()), lbda*(f_of_z3.imag())); if ((V.imag()<=zero_number) || (norm(V)>=one_number) || ((V/f_of_z2).imag()<=zero_number)) { return false; @@ -251,10 +251,10 @@ try_to_compute_exact_z3_from_z0_z1_z2(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx template bool Hyperbolic_fundamental_domain_factory_2:: -sanity_check(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx& z3) +sanity_check(Cmplx& z0, Cmplx& z1, Cmplx& z2, Cmplx& z3) { - _FT zero_number(0); - _FT one_number(1); + FT zero_number(0); + FT one_number(1); // 1. Check the positions if ((z0.imag()!=zero_number) || (z0.real()<=zero_number) || (z1.imag()<=zero_number) || (z2.imag()<=zero_number) || (z3.imag()<=zero_number)) { @@ -270,8 +270,8 @@ sanity_check(_Cmplx& z0, _Cmplx& z1, _Cmplx& z2, _Cmplx& z3) } // 2. Check the area - _Cmplx one_cmplx (one_number, zero_number); - _Cmplx Z = (one_cmplx-z0*conj(z1)) * (one_cmplx-z1*conj(z2)) *(one_cmplx-z2*conj(z3)) *(one_cmplx+z3*conj(z0)); + Cmplx one_cmplx (one_number, zero_number); + Cmplx Z = (one_cmplx-z0*conj(z1)) * (one_cmplx-z1*conj(z2)) *(one_cmplx-z2*conj(z3)) *(one_cmplx+z3*conj(z0)); if (Z.imag()!=zero_number) { return false; } diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_isometry_2.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_isometry_2.h index f7fad5cb56b..87bd5151a1f 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_isometry_2.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Hyperbolic_isometry_2.h @@ -50,7 +50,7 @@ public: Point operator()(const Point& point) const; private: - Complex_number _coefficients[4]; + Complex_number coefficients_[4]; }; // returns the composition of two isometries. @@ -131,7 +131,7 @@ void Hyperbolic_isometry_2:: set_coefficient(int index, const Complex_number& coefficient) { - _coefficients[index] = coefficient; + coefficients_[index] = coefficient; } //////////////////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ const typename Traits::Complex& Hyperbolic_isometry_2:: get_coefficient(int index) const { - return _coefficients[index]; + return coefficients_[index]; } //////////////////////////////////////////////////////////////////////////////// @@ -152,8 +152,8 @@ Hyperbolic_isometry_2:: evaluate(const Point& point) const { Complex_number z(point.x(), point.y()); - Complex_number numerator_of_the_result = _coefficients[0] * z + _coefficients[1]; - Complex_number denominator_of_the_result = _coefficients[2] * z + _coefficients[3]; + Complex_number numerator_of_the_result = coefficients_[0] * z + coefficients_[1]; + Complex_number denominator_of_the_result = coefficients_[2] * z + coefficients_[3]; Complex_number result = numerator_of_the_result / denominator_of_the_result; return Point(result.real(), result.imag()); } diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Triangulation_on_hyperbolic_surface_2.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Triangulation_on_hyperbolic_surface_2.h index 97287b0619b..25bfb83c527 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Triangulation_on_hyperbolic_surface_2.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Triangulation_on_hyperbolic_surface_2.h @@ -118,28 +118,28 @@ public: // Wrapper around the Cmap for iterating over vertices, edges or faces. Vertex_range vertices_range() { - return _combinatorial_map.template one_dart_per_cell<0>(); + return combinatorial_map_.template one_dart_per_cell<0>(); } Edge_range edges_range() { - return _combinatorial_map.template one_dart_per_cell<1>(); + return combinatorial_map_.template one_dart_per_cell<1>(); } Face_range faces_range() { - return _combinatorial_map.template one_dart_per_cell<2>(); + return combinatorial_map_.template one_dart_per_cell<2>(); } Vertex_const_range vertices_const_range() const { - return _combinatorial_map.template one_dart_per_cell<0>(); + return combinatorial_map_.template one_dart_per_cell<0>(); } Edge_const_range edges_const_range() const { - return _combinatorial_map.template one_dart_per_cell<1>(); + return combinatorial_map_.template one_dart_per_cell<1>(); } Face_const_range faces_const_range() const { - return _combinatorial_map.template one_dart_per_cell<2>(); + return combinatorial_map_.template one_dart_per_cell<2>(); } protected: - Combinatorial_map_with_cross_ratios _combinatorial_map; - bool _has_anchor = false; - Anchor _anchor; + Combinatorial_map_with_cross_ratios combinatorial_map_; + bool has_anchor_ = false; + Anchor anchor_; Dart_descriptor pick_edge_to_flip(); Dart_const_descriptor pick_edge_to_flip() const; @@ -160,13 +160,13 @@ Triangulation_on_hyperbolic_surface_2:: Triangulation_on_hyperbolic_surface_2(const Domain& domain) { // (Triangulates by adding an internal edge between domain.vertex(size-1) and the other vertices) - _combinatorial_map.clear(); + combinatorial_map_.clear(); std::size_t size = domain.size(); // Make the triangles std::vector dart_of_triangle(size-2); for (std::size_t k=0; k(dart_1, dart_2); - _combinatorial_map.template set_attribute<1>(dart_1, _combinatorial_map.template create_attribute<1>(cross_ratio(p0,p1,p2,p3))); + combinatorial_map_.template sew<2>(dart_1, dart_2); + combinatorial_map_.template set_attribute<1>(dart_1, combinatorial_map_.template create_attribute<1>(cross_ratio(p0,p1,p2,p3))); } // Sew the boundary edges and set their cross ratios @@ -217,18 +217,18 @@ Triangulation_on_hyperbolic_surface_2(const Domain& domain) p3 = domain.side_pairing(k1).evaluate(p3); - if (_combinatorial_map.template is_sewable<2>(dart_1, dart_2)) { - _combinatorial_map.template sew<2>(dart_1, dart_2); - _combinatorial_map.template set_attribute<1>(dart_1, _combinatorial_map.template create_attribute<1>(cross_ratio(p0,p1,p2,p3))); + if (combinatorial_map_.template is_sewable<2>(dart_1, dart_2)) { + combinatorial_map_.template sew<2>(dart_1, dart_2); + combinatorial_map_.template set_attribute<1>(dart_1, combinatorial_map_.template create_attribute<1>(cross_ratio(p0,p1,p2,p3))); } } // Set the anchor - _anchor.dart = dart_of_triangle[0]; - _anchor.vertices[0] = domain.vertex(size-1); - _anchor.vertices[1] = domain.vertex(0); - _anchor.vertices[2] = domain.vertex(1); - _has_anchor = true; + anchor_.dart = dart_of_triangle[0]; + anchor_.vertices[0] = domain.vertex(size-1); + anchor_.vertices[1] = domain.vertex(0); + anchor_.vertices[2] = domain.vertex(1); + has_anchor_ = true; } /* template */ @@ -251,7 +251,7 @@ typename Triangulation_on_hyperbolic_surface_2::Combinatoria Triangulation_on_hyperbolic_surface_2:: combinatorial_map() { - return _combinatorial_map; + return combinatorial_map_; } template @@ -260,7 +260,7 @@ Triangulation_on_hyperbolic_surface_2:: has_anchor() const { CGAL_precondition(is_valid()); - return _has_anchor; + return has_anchor_; } template @@ -269,7 +269,7 @@ Triangulation_on_hyperbolic_surface_2:: anchor() { CGAL_precondition(is_valid() && has_anchor()); - return _anchor; + return anchor_; } template @@ -278,7 +278,7 @@ Triangulation_on_hyperbolic_surface_2:: anchor() const { CGAL_precondition(is_valid() && has_anchor()); - return _anchor; + return anchor_; } //////////////////////////////////////////////////////////////////////////////// @@ -317,20 +317,20 @@ flip(Dart_descriptor dart) // Modify the anchor - if (_anchor.dart == a) { - _anchor.dart = e; - _anchor.vertices[1] = Point(fourth_point_from_cross_ratio(_anchor.vertices[1], _anchor.vertices[2], _anchor.vertices[0], cross_ratio_AC)); - } else if (_anchor.dart == b) { - _anchor.vertices[2] = Point(fourth_point_from_cross_ratio(_anchor.vertices[0], _anchor.vertices[1], _anchor.vertices[2], cross_ratio_AC)); - } else if (_anchor.dart == c) { - _anchor.vertices[2] = Point(fourth_point_from_cross_ratio(_anchor.vertices[2], _anchor.vertices[0], _anchor.vertices[1], cross_ratio_AC)); - } else if (_anchor.dart == d) { - _anchor.dart = b; - _anchor.vertices[1] = Point(fourth_point_from_cross_ratio(_anchor.vertices[1], _anchor.vertices[2], _anchor.vertices[0], cross_ratio_AC)); - } else if (_anchor.dart == e) { - _anchor.vertices[2] = Point(fourth_point_from_cross_ratio(_anchor.vertices[0], _anchor.vertices[1], _anchor.vertices[2], cross_ratio_AC)); - } else if (_anchor.dart == f) { - _anchor.vertices[2] = Point(fourth_point_from_cross_ratio(_anchor.vertices[2], _anchor.vertices[0], _anchor.vertices[1], cross_ratio_AC)); + if (anchor_.dart == a) { + anchor_.dart = e; + anchor_.vertices[1] = Point(fourth_point_from_cross_ratio(anchor_.vertices[1], anchor_.vertices[2], anchor_.vertices[0], cross_ratio_AC)); + } else if (anchor_.dart == b) { + anchor_.vertices[2] = Point(fourth_point_from_cross_ratio(anchor_.vertices[0], anchor_.vertices[1], anchor_.vertices[2], cross_ratio_AC)); + } else if (anchor_.dart == c) { + anchor_.vertices[2] = Point(fourth_point_from_cross_ratio(anchor_.vertices[2], anchor_.vertices[0], anchor_.vertices[1], cross_ratio_AC)); + } else if (anchor_.dart == d) { + anchor_.dart = b; + anchor_.vertices[1] = Point(fourth_point_from_cross_ratio(anchor_.vertices[1], anchor_.vertices[2], anchor_.vertices[0], cross_ratio_AC)); + } else if (anchor_.dart == e) { + anchor_.vertices[2] = Point(fourth_point_from_cross_ratio(anchor_.vertices[0], anchor_.vertices[1], anchor_.vertices[2], cross_ratio_AC)); + } else if (anchor_.dart == f) { + anchor_.vertices[2] = Point(fourth_point_from_cross_ratio(anchor_.vertices[2], anchor_.vertices[0], anchor_.vertices[1], cross_ratio_AC)); } // Compute the new cross ratios @@ -344,39 +344,39 @@ flip(Dart_descriptor dart) // Make the topological flip - _combinatorial_map.template unlink_beta<1>(a); - _combinatorial_map.template unlink_beta<1>(b); - _combinatorial_map.template unlink_beta<1>(c); + combinatorial_map_.template unlink_beta<1>(a); + combinatorial_map_.template unlink_beta<1>(b); + combinatorial_map_.template unlink_beta<1>(c); - _combinatorial_map.template unlink_beta<1>(d); - _combinatorial_map.template unlink_beta<1>(e); - _combinatorial_map.template unlink_beta<1>(f); + combinatorial_map_.template unlink_beta<1>(d); + combinatorial_map_.template unlink_beta<1>(e); + combinatorial_map_.template unlink_beta<1>(f); - _combinatorial_map.template link_beta<1>(b, a); - _combinatorial_map.template link_beta<1>(a, f); - _combinatorial_map.template link_beta<1>(f, b); + combinatorial_map_.template link_beta<1>(b, a); + combinatorial_map_.template link_beta<1>(a, f); + combinatorial_map_.template link_beta<1>(f, b); - _combinatorial_map.template link_beta<1>(e, d); - _combinatorial_map.template link_beta<1>(d, c); - _combinatorial_map.template link_beta<1>(c, e); + combinatorial_map_.template link_beta<1>(e, d); + combinatorial_map_.template link_beta<1>(d, c); + combinatorial_map_.template link_beta<1>(c, e); // And give the new cross ratios to the edges - _combinatorial_map.template info<1>(a) = cross_ratio_BD; - _combinatorial_map.template info<1>(e) = cross_ratio_AB_2; - _combinatorial_map.template info<1>(f) = cross_ratio_BC_2; - _combinatorial_map.template info<1>(b) = cross_ratio_CD_2; - _combinatorial_map.template info<1>(c) = cross_ratio_DA_2; + combinatorial_map_.template info<1>(a) = cross_ratio_BD; + combinatorial_map_.template info<1>(e) = cross_ratio_AB_2; + combinatorial_map_.template info<1>(f) = cross_ratio_BC_2; + combinatorial_map_.template info<1>(b) = cross_ratio_CD_2; + combinatorial_map_.template info<1>(c) = cross_ratio_DA_2; // Take care of the particular cases where we need to "flip again" if (opposite(e) == b) { - _combinatorial_map.template info<1>(e) = one - (one - cross_ratio_AB_2) * (cross_ratio_AC); + combinatorial_map_.template info<1>(e) = one - (one - cross_ratio_AB_2) * (cross_ratio_AC); } if (opposite(f) == c) { - _combinatorial_map.template info<1>(f) = one - (one - cross_ratio_BC_2) / (cross_ratio_BD); + combinatorial_map_.template info<1>(f) = one - (one - cross_ratio_BC_2) / (cross_ratio_BD); } } @@ -422,8 +422,8 @@ lift(bool center) const std::vector > realizations; - size_t visited_darts_mark = _combinatorial_map.get_new_mark(); - _combinatorial_map.unmark_all(visited_darts_mark); + size_t visited_darts_mark = combinatorial_map_.get_new_mark(); + combinatorial_map_.unmark_all(visited_darts_mark); struct Compare { @@ -439,41 +439,41 @@ lift(bool center) const std::unordered_map positions; - Dart_const_range darts = _combinatorial_map.darts(); + Dart_const_range darts = combinatorial_map_.darts(); - _combinatorial_map.mark(_anchor.dart, visited_darts_mark); - _combinatorial_map.mark(const_ccw(_anchor.dart), visited_darts_mark); - _combinatorial_map.mark(const_cw(_anchor.dart), visited_darts_mark); + combinatorial_map_.mark(anchor_.dart, visited_darts_mark); + combinatorial_map_.mark(const_ccw(anchor_.dart), visited_darts_mark); + combinatorial_map_.mark(const_cw(anchor_.dart), visited_darts_mark); if (center) { - Isometry center_the_drawing = hyperbolic_translation(_anchor.vertices[0]); - positions[_anchor.dart] = center_the_drawing.evaluate(_anchor.vertices[0]); - positions[const_ccw(_anchor.dart)] = center_the_drawing.evaluate(_anchor.vertices[1]); - positions[const_cw(_anchor.dart)] = center_the_drawing.evaluate(_anchor.vertices[2]); + Isometry center_the_drawing = hyperbolic_translation(anchor_.vertices[0]); + positions[anchor_.dart] = center_the_drawing.evaluate(anchor_.vertices[0]); + positions[const_ccw(anchor_.dart)] = center_the_drawing.evaluate(anchor_.vertices[1]); + positions[const_cw(anchor_.dart)] = center_the_drawing.evaluate(anchor_.vertices[2]); } else { - positions[_anchor.dart] = _anchor.vertices[0]; - positions[const_ccw(_anchor.dart)] = _anchor.vertices[1]; - positions[const_cw(_anchor.dart)] = _anchor.vertices[2]; + positions[anchor_.dart] = anchor_.vertices[0]; + positions[const_ccw(anchor_.dart)] = anchor_.vertices[1]; + positions[const_cw(anchor_.dart)] = anchor_.vertices[2]; } std::tuple value = - std::make_tuple(_anchor.dart, - positions[_anchor.dart], - positions[const_ccw(_anchor.dart)], - positions[const_cw(_anchor.dart)]); + std::make_tuple(anchor_.dart, + positions[anchor_.dart], + positions[const_ccw(anchor_.dart)], + positions[const_cw(anchor_.dart)]); realizations.push_back(value); - Complex_number anchor_z0(_anchor.vertices[0].x(), _anchor.vertices[0].y()); - Complex_number anchor_z1(_anchor.vertices[1].x(), _anchor.vertices[1].y()); - Complex_number anchor_z2(_anchor.vertices[2].x(), _anchor.vertices[2].y()); + Complex_number anchor_z0(anchor_.vertices[0].x(), anchor_.vertices[0].y()); + Complex_number anchor_z1(anchor_.vertices[1].x(), anchor_.vertices[1].y()); + Complex_number anchor_z2(anchor_.vertices[2].x(), anchor_.vertices[2].y()); double weight_of_anchor_dart = CGAL::to_double(norm(anchor_z0) + norm(anchor_z1)); double weight_of_ccw_anchor_dart = CGAL::to_double(norm(anchor_z1) + norm(anchor_z2)); double weight_of_cw_anchor_dart = CGAL::to_double(norm(anchor_z2) + norm(anchor_z0)); - queue.push(std::make_pair(_anchor.dart, weight_of_anchor_dart)); - queue.push(std::make_pair(const_ccw(_anchor.dart), weight_of_ccw_anchor_dart)); - queue.push(std::make_pair(const_cw(_anchor.dart), weight_of_cw_anchor_dart)); + queue.push(std::make_pair(anchor_.dart, weight_of_anchor_dart)); + queue.push(std::make_pair(const_ccw(anchor_.dart), weight_of_ccw_anchor_dart)); + queue.push(std::make_pair(const_cw(anchor_.dart), weight_of_cw_anchor_dart)); while (! queue.empty()) { Dart_const_descriptor invader = queue.top().first; @@ -481,10 +481,10 @@ lift(bool center) const Dart_const_descriptor invaded = const_opposite(invader); - if (!_combinatorial_map.is_marked(invaded, visited_darts_mark)) { - _combinatorial_map.mark(invaded, visited_darts_mark); - _combinatorial_map.mark(const_ccw(invaded), visited_darts_mark); - _combinatorial_map.mark(const_cw(invaded), visited_darts_mark); + if (!combinatorial_map_.is_marked(invaded, visited_darts_mark)) { + combinatorial_map_.mark(invaded, visited_darts_mark); + combinatorial_map_.mark(const_ccw(invaded), visited_darts_mark); + combinatorial_map_.mark(const_cw(invaded), visited_darts_mark); const Point& a = positions[const_ccw(invader)]; const Point& b = positions[const_cw(invader)]; @@ -514,7 +514,7 @@ lift(bool center) const } } - _combinatorial_map.free_mark(visited_darts_mark); + combinatorial_map_.free_mark(visited_darts_mark); return realizations; } @@ -529,29 +529,29 @@ is_valid() const // 1. Check the combinatorial map // Check that the combinatorial map is valid - if (!_combinatorial_map.is_valid()) { + if (!combinatorial_map_.is_valid()) { return false; } // Check that the combinatorial map has no 1,2-boundary for (int k=1; k<3; ++k) { - if (!_combinatorial_map.is_without_boundary(k)) { + if (!combinatorial_map_.is_without_boundary(k)) { return false; } } // 2. Check the anchor, if any - if (_has_anchor) { + if (has_anchor_) { // Check that the dart descriptor of the anchor points to a dart of the combinatorial map - if (!_combinatorial_map.is_dart_used(_anchor.dart)) { + if (!combinatorial_map_.is_dart_used(anchor_.dart)) { return false; } // Check that the three vertices of the anchor lie within the open unit disk for (int k=0; k<3; ++k) { - // if (_anchor.vertices[k].get_z() >= Number(1)) { - if (norm(Complex_number(_anchor.vertices[k].x(),_anchor.vertices[k].y())) >= Number(1)) { + // if (anchor_.vertices[k].get_z() >= Number(1)) { + if (norm(Complex_number(anchor_.vertices[k].x(),anchor_.vertices[k].y())) >= Number(1)) { return false; } } @@ -572,7 +572,7 @@ to_stream(std::ostream& s) const // Give indices to the darts std::map darts_indices; int current_dart_index = 0; - for (typename Dart_const_range::const_iterator it=_combinatorial_map.darts().begin(); it!=_combinatorial_map.darts().end(); ++it) { + for (typename Dart_const_range::const_iterator it=combinatorial_map_.darts().begin(); it!=combinatorial_map_.darts().end(); ++it) { darts_indices[it] = current_dart_index; current_dart_index++; } @@ -581,12 +581,12 @@ to_stream(std::ostream& s) const s << current_dart_index << std::endl; // Store the anchor, if any - if (_has_anchor) { + if (has_anchor_) { s << "yes" << std::endl; - s << darts_indices[_anchor.dart] << std::endl; - s << _anchor.vertices[0] << std::endl; - s << _anchor.vertices[1] << std::endl; - s << _anchor.vertices[2] << std::endl; + s << darts_indices[anchor_.dart] << std::endl; + s << anchor_.vertices[0] << std::endl; + s << anchor_.vertices[1] << std::endl; + s << anchor_.vertices[2] << std::endl; } else { s << "no" << std::endl; } @@ -611,7 +611,7 @@ void Triangulation_on_hyperbolic_surface_2:: from_stream(std::istream& s) { - _combinatorial_map.clear(); + combinatorial_map_.clear(); // Load the number of darts std::string line; @@ -622,23 +622,23 @@ from_stream(std::istream& s) int anchor_dart_id = 0; s >> line; if (!line.compare("yes")) { - _has_anchor = true; + has_anchor_ = true; s >> line; - anchor_dart_id = std::stoi(line); // (*) _anchor.dart_id is set at the end of the function + anchor_dart_id = std::stoi(line); // (*) anchor_.dart_id is set at the end of the function - s >> _anchor.vertices[0]; - s >> _anchor.vertices[1]; - s >> _anchor.vertices[2]; + s >> anchor_.vertices[0]; + s >> anchor_.vertices[1]; + s >> anchor_.vertices[2]; } else { - _has_anchor = false; + has_anchor_ = false; } // Load the triangles std::vector darts_by_id (nb_darts); int index1, index2, index3; for (int k=0; k> line; index1 = std::stoi(line); @@ -662,14 +662,14 @@ from_stream(std::istream& s) index2 = std::stoi(line); dart_1 = darts_by_id[index1]; dart_2 = darts_by_id[index2]; - _combinatorial_map.template sew<2>(dart_1, dart_2); + combinatorial_map_.template sew<2>(dart_1, dart_2); s >> cross_ratio; - _combinatorial_map.template set_attribute<1>(dart_1, _combinatorial_map.template create_attribute<1>(cross_ratio)); + combinatorial_map_.template set_attribute<1>(dart_1, combinatorial_map_.template create_attribute<1>(cross_ratio)); } // (*) here - if (_has_anchor) { - _anchor.dart = darts_by_id[anchor_dart_id]; + if (has_anchor_) { + anchor_.dart = darts_by_id[anchor_dart_id]; } } @@ -677,39 +677,39 @@ from_stream(std::istream& s) template typename Triangulation_on_hyperbolic_surface_2::Dart_descriptor Triangulation_on_hyperbolic_surface_2::ccw(Dart_descriptor dart) { - return _combinatorial_map.beta(dart, 1); + return combinatorial_map_.beta(dart, 1); } template typename Triangulation_on_hyperbolic_surface_2::Dart_descriptor Triangulation_on_hyperbolic_surface_2::cw(Dart_descriptor dart) { - return _combinatorial_map.beta(dart, 0); + return combinatorial_map_.beta(dart, 0); } template typename Triangulation_on_hyperbolic_surface_2::Dart_descriptor Triangulation_on_hyperbolic_surface_2::opposite(Dart_descriptor dart) { - return _combinatorial_map.opposite(dart); + return combinatorial_map_.opposite(dart); } template typename Triangulation_on_hyperbolic_surface_2::Dart_const_descriptor Triangulation_on_hyperbolic_surface_2::const_ccw(Dart_const_descriptor dart) const { - return _combinatorial_map.beta(dart, 1); + return combinatorial_map_.beta(dart, 1); } template typename Triangulation_on_hyperbolic_surface_2::Dart_const_descriptor Triangulation_on_hyperbolic_surface_2::const_cw(Dart_const_descriptor dart) const { - return _combinatorial_map.beta(dart, 0); + return combinatorial_map_.beta(dart, 0); } template typename Triangulation_on_hyperbolic_surface_2::Dart_const_descriptor Triangulation_on_hyperbolic_surface_2::const_opposite(Dart_const_descriptor dart) const { - return _combinatorial_map.opposite(dart); + return combinatorial_map_.opposite(dart); } //////////////////////////////////////////////////////////////////////////////// template typename Triangulation_on_hyperbolic_surface_2::Complex_number Triangulation_on_hyperbolic_surface_2::get_cross_ratio(Dart_const_descriptor dart) const { - return _combinatorial_map.template info_of_attribute<1>(_combinatorial_map.template attribute<1>(dart)); + return combinatorial_map_.template info_of_attribute<1>(combinatorial_map_.template attribute<1>(dart)); } //////////////////////////////////////////////////////////////////////////////// @@ -717,7 +717,7 @@ template typename Triangulation_on_hyperbolic_surface_2::Dart_descriptor Triangulation_on_hyperbolic_surface_2:: pick_edge_to_flip() { - auto& cm = _combinatorial_map.darts(); + auto& cm = combinatorial_map_.darts(); for (auto it=cm.begin(); it!=cm.end(); ++it) { if (is_Delaunay_flippable(it)) { return it; @@ -733,7 +733,7 @@ typename Triangulation_on_hyperbolic_surface_2::Dart_const_d Triangulation_on_hyperbolic_surface_2:: pick_edge_to_flip() const { - const auto& cm = _combinatorial_map.darts(); + const auto& cm = combinatorial_map_.darts(); for (auto it=cm.begin(); it!=cm.end(); ++it) { if (is_Delaunay_flippable(it) ) { return it; @@ -749,9 +749,9 @@ void Triangulation_on_hyperbolic_surface_2:: copy_from(Combinatorial_map_with_cross_ratios& cmap) { - //_combinatorial_map.copy_from_const(cmap); - _combinatorial_map.copy(cmap); - _has_anchor = false; + //combinatorial_map_.copy_from_const(cmap); + combinatorial_map_.copy(cmap); + has_anchor_ = false; } template @@ -761,15 +761,15 @@ copy_from(Combinatorial_map_with_cross_ratios& cmap, const Anchor& anchor) { // Because of the anchor, we must operate the copy ourself - _combinatorial_map.clear(); + combinatorial_map_.clear(); // Copy the triangles and fill the darts conversion table std::map darts_table; for (typename Face_const_range::const_iterator it=cmap.template one_dart_per_cell<2>().begin(); it!=cmap.template one_dart_per_cell<2>().end(); ++it) { - Dart_descriptor new_dart = _combinatorial_map.make_combinatorial_polygon(3); + Dart_descriptor new_dart = combinatorial_map_.make_combinatorial_polygon(3); darts_table[it] = new_dart; - darts_table[cmap.beta(it,0)] = _combinatorial_map.beta(new_dart,0); - darts_table[cmap.beta(it,1)] = _combinatorial_map.beta(new_dart,1); + darts_table[cmap.beta(it,0)] = combinatorial_map_.beta(new_dart,0); + darts_table[cmap.beta(it,1)] = combinatorial_map_.beta(new_dart,1); } // Sew the edges and set their cross-ratios @@ -778,18 +778,18 @@ copy_from(Combinatorial_map_with_cross_ratios& cmap, Dart_descriptor dart_2 = darts_table[cmap.opposite(it)]; Complex_number cratio = cmap.template info_of_attribute<1>(cmap.template attribute<1>(it)); - _combinatorial_map.template sew<2>(dart_1, dart_2); - _combinatorial_map.template set_attribute<1>(dart_1, _combinatorial_map.template create_attribute<1>(cratio)); + combinatorial_map_.template sew<2>(dart_1, dart_2); + combinatorial_map_.template set_attribute<1>(dart_1, combinatorial_map_.template create_attribute<1>(cratio)); } cmap.opposite(anchor.dart); // Set the anchor - _anchor.dart = darts_table[anchor.dart]; + anchor_.dart = darts_table[anchor.dart]; for (int k=0; k<3; ++k) { - _anchor.vertices[k] = anchor.vertices[k]; + anchor_.vertices[k] = anchor.vertices[k]; } - _has_anchor = true; + has_anchor_ = true; } ////////////////////////////////////////////////////////////////////////////////