fixup to shift: moved the shift methods to hyperpoint, also removed _auto

This commit is contained in:
Zeno Rogue 2022-12-17 11:16:47 +01:00
parent 70718b2602
commit e1301e10bd
2 changed files with 20 additions and 28 deletions

View File

@ -1626,6 +1626,26 @@ EX bool asign(ld y1, ld y2) { return signum(y1) != signum(y2); }
EX ld xcross(ld x1, ld y1, ld x2, ld y2) { return x1 + (x2 - x1) * y1 / (y1 - y2); }
#if HDR
enum eShiftMethod { smProduct, smIsometric, smEmbedded, smLie, smGeodesic };
enum eEmbeddedShiftMethodChoice { smcNone, smcBoth, smcAuto };
#endif
EX eEmbeddedShiftMethodChoice embedded_shift_method_choice = smcBoth;
EX bool use_embedded_shift(bool automatic) {
if(automatic) return embedded_shift_method_choice;
return embedded_shift_method_choice == smcBoth;
}
EX eShiftMethod shift_method(bool automatic IS(false)) {
if(gproduct) return smProduct;
if(embedded_plane && use_embedded_shift(automatic)) return nonisotropic ? smLie : smEmbedded;
if(!nonisotropic && !stretch::in()) return smIsometric;
if(!nisot::geodesic_movement && !embedded_plane) return smLie;
return smGeodesic;
}
EX transmatrix parallel_transport(const transmatrix Position, const transmatrix& ori, const hyperpoint direction) {
if(nonisotropic) return nisot::parallel_transport(Position, direction);
else if(gproduct) {

View File

@ -3206,34 +3206,6 @@ EX hyperpoint lie_log(hyperpoint h) {
return h;
}
#if HDR
enum eShiftMethod { smProduct, smIsometric, smEmbedded, smLie, smGeodesic };
enum eEmbeddedShiftMethodChoice { smcNone, smcBoth, smcAuto };
#endif
EX eEmbeddedShiftMethodChoice embedded_shift_method_choice = smcBoth;
EX bool use_embedded_shift(bool automatic) {
if(automatic) return embedded_shift_method_choice;
return embedded_shift_method_choice == smcBoth;
}
EX eShiftMethod shift_method(bool automatic IS(false)) {
if(gproduct) return smProduct;
if(embedded_plane && use_embedded_shift(automatic)) return nonisotropic ? smLie : smEmbedded;
if(!nonisotropic && !stretch::in()) return smIsometric;
if(!nisot::geodesic_movement && !embedded_plane) return smLie;
return smGeodesic;
}
EX eShiftMethod shift_method_auto() {
if(gproduct) return smProduct;
if(embedded_plane) return nonisotropic ? smLie : smEmbedded;
if(!nonisotropic && !stretch::in()) return smIsometric;
if(!nisot::geodesic_movement) return smLie;
return smGeodesic;
}
/** shift the view according to the given tangent vector */
EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V, eShiftMethod sm IS(shift_method())) {
switch(sm) {