mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-07 11:52:51 +00:00
3D:: fixed (?) virtualRebase
This commit is contained in:
parent
e7110b7492
commit
02920b5d2f
@ -268,7 +268,7 @@ transmatrix calc_relative_matrix_help(cell *c, heptagon *h1) {
|
|||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
||||||
if(euclid || sphere) {
|
if((euclid || sphere) && DIM == 2) {
|
||||||
again:
|
again:
|
||||||
if(euwrap) for(int i=0; i<6; i++) {
|
if(euwrap) for(int i=0; i<6; i++) {
|
||||||
// fix cylinder and square grid
|
// fix cylinder and square grid
|
||||||
@ -297,7 +297,7 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
double currz = check(at)[2];
|
double currz = check(at)[DIM];
|
||||||
|
|
||||||
heptagon *h = base->master;
|
heptagon *h = base->master;
|
||||||
|
|
||||||
@ -305,11 +305,11 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
|||||||
|
|
||||||
transmatrix bestV;
|
transmatrix bestV;
|
||||||
|
|
||||||
if(!binarytiling) for(int d=0; d<S7; d++) {
|
if(DIM == 2 && !binarytiling) for(int d=0; d<S7; d++) {
|
||||||
heptspin hs(h, d, false);
|
heptspin hs(h, d, false);
|
||||||
heptspin hs2 = hs + wstep;
|
heptspin hs2 = hs + wstep;
|
||||||
transmatrix V2 = spin(-hs2.spin*2*M_PI/S7) * invheptmove[d];
|
transmatrix V2 = spin(-hs2.spin*2*M_PI/S7) * invheptmove[d];
|
||||||
double newz = check(V2 * at) [2];
|
double newz = check(V2 * at) [DIM];
|
||||||
if(newz < currz) {
|
if(newz < currz) {
|
||||||
currz = newz;
|
currz = newz;
|
||||||
bestV = V2;
|
bestV = V2;
|
||||||
@ -325,7 +325,7 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
|||||||
if(tohex && BITRUNCATED) for(int d=0; d<S7; d++) {
|
if(tohex && BITRUNCATED) for(int d=0; d<S7; d++) {
|
||||||
cell *c = createMov(base, d);
|
cell *c = createMov(base, d);
|
||||||
transmatrix V2 = spin(-base->c.spin(d)*2*M_PI/S6) * invhexmove[d];
|
transmatrix V2 = spin(-base->c.spin(d)*2*M_PI/S6) * invhexmove[d];
|
||||||
double newz = check(V2 *at) [2];
|
double newz = check(V2 *at) [DIM];
|
||||||
if(newz < currz) {
|
if(newz < currz) {
|
||||||
currz = newz;
|
currz = newz;
|
||||||
bestV = V2;
|
bestV = V2;
|
||||||
@ -337,12 +337,12 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
|||||||
at = bestV * at;
|
at = bestV * at;
|
||||||
}
|
}
|
||||||
else at = master_relative(base, true) * at;
|
else at = master_relative(base, true) * at;
|
||||||
if(binarytiling || (tohex && (GOLDBERG || IRREGULAR))) {
|
if(binarytiling || (tohex && (GOLDBERG || IRREGULAR)) || DIM == 3) {
|
||||||
while(true) {
|
while(true) {
|
||||||
newbase = NULL;
|
newbase = NULL;
|
||||||
forCellCM(c2, base) {
|
forCellCM(c2, base) {
|
||||||
transmatrix V2 = calc_relative_matrix(base, c2, C0);
|
transmatrix V2 = calc_relative_matrix(base, c2, C0);
|
||||||
double newz = check(V2 * at) [2];
|
double newz = check(V2 * at) [DIM];
|
||||||
if(newz < currz) {
|
if(newz < currz) {
|
||||||
currz = newz;
|
currz = newz;
|
||||||
bestV = V2;
|
bestV = V2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user