mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-27 21:23:19 +00:00
random_spin3 is now a separate function
This commit is contained in:
parent
782859f93b
commit
96f84c77ca
@ -550,14 +550,16 @@ EX transmatrix cspin(int a, int b, ld alpha) {
|
|||||||
/** rotate by alpha degrees in the XY plane */
|
/** rotate by alpha degrees in the XY plane */
|
||||||
EX transmatrix spin(ld alpha) { return cspin(0, 1, alpha); }
|
EX transmatrix spin(ld alpha) { return cspin(0, 1, alpha); }
|
||||||
|
|
||||||
|
EX transmatrix random_spin3() {
|
||||||
|
ld alpha2 = asin(randd() * 2 - 1);
|
||||||
|
ld alpha = randd() * 2 * M_PI;
|
||||||
|
ld alpha3 = randd() * 2 * M_PI;
|
||||||
|
return cspin(0, 1, alpha) * cspin(0, 2, alpha2) * cspin(1, 2, alpha3);
|
||||||
|
}
|
||||||
|
|
||||||
EX transmatrix random_spin() {
|
EX transmatrix random_spin() {
|
||||||
if(WDIM == 2) return spin(randd() * 2 * M_PI);
|
if(WDIM == 2) return spin(randd() * 2 * M_PI);
|
||||||
else {
|
else return random_spin3();
|
||||||
ld alpha2 = asin(randd() * 2 - 1);
|
|
||||||
ld alpha = randd() * 2 * M_PI;
|
|
||||||
ld alpha3 = randd() * 2 * M_PI;
|
|
||||||
return cspin(0, 1, alpha) * cspin(0, 2, alpha2) * cspin(1, 2, alpha3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EX transmatrix eupush(ld x, ld y) {
|
EX transmatrix eupush(ld x, ld y) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user