1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-18 11:14:49 +00:00

missing functions acos_auto and edge_of_triangle_with_angles

This commit is contained in:
Zeno Rogue 2019-04-29 03:39:14 +02:00
parent f98448464a
commit e28373448d

View File

@ -67,6 +67,14 @@ ld asin_auto(ld x) {
}
}
ld acos_auto(ld x) {
switch(cgclass) {
case gcHyperbolic: return acosh(x);
case gcSphere: return acos(x);
default: return x;
}
}
ld volume_auto(ld r) {
switch(cgclass) {
case gcEuclid: return 4 * r * r * r / 3 * M_PI;
@ -121,6 +129,11 @@ ld atan2_auto(ld y, ld x) {
}
}
// cosine rule -- edge opposite alpha
ld edge_of_triangle_with_angles(ld alpha, ld beta, ld gamma) {
return acos_auto((cos(alpha) + cos(beta) * cos(gamma)) / (sin(beta) * sin(gamma)));
}
// hyperbolic point:
//===================