mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-20 09:52:50 +00:00
geometry improvements
This commit is contained in:
parent
59ab37d509
commit
2b1d189074
2
hyper.h
2
hyper.h
@ -213,7 +213,7 @@ namespace hyperpoint_vec {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// inner product
|
// inner product (in R^3)
|
||||||
inline ld operator | (hyperpoint h1, hyperpoint h2) {
|
inline ld operator | (hyperpoint h1, hyperpoint h2) {
|
||||||
return h1[0] * h2[0] + h1[1] * h2[1] + h1[2] * h2[2];
|
return h1[0] * h2[0] + h1[1] * h2[1] + h1[2] * h2[2];
|
||||||
}
|
}
|
||||||
|
@ -403,11 +403,13 @@ transmatrix rpushxto0(const hyperpoint& H) {
|
|||||||
|
|
||||||
// generalization: H[1] can be non-zero
|
// generalization: H[1] can be non-zero
|
||||||
transmatrix gpushxto0(const hyperpoint& H) {
|
transmatrix gpushxto0(const hyperpoint& H) {
|
||||||
|
if(euclid) return eupush(-H[0], -H[1]);
|
||||||
hyperpoint H2 = spintox(H) * H;
|
hyperpoint H2 = spintox(H) * H;
|
||||||
return rspintox(H) * pushxto0(H2) * spintox(H);
|
return rspintox(H) * pushxto0(H2) * spintox(H);
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix rgpushxto0(const hyperpoint& H) {
|
transmatrix rgpushxto0(const hyperpoint& H) {
|
||||||
|
if(euclid) return eupush(H[0], H[1]);
|
||||||
hyperpoint H2 = spintox(H) * H;
|
hyperpoint H2 = spintox(H) * H;
|
||||||
return rspintox(H) * rpushxto0(H2) * spintox(H);
|
return rspintox(H) * rpushxto0(H2) * spintox(H);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user