rug :: partially generalized to 3D (but no interesting results)

This commit is contained in:
Zeno Rogue committed 2019-09-12 22:50:02 +02:00
1 parent 0f783f86aa
commit 92a22a5e3f
3 files changed
+47 -24

No files matched your search

+10
View File
@@ -190,6 +190,16 @@ ld hypot_d(int d, const hyperpoint& h) {
return sqrt(sqhypot_d(d, h));
}
ld sqdhypot_d(int d, const hyperpoint& a, const hyperpoint& b) {
ld sum = 0;
for(int i=0; i<d; i++) sum += (a[i]-b[i])*(a[i]-b[i]);
return sum;
}
ld dhypot_d(int d, const hyperpoint& a, const hyperpoint& b) {
return sqrt(sqdhypot_d(d, a, b));
}
ld zlevel(const hyperpoint &h) {
if(euclid) return h[GDIM];
else if(sphere) return sqrt(intval(h, Hypc));