mirror of https://github.com/CGAL/cgal
modified hyperbolic translation class to expose get_generator functions as static members
This commit is contained in:
parent
dd52213c4e
commit
b50fda7eef
|
|
@ -146,7 +146,7 @@ public:
|
||||||
|
|
||||||
void initializeTranslations() {
|
void initializeTranslations() {
|
||||||
std::vector<Matrix> gens;
|
std::vector<Matrix> gens;
|
||||||
get_generators(gens);
|
T::Hyperbolic_translation::get_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;
|
||||||
get_generators(gens);
|
Hyperbolic_translation::get_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(Make_point()(p,o)) == CGAL::ON_BOUNDED_SIDE) {
|
if (check(Make_point()(p,o)) == CGAL::ON_BOUNDED_SIDE) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,17 @@ class Hyperbolic_octagon_translation {
|
||||||
public:
|
public:
|
||||||
typedef unsigned short int Word_letter;
|
typedef unsigned short int Word_letter;
|
||||||
|
|
||||||
|
enum Generator {
|
||||||
|
A = 0,
|
||||||
|
B_BAR,
|
||||||
|
C,
|
||||||
|
D_BAR,
|
||||||
|
A_BAR,
|
||||||
|
B,
|
||||||
|
C_BAR,
|
||||||
|
D
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef Exact_complex<NT> ECplx;
|
typedef Exact_complex<NT> ECplx;
|
||||||
typedef Hyperbolic_octagon_translation<NT> Self;
|
typedef Hyperbolic_octagon_translation<NT> Self;
|
||||||
|
|
@ -46,67 +57,81 @@ 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<NT,NT> Complex;
|
||||||
|
typedef typename std::pair<Complex,Complex> Coefficient;
|
||||||
|
std::vector<Coefficient> mcf;
|
||||||
|
|
||||||
|
get_generator_coefficients(mcf);
|
||||||
|
|
||||||
|
|
||||||
std::map<std::string, Matrix> m;
|
std::map<std::string, Matrix> m;
|
||||||
vector<Matrix> g;
|
vector<Matrix> g;
|
||||||
get_generators(g);
|
for (int i = 0; i < mcf.size(); i++) {
|
||||||
|
Complex a = mcf[i].first;
|
||||||
|
Complex b = mcf[i].second;
|
||||||
|
ECplx alpha(a.first, a.second);
|
||||||
|
ECplx beta(b.first, b.second);
|
||||||
|
g.push_back( Matrix(alpha, beta) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
m["_"] = Matrix();
|
m["_"] = Matrix();
|
||||||
|
|
||||||
m["0527"] = g[0]*g[5]*g[2]*g[7];
|
m["0527"] = g[A]*g[B]*g[C]*g[D];
|
||||||
m["052"] = g[0]*g[5]*g[2];
|
m["052"] = g[A]*g[B]*g[C];
|
||||||
m["05"] = g[0]*g[5];
|
m["05"] = g[A]*g[B];
|
||||||
m["0"] = g[0];
|
m["0"] = g[A];
|
||||||
m["03"] = g[0]*g[3];
|
m["03"] = g[A]*g[D_BAR];
|
||||||
m["036"] = g[0]*g[3]*g[6];
|
m["036"] = g[A]*g[D_BAR]*g[C_BAR];
|
||||||
|
|
||||||
m["1630"] = g[1]*g[6]*g[3]*g[0];
|
m["1630"] = g[B_BAR]*g[C_BAR]*g[D_BAR]*g[A];
|
||||||
m["163"] = g[1]*g[6]*g[3];
|
m["163"] = g[B_BAR]*g[C_BAR]*g[D_BAR];
|
||||||
m["16"] = g[1]*g[6];
|
m["16"] = g[B_BAR]*g[C_BAR];
|
||||||
m["1"] = g[1];
|
m["1"] = g[B_BAR];
|
||||||
m["14"] = g[1]*g[4];
|
m["14"] = g[B_BAR]*g[A_BAR];
|
||||||
m["147"] = g[1]*g[4]*g[7];
|
m["147"] = g[B_BAR]*g[A_BAR]*g[D];
|
||||||
|
|
||||||
m["2741"] = g[2]*g[7]*g[4]*g[1];
|
m["2741"] = g[C]*g[D]*g[A_BAR]*g[B_BAR];
|
||||||
m["274"] = g[2]*g[7]*g[4];
|
m["274"] = g[C]*g[D]*g[A_BAR];
|
||||||
m["27"] = g[2]*g[7];
|
m["27"] = g[C]*g[D];
|
||||||
m["2"] = g[2];
|
m["2"] = g[C];
|
||||||
m["25"] = g[2]*g[5];
|
m["25"] = g[C]*g[B];
|
||||||
m["250"] = g[2]*g[5]*g[0];
|
m["250"] = g[C]*g[B]*g[A];
|
||||||
|
|
||||||
m["3052"] = g[3]*g[0]*g[5]*g[2];
|
m["3052"] = g[D_BAR]*g[A]*g[B]*g[C];
|
||||||
m["305"] = g[3]*g[0]*g[5];
|
m["305"] = g[D_BAR]*g[A]*g[B];
|
||||||
m["30"] = g[3]*g[0];
|
m["30"] = g[D_BAR]*g[A];
|
||||||
m["3"] = g[3];
|
m["3"] = g[D_BAR];
|
||||||
m["36"] = g[3]*g[6];
|
m["36"] = g[D_BAR]*g[C_BAR];
|
||||||
m["361"] = g[3]*g[6]*g[1];
|
m["361"] = g[D_BAR]*g[C_BAR]*g[B_BAR];
|
||||||
|
|
||||||
m["4163"] = g[4]*g[1]*g[6]*g[3];
|
m["4163"] = g[A_BAR]*g[B_BAR]*g[C_BAR]*g[D_BAR];
|
||||||
m["416"] = g[4]*g[1]*g[6];
|
m["416"] = g[A_BAR]*g[B_BAR]*g[C_BAR];
|
||||||
m["41"] = g[4]*g[1];
|
m["41"] = g[A_BAR]*g[B_BAR];
|
||||||
m["4"] = g[4];
|
m["4"] = g[A_BAR];
|
||||||
m["47"] = g[4]*g[7];
|
m["47"] = g[A_BAR]*g[D];
|
||||||
m["472"] = g[4]*g[7]*g[2];
|
m["472"] = g[A_BAR]*g[D]*g[C];
|
||||||
|
|
||||||
m["5274"] = g[5]*g[2]*g[7]*g[4];
|
m["5274"] = g[B]*g[C]*g[D]*g[A_BAR];
|
||||||
m["527"] = g[5]*g[2]*g[7];
|
m["527"] = g[B]*g[C]*g[D];
|
||||||
m["52"] = g[5]*g[2];
|
m["52"] = g[B]*g[C];
|
||||||
m["5"] = g[5];
|
m["5"] = g[B];
|
||||||
m["50"] = g[5]*g[0];
|
m["50"] = g[B]*g[A];
|
||||||
m["503"] = g[5]*g[0]*g[3];
|
m["503"] = g[B]*g[A]*g[D_BAR];
|
||||||
|
|
||||||
m["6305"] = g[6]*g[3]*g[0]*g[5];
|
m["6305"] = g[C_BAR]*g[D_BAR]*g[A]*g[B];
|
||||||
m["630"] = g[6]*g[3]*g[0];
|
m["630"] = g[C_BAR]*g[D_BAR]*g[A];
|
||||||
m["63"] = g[6]*g[3];
|
m["63"] = g[C_BAR]*g[D_BAR];
|
||||||
m["6"] = g[6];
|
m["6"] = g[C_BAR];
|
||||||
m["61"] = g[6]*g[1];
|
m["61"] = g[C_BAR]*g[B_BAR];
|
||||||
m["614"] = g[6]*g[1]*g[4];
|
m["614"] = g[C_BAR]*g[B_BAR]*g[A_BAR];
|
||||||
|
|
||||||
m["7416"] = g[7]*g[4]*g[1]*g[6];
|
m["7416"] = g[D]*g[A_BAR]*g[B_BAR]*g[C_BAR];
|
||||||
m["741"] = g[7]*g[4]*g[1];
|
m["741"] = g[D]*g[A_BAR]*g[B_BAR];
|
||||||
m["74"] = g[7]*g[4];
|
m["74"] = g[D]*g[A_BAR];
|
||||||
m["7"] = g[7];
|
m["7"] = g[D];
|
||||||
m["72"] = g[7]*g[2];
|
m["72"] = g[D]*g[C];
|
||||||
m["725"] = g[7]*g[2]*g[5];
|
m["725"] = g[D]*g[C]*g[B];
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +213,47 @@ public:
|
||||||
std::string to_string() const {
|
std::string to_string() const {
|
||||||
return _wrd.to_string();
|
return _wrd.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void get_generators(std::vector<Self>& gens) {
|
||||||
|
gens.push_back(Self(A));
|
||||||
|
gens.push_back(Self(B_BAR));
|
||||||
|
gens.push_back(Self(C));
|
||||||
|
gens.push_back(Self(D_BAR));
|
||||||
|
gens.push_back(Self(A_BAR));
|
||||||
|
gens.push_back(Self(B));
|
||||||
|
gens.push_back(Self(C_BAR));
|
||||||
|
gens.push_back(Self(D));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void get_generator_coefficients(std::vector< std::pair< std::pair<NT,NT>,
|
||||||
|
std::pair<NT,NT> > >& gens) {
|
||||||
|
typedef typename std::pair<NT,NT> Complex;
|
||||||
|
typedef typename std::pair<Complex,Complex> Matrix;
|
||||||
|
|
||||||
|
NT sq2 = CGAL::sqrt(NT(2));
|
||||||
|
NT xi = NT(1) + sq2;
|
||||||
|
NT rxi = CGAL::sqrt(xi);
|
||||||
|
|
||||||
|
Complex alpha(xi,NT(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]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -202,18 +268,7 @@ std::ostream& operator<<(std::ostream& s, const Hyperbolic_octagon_translation<N
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template < typename NT >
|
|
||||||
void get_generators(std::vector< Hyperbolic_octagon_translation<NT> >& gens) {
|
|
||||||
typedef Hyperbolic_octagon_translation<NT> Translation;
|
|
||||||
gens.push_back(Translation(0));
|
|
||||||
gens.push_back(Translation(1));
|
|
||||||
gens.push_back(Translation(2));
|
|
||||||
gens.push_back(Translation(3));
|
|
||||||
gens.push_back(Translation(4));
|
|
||||||
gens.push_back(Translation(5));
|
|
||||||
gens.push_back(Translation(6));
|
|
||||||
gens.push_back(Translation(7));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -104,34 +104,6 @@ std::ostream& operator<<(std::ostream& os, const Hyperbolic_octagon_translation_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template < class ECplx >
|
|
||||||
void get_generators(std::vector< Hyperbolic_octagon_translation_matrix<ECplx> >& gens) {
|
|
||||||
typedef Hyperbolic_octagon_translation_matrix<ECplx> Matrix;
|
|
||||||
typedef typename Matrix::NT NT;
|
|
||||||
typedef typename Matrix::Matrix_element Matrix_element;
|
|
||||||
|
|
||||||
NT sq2 = CGAL::sqrt(NT(2));
|
|
||||||
NT xi = NT(1) + sq2;
|
|
||||||
NT rxi = CGAL::sqrt(xi);
|
|
||||||
|
|
||||||
Matrix_element A = Matrix_element(xi, 0); // all matrices have the same _alpha
|
|
||||||
|
|
||||||
// This vector holds the different _betas
|
|
||||||
std::vector<Matrix_element> B(8, Matrix_element());
|
|
||||||
|
|
||||||
B[0] = Matrix_element(sq2 * rxi, 0 );
|
|
||||||
B[1] = Matrix_element(rxi, rxi );
|
|
||||||
B[2] = Matrix_element(0, sq2 * rxi );
|
|
||||||
B[3] = Matrix_element(-rxi, rxi );
|
|
||||||
B[4] = Matrix_element(-sq2 * rxi, 0 );
|
|
||||||
B[5] = Matrix_element(-rxi, -rxi );
|
|
||||||
B[6] = Matrix_element(0, -sq2 * rxi );
|
|
||||||
B[7] = Matrix_element(rxi, -rxi );
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
gens.push_back(Matrix(A, B[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue