1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-18 06:30:41 +00:00

geo_inner

This commit is contained in:
Zeno Rogue 2024-10-06 22:16:56 +02:00
parent 1a1c7ae21d
commit a14470cc97

View File

@ -451,6 +451,14 @@ EX bool zero_d(int d, hyperpoint h) {
return true; return true;
} }
/** inner product in the current geometry */
EX ld geo_inner(const hyperpoint &h1, const hyperpoint &h2) {
ld res = 0;
for(int i=0; i<MDIM; i++) res += h1[i] * h2[i] * sig(i);
return res;
}
/** this function returns approximate square of distance between two points /** this function returns approximate square of distance between two points
* (in the spherical analogy, this would be the distance in the 3D space, * (in the spherical analogy, this would be the distance in the 3D space,
* through the interior, not on the surface) * through the interior, not on the surface)