1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-02 02:37:55 +00:00

New file geometry2.cpp, with moved ggmatrix, relative_matrix, virtualRebase, and new get_corner_position family. Refactored in floorpatterns, textures, and grid to use get_corner_position family.

This commit is contained in:
Zeno Rogue
2018-08-17 16:47:06 +02:00
parent 749ad03138
commit 9faa285814
18 changed files with 753 additions and 887 deletions

View File

@@ -3,29 +3,6 @@
namespace hr {
double randd() { return (rand() + .5) / (RAND_MAX + 1.); }
double cellgfxdist(cell *c, int i) {
if(gp::on || irr::on) return hdist0(tC0(shmup::calc_relative_matrix(c->mov[i], c, i)));
return nonbitrunc ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : crossf;
}
transmatrix cellrelmatrix(cell *c, int i) {
if(gp::on) return shmup::calc_relative_matrix(c->mov[i], c, i);
double d = cellgfxdist(c, i);
return ddspin(c, i) * xpush(d) * iddspin(c->mov[i], c->spin(i), euclid ? 0 : S42);
}
hyperpoint randomPointIn(int t) {
while(true) {
hyperpoint h = spin(2*M_PI*(randd()-.5)/t) * tC0(xpush(asinh(randd())));
double d =
nonbitrunc ? tessf : t == 6 ? hexhexdist : crossf;
if(hdist0(h) < hdist0(xpush(-d) * h))
return spin(2*M_PI/t * (rand() % t)) * h;
}
}
struct snowball {
transmatrix T;
transmatrix global;