mirror of https://github.com/CGAL/cgal
modified hyperbolic translaiton class to remove unnecessary function for matrix access; created new function to recover individual generator
This commit is contained in:
parent
8fb3cf2c13
commit
00d1ddcdfe
|
|
@ -146,7 +146,7 @@ public:
|
||||||
|
|
||||||
void initializeTranslations() {
|
void initializeTranslations() {
|
||||||
std::vector<Matrix> gens;
|
std::vector<Matrix> gens;
|
||||||
T::Hyperbolic_translation::get_generators(gens);
|
T::Hyperbolic_translation::generators(gens);
|
||||||
std::vector<Matrix> tmp;
|
std::vector<Matrix> tmp;
|
||||||
for (int j = 0; j < gens.size(); j++) {
|
for (int j = 0; j < gens.size(); j++) {
|
||||||
tmp.push_back(gens[j]);
|
tmp.push_back(gens[j]);
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ MainWindow::animate() {
|
||||||
// in this set with high probability.
|
// in this set with high probability.
|
||||||
//std::cout << " ..checking generators "; std::cout.flush();
|
//std::cout << " ..checking generators "; std::cout.flush();
|
||||||
std::vector<Hyperbolic_translation> gens;
|
std::vector<Hyperbolic_translation> gens;
|
||||||
Hyperbolic_translation::get_generators(gens);
|
Hyperbolic_translation::generators(gens);
|
||||||
for (int i = 0; i < gens.size(); i++) {
|
for (int i = 0; i < gens.size(); i++) {
|
||||||
o = gens[i];
|
o = gens[i];
|
||||||
if (check(dt.construct_point(p,o)) == CGAL::ON_BOUNDED_SIDE) {
|
if (check(dt.construct_point(p,o)) == CGAL::ON_BOUNDED_SIDE) {
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@ class Hyperbolic_octagon_translation {
|
||||||
public:
|
public:
|
||||||
typedef unsigned short int Word_letter;
|
typedef unsigned short int Word_letter;
|
||||||
|
|
||||||
enum Generator {
|
enum Generator: Word_letter {
|
||||||
A = 0,
|
A = 0,
|
||||||
B_BAR,
|
B_BAR = 1,
|
||||||
C,
|
C = 2,
|
||||||
D_BAR,
|
D_BAR = 3,
|
||||||
A_BAR,
|
A_BAR = 4,
|
||||||
B,
|
B = 5,
|
||||||
C_BAR,
|
C_BAR = 6,
|
||||||
D
|
D = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -58,24 +58,33 @@ private:
|
||||||
static std::map<std::string, Matrix> gmap;
|
static std::map<std::string, Matrix> gmap;
|
||||||
|
|
||||||
static std::map<std::string, Matrix> init_gmap() {
|
static std::map<std::string, Matrix> init_gmap() {
|
||||||
typedef typename std::pair<FT,FT> Complex;
|
|
||||||
typedef typename std::pair<Complex,Complex> Coefficient;
|
|
||||||
std::vector<Coefficient> mcf;
|
|
||||||
|
|
||||||
get_generator_coefficients(mcf);
|
// Create matrix coefficients
|
||||||
|
FT sq2 = CGAL::sqrt(FT(2));
|
||||||
|
FT xi = FT(1) + sq2;
|
||||||
|
FT rxi = CGAL::sqrt(xi);
|
||||||
|
|
||||||
|
// All matrices have the same _alpha
|
||||||
|
ECplx alpha(xi,FT(0));
|
||||||
|
|
||||||
std::map<std::string, Matrix> m;
|
// This vector holds the different _betas
|
||||||
vector<Matrix> g;
|
std::vector< ECplx > beta;
|
||||||
for (int i = 0; i < mcf.size(); i++) {
|
|
||||||
Complex a = mcf[i].first;
|
beta.push_back( ECplx( sq2 * rxi, 0 ) );
|
||||||
Complex b = mcf[i].second;
|
beta.push_back( ECplx( rxi, rxi ) );
|
||||||
ECplx alpha(a.first, a.second);
|
beta.push_back( ECplx( 0, sq2 * rxi ) );
|
||||||
ECplx beta(b.first, b.second);
|
beta.push_back( ECplx( -rxi, rxi ) );
|
||||||
g.push_back( Matrix(alpha, beta) );
|
beta.push_back( ECplx( -sq2 * rxi, 0 ) );
|
||||||
|
beta.push_back( ECplx( -rxi, -rxi ) );
|
||||||
|
beta.push_back( ECplx( 0, -sq2 * rxi ) );
|
||||||
|
beta.push_back( ECplx( rxi, -rxi ) );
|
||||||
|
|
||||||
|
std::vector<Matrix> g;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
g.push_back(Matrix(alpha, beta[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map<std::string, Matrix> m;
|
||||||
m["_"] = Matrix();
|
m["_"] = Matrix();
|
||||||
|
|
||||||
m["0527"] = g[A]*g[B]*g[C]*g[D];
|
m["0527"] = g[A]*g[B]*g[C]*g[D];
|
||||||
|
|
@ -215,8 +224,11 @@ public:
|
||||||
return _wrd.to_string();
|
return _wrd.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Self generator(const Word_letter wl) {
|
||||||
|
return Self(wl);
|
||||||
|
}
|
||||||
|
|
||||||
static void get_generators(std::vector<Self>& gens) {
|
static void generators(std::vector<Self>& gens) {
|
||||||
gens.push_back(Self(A));
|
gens.push_back(Self(A));
|
||||||
gens.push_back(Self(B_BAR));
|
gens.push_back(Self(B_BAR));
|
||||||
gens.push_back(Self(C));
|
gens.push_back(Self(C));
|
||||||
|
|
@ -227,34 +239,6 @@ public:
|
||||||
gens.push_back(Self(D));
|
gens.push_back(Self(D));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_generator_coefficients(std::vector< std::pair< std::pair<FT,FT>,
|
|
||||||
std::pair<FT,FT> > >& gens) {
|
|
||||||
typedef typename std::pair<FT,FT> Complex;
|
|
||||||
typedef typename std::pair<Complex,Complex> Matrix;
|
|
||||||
|
|
||||||
FT sq2 = CGAL::sqrt(FT(2));
|
|
||||||
FT xi = FT(1) + sq2;
|
|
||||||
FT rxi = CGAL::sqrt(xi);
|
|
||||||
|
|
||||||
Complex alpha(xi,FT(0)); // all matrices have the same _alpha
|
|
||||||
|
|
||||||
// This vector holds the different _betas
|
|
||||||
std::vector< Complex > beta;
|
|
||||||
|
|
||||||
beta.push_back( Complex( sq2 * rxi, 0 ) );
|
|
||||||
beta.push_back( Complex( rxi, rxi ) );
|
|
||||||
beta.push_back( Complex( 0, sq2 * rxi ) );
|
|
||||||
beta.push_back( Complex( -rxi, rxi ) );
|
|
||||||
beta.push_back( Complex( -sq2 * rxi, 0 ) );
|
|
||||||
beta.push_back( Complex( -rxi, -rxi ) );
|
|
||||||
beta.push_back( Complex( 0, -sq2 * rxi ) );
|
|
||||||
beta.push_back( Complex( rxi, -rxi ) );
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
gens.push_back(Matrix(alpha, beta[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue