mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-05 03:02:49 +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);
|
ld iv = intval(h1, h2);
|
||||||
switch(cgclass) {
|
switch(cgclass) {
|
||||||
case gcEuclid:
|
case gcEuclid:
|
||||||
|
if(iv < 0) return 0;
|
||||||
return sqrt(iv);
|
return sqrt(iv);
|
||||||
case gcHyperbolic:
|
case gcHyperbolic:
|
||||||
|
if(iv < 0) return 0;
|
||||||
return 2 * asinh(sqrt(iv) / 2);
|
return 2 * asinh(sqrt(iv) / 2);
|
||||||
case gcSphere:
|
case gcSphere:
|
||||||
return 2 * asin_auto_clamp(sqrt(iv) / 2);
|
return 2 * asin_auto_clamp(sqrt(iv) / 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user