mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-26 21:37:02 +00:00
fixed a bug with hdist returning nan due to precision errors
This commit is contained in:
parent
8d2b6a0093
commit
7e2f6629fd
@ -588,8 +588,10 @@ double hdist(const hyperpoint& h1, const hyperpoint& h2) {
|
||||
ld iv = intval(h1, h2);
|
||||
switch(cgclass) {
|
||||
case gcEuclid:
|
||||
if(iv < 0) return 0;
|
||||
return sqrt(iv);
|
||||
case gcHyperbolic:
|
||||
if(iv < 0) return 0;
|
||||
return 2 * asinh(sqrt(iv) / 2);
|
||||
case gcSphere:
|
||||
return 2 * asin_auto_clamp(sqrt(iv) / 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user