Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vdespre committed Jul 25, 2024
2 parents 4d85c82 + fbad5de commit afef189
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ class Hyperbolic_fundamental_domain_2 {
/// \name Access functions
/// @{
/*!
Returns the number of vertices (equivalently, the number of sides) of the domain.
returns the number of vertices (equivalently, the number of sides) of the domain.
\pre <code> is_valid() </code>
*/
int size() const;

/*!
Returns the \f$ i \f$-th vertex.
returns the \f$ i \f$-th vertex.
\pre <code> is_valid() </code>
*/
Point vertex(int i) const;

/*!
Returns the index of the side paired to the \f$ i \f$-th side.
returns the index of the side paired to the \f$ i \f$-th side.
\pre <code> is_valid() </code>
*/
int paired_side(int i) const;

/*!
Returns the isometry that maps side \f$ \overline A \f$ to side \f$ A
returns the isometry that maps side \f$ \overline A \f$ to side \f$ A
\f$, where \f$ A \f$ is the \f$ i \f$-th side, and \f$ \overline A \f$ is the side paired to \f$ A \f$.
\pre <code> is_valid() </code>
Expand All @@ -81,7 +81,7 @@ class Hyperbolic_fundamental_domain_2 {
void operator>>(std::istream& s, Hyperbolic_fundamental_domain_2<Traits>& domain);

/*!
Writes the domain in a stream.
writes the domain in a stream.
The format of the output is the following.
The first line prints the number n of vertices of the domain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Hyperbolic_fundamental_domain_factory_2{
/// \name Generation of a domain
/// @{
/*!
Randomly generates a convex domain of a closed orientable hyperbolic surface of genus two.
randomly generates a convex domain of a closed orientable hyperbolic surface of genus two.
*/
Hyperbolic_fundamental_domain_2<Traits> generate_domain_g2();
/// @}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Hyperbolic_surface_triangulation_2{
typedef typename Traits::Hyperbolic_point_2 Point;

/*!
Stores a dart \f$ d \f$ of the combinatorial map, belonging to a triangle \f$ t \f$, and stores the three vertices of a lift of \f$ t \f$ in the hyperbolic plane.
stores a dart \f$ d \f$ of the combinatorial map, belonging to a triangle \f$ t \f$, and stores the three vertices of a lift of \f$ t \f$ in the hyperbolic plane.
*/
struct Anchor{
typename Combinatorial_map_with_cross_ratios::Dart_handle dart;
Expand Down Expand Up @@ -98,21 +98,21 @@ class Hyperbolic_surface_triangulation_2{
/// \name Access functions
/// @{
/*!
Returns the decorated combinatorial map.
returns the decorated combinatorial map.
\pre <code> is_valid() </code>
*/
Combinatorial_map_with_cross_ratios& get_combinatorial_map_ref();
Combinatorial_map_with_cross_ratios& combinatorial_map();

/*!
Tells if the triangulation has an anchor.
tells if the triangulation has an anchor.
\pre <code> is_valid() </code>
*/
bool has_anchor() const;

/*!
Returns the anchor.
returns the anchor.
\pre <code> is_valid() && has_anchor() </code>
*/
Expand All @@ -122,26 +122,26 @@ class Hyperbolic_surface_triangulation_2{
/// \name Delaunay flip algorithm
/// @{
/*!
Tells if if the edge supported by the dart is Delaunay flippable.
tells if if the edge supported by the dart is Delaunay flippable.
\pre <code> is_valid() </code>
*/
bool is_delaunay_flippable(Dart_handle dart) const;

/*!
Flips the edge supported by the dart.
flips the edge supported by the dart.
\pre <code> is_valid() </code>
*/
void flip(Dart_handle dart);

/*!
Determines if the triangulation is a valid Delaunay triangulation.
determines if the triangulation is a valid Delaunay triangulation.
*/
bool is_delaunay() const;

/*!
Applies the Delaunay flip algorithm: flips Delaunay flippable edges until there is no such edge anymore.
applies the Delaunay flip algorithm: flips Delaunay flippable edges until there is no such edge anymore.
\pre <code> is_valid() </code>
*/
Expand All @@ -151,7 +151,7 @@ class Hyperbolic_surface_triangulation_2{
/// \name Lifting
/// @{
/*!
Lifts the triangulation in the hyperbolic plane.
lifts the triangulation in the hyperbolic plane.
Returns, for every triangle \f$ t \f$ of the triangulation, one of the darts of \f$ t \f$ in the combinatorial map of the triangulation, together with a triple \f$ p,q,r \f$ of points in the hyperbolic plane.
The points \f$ p,q,r \f$ are the vertices of a lift of \f$ t \f$ in the hyperbolic plane.
If the center parameter is set to true, then one of the lifted triangles admits the origin \f$ 0 \f$ as a vertex.
Expand All @@ -174,7 +174,7 @@ class Hyperbolic_surface_triangulation_2{
/// \name Input/output
/// @{
/*!
Writes the triangulation in a stream.
writes the triangulation in a stream.
The format of the output is the following.
Each dart of the triangulation is given an index between \f$ 0 \f$ and \f$ n-1 \f$, where \f$ n \f$ is the number of darts of the triangulation.
The first line contains the number \f$ n \f$ of darts.
Expand All @@ -188,7 +188,7 @@ class Hyperbolic_surface_triangulation_2{
std::ostream& operator<<(std::ostream& s, Hyperbolic_surface_triangulation_2<Traits>& Hyperbolic_surface_triangulation_2);

/*!
Reads the triangulation from a stream.
reads the triangulation from a stream.
The format of the input should be the same as the format of the output of the '<<' operator.
\pre <code> is_valid() </code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Hyperbolic_surface_triangulation_2{
//Hyperbolic_surface_triangulation_2& operator=(Hyperbolic_surface_triangulation_2&& other);
Hyperbolic_surface_triangulation_2& operator=(Hyperbolic_surface_triangulation_2 other);

Combinatorial_map_with_cross_ratios& get_combinatorial_map_ref();
Combinatorial_map_with_cross_ratios& combinatorial_map();
bool has_anchor() const;
Anchor& anchor() const;

Expand Down Expand Up @@ -219,18 +219,18 @@ template<class Traits, class Attributes>
//Hyperbolic_surface_triangulation_2<Traits>& Hyperbolic_surface_triangulation_2<Traits>::operator=(Hyperbolic_surface_triangulation_2<Traits>&& other){
Hyperbolic_surface_triangulation_2<Traits, Attributes>& Hyperbolic_surface_triangulation_2<Traits, Attributes>::operator=(Hyperbolic_surface_triangulation_2<Traits, Attributes> other){
if (other.has_anchor()){
copy_from(other.get_combinatorial_map_ref(), other.anchor());
copy_from(other.combinatorial_map(), other.anchor());
}
else {
copy_from(other.get_combinatorial_map_ref());
copy_from(other.combinatorial_map());
}
return *this;
}

////////////////////////////////////////////////////////////////////////////////

template<class Traits, class Attributes>
typename Hyperbolic_surface_triangulation_2<Traits, Attributes>::Combinatorial_map_with_cross_ratios& Hyperbolic_surface_triangulation_2<Traits, Attributes>::get_combinatorial_map_ref(){
typename Hyperbolic_surface_triangulation_2<Traits, Attributes>::Combinatorial_map_with_cross_ratios& Hyperbolic_surface_triangulation_2<Traits, Attributes>::combinatorial_map(){
return _combinatorial_map;
}

Expand All @@ -239,7 +239,7 @@ bool Hyperbolic_surface_triangulation_2<Traits, Attributes>::has_anchor() const
return _has_anchor;
}

template<class Traits, class Attributes>
template<class Traits, class Attributes>
typename Hyperbolic_surface_triangulation_2<Traits, Attributes>::Anchor&
Hyperbolic_surface_triangulation_2<Traits, Attributes>::anchor() const{
return _anchor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main() {

assert( triangulation0.is_valid() );

Triangulation triangulation1 = Triangulation(triangulation0.get_combinatorial_map_ref());
Triangulation triangulation1 = Triangulation(triangulation0.combinatorial_map());
assert( ! triangulation1.has_anchor() );

Triangulation triangulation (triangulation0);
Expand All @@ -57,7 +57,8 @@ int main() {
output_not_centered = triangulation.lift(false);
output_centered = triangulation.lift();

Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.get_combinatorial_map_ref();

Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.combinatorial_map();
Triangulation::Anchor& anchor = triangulation.anchor();
assert( cmap.is_dart_used(anchor.dart) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main() {

assert( triangulation0.is_valid() );

Triangulation triangulation1 = Triangulation(triangulation0.get_combinatorial_map_ref());
Triangulation triangulation1 = Triangulation(triangulation0.combinatorial_map());
assert( ! triangulation1.has_anchor() );

Triangulation triangulation (triangulation0);
Expand All @@ -54,7 +54,8 @@ int main() {
output_not_centered = triangulation.lift(false);
output_centered = triangulation.lift();

Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.get_combinatorial_map_ref();

Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.combinatorial_map();
Triangulation::Anchor& anchor = triangulation.anchor();
assert( cmap.is_dart_used(anchor.dart) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Domain build_domain(){
pairings.push_back((k+4)%8);
}

return Domain(vertices, pairings);
return Domain(vertices.begin(),vertices.end(), pairings.begin(),pairings.end());
}

int main() {
Expand All @@ -47,7 +47,7 @@ int main() {

assert( triangulation0.is_valid() );

Triangulation triangulation1 = Triangulation(triangulation0.get_combinatorial_map_ref());
Triangulation triangulation1 = Triangulation(triangulation0.combinatorial_map());
assert( ! triangulation1.has_anchor() );

Triangulation triangulation (triangulation0);
Expand All @@ -73,7 +73,7 @@ int main() {
output_not_centered = triangulation.lift(false);
output_centered = triangulation.lift();

Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.get_combinatorial_map_ref();
Triangulation::Combinatorial_map_with_cross_ratios& cmap = triangulation.combinatorial_map();
Triangulation::Anchor& anchor = triangulation.anchor();
assert( cmap.is_dart_used(anchor.dart) );

Expand Down

0 comments on commit afef189

Please sign in to comment.