mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-27 23:42:53 +00:00
removed the dhypot functions
This commit is contained in:
parent
e77a6f3440
commit
986bf0ee9a
@ -194,16 +194,6 @@ EX ld hypot_d(int d, const hyperpoint& h) {
|
|||||||
return sqrt(sqhypot_d(d, h));
|
return sqrt(sqhypot_d(d, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
EX 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
EX ld dhypot_d(int d, const hyperpoint& a, const hyperpoint& b) {
|
|
||||||
return sqrt(sqdhypot_d(d, a, b));
|
|
||||||
}
|
|
||||||
|
|
||||||
EX ld zlevel(const hyperpoint &h) {
|
EX ld zlevel(const hyperpoint &h) {
|
||||||
if(translatable) return h[GDIM];
|
if(translatable) return h[GDIM];
|
||||||
else if(sphere) return sqrt(intval(h, Hypc));
|
else if(sphere) return sqrt(intval(h, Hypc));
|
||||||
|
6
rug.cpp
6
rug.cpp
@ -589,7 +589,7 @@ void verify() {
|
|||||||
ld l = e.len;
|
ld l = e.len;
|
||||||
|
|
||||||
ld l0;
|
ld l0;
|
||||||
if(fast_euclidean) l0 = sqdhypot_d(rugdim, m->flat, m2->flat);
|
if(fast_euclidean) l0 = sqhypot_d(rugdim, m->flat - m2->flat);
|
||||||
else {
|
else {
|
||||||
normalizer n(m->flat, m2->flat);
|
normalizer n(m->flat, m2->flat);
|
||||||
hyperpoint h1 = n(m->flat);
|
hyperpoint h1 = n(m->flat);
|
||||||
@ -694,7 +694,7 @@ void enqueue(rugpoint *m) {
|
|||||||
bool force_euclidean(rugpoint& m1, rugpoint& m2, double rd, bool is_anticusp = false, double d1=1, double d2=1) {
|
bool force_euclidean(rugpoint& m1, rugpoint& m2, double rd, bool is_anticusp = false, double d1=1, double d2=1) {
|
||||||
if(!m1.valid || !m2.valid) return false;
|
if(!m1.valid || !m2.valid) return false;
|
||||||
// double rd = hdist(m1.h, m2.h) * xd;
|
// double rd = hdist(m1.h, m2.h) * xd;
|
||||||
double t = sqdhypot_d(rugdim, m1.flat, m2.flat);
|
double t = sqhypot_d(rugdim, m1.flat - m2.flat);
|
||||||
if(is_anticusp && t > rd*rd) return false;
|
if(is_anticusp && t > rd*rd) return false;
|
||||||
t = sqrt(t);
|
t = sqrt(t);
|
||||||
current_total_error += (t-rd) * (t-rd);
|
current_total_error += (t-rd) * (t-rd);
|
||||||
@ -806,7 +806,7 @@ ld sse(const hyperpoint& h) {
|
|||||||
ld l = p.first;
|
ld l = p.first;
|
||||||
ld l0;
|
ld l0;
|
||||||
if(fast_euclidean)
|
if(fast_euclidean)
|
||||||
l0 = dhypot_d(rugdim, h, p.second->flat);
|
l0 = hypot_d(rugdim, h - p.second->flat);
|
||||||
else {
|
else {
|
||||||
normalizer n(h, p.second->flat);
|
normalizer n(h, p.second->flat);
|
||||||
hyperpoint h1 = n(h);
|
hyperpoint h1 = n(h);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user