mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-22 16:24:07 +00:00
arb:: removed angleofs function, 'legacy' variable for the old behavior
This commit is contained in:
parent
0739a7c16e
commit
123b49e0f3
@ -14,6 +14,8 @@ EX namespace arb {
|
|||||||
|
|
||||||
EX int affine_limit = 200;
|
EX int affine_limit = 200;
|
||||||
|
|
||||||
|
EX bool legacy; /* angleofs command */
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
|
|
||||||
struct shape {
|
struct shape {
|
||||||
@ -151,6 +153,7 @@ void shape::build_from_angles_edges() {
|
|||||||
int n = isize(angles);
|
int n = isize(angles);
|
||||||
hyperpoint ctr = Hypc;
|
hyperpoint ctr = Hypc;
|
||||||
vector<transmatrix> matrices;
|
vector<transmatrix> matrices;
|
||||||
|
if(!legacy) for(auto& a: angles) a += M_PI;
|
||||||
for(int i=0; i<n; i++) {
|
for(int i=0; i<n; i++) {
|
||||||
matrices.push_back(at);
|
matrices.push_back(at);
|
||||||
println(hlog, "at = ", at);
|
println(hlog, "at = ", at);
|
||||||
@ -172,6 +175,7 @@ void shape::build_from_angles_edges() {
|
|||||||
}
|
}
|
||||||
println(hlog, "ctr = ", ctr);
|
println(hlog, "ctr = ", ctr);
|
||||||
}
|
}
|
||||||
|
if(!legacy) for(auto& a: angles) a -= M_PI;
|
||||||
ctr = normalize(ctr);
|
ctr = normalize(ctr);
|
||||||
for(auto& v: vertices) v = gpushxto0(ctr) * v;
|
for(auto& v: vertices) v = gpushxto0(ctr) * v;
|
||||||
}
|
}
|
||||||
@ -296,8 +300,14 @@ EX void load(const string& fname, bool after_sliding IS(false)) {
|
|||||||
set_flag(ginf[gArbitrary].flags, qAFFINE, false);
|
set_flag(ginf[gArbitrary].flags, qAFFINE, false);
|
||||||
geom3::apply_always3();
|
geom3::apply_always3();
|
||||||
}
|
}
|
||||||
|
else if(ep.eat("legacysign.")) {
|
||||||
|
if(legacy) angleunit *= -1;
|
||||||
|
}
|
||||||
else if(ep.eat("angleunit(")) angleunit = real(ep.parsepar());
|
else if(ep.eat("angleunit(")) angleunit = real(ep.parsepar());
|
||||||
else if(ep.eat("angleofs(")) angleofs = real(ep.parsepar());
|
else if(ep.eat("angleofs(")) {
|
||||||
|
angleofs = real(ep.parsepar());
|
||||||
|
if(!legacy) angleofs = 0;
|
||||||
|
}
|
||||||
else if(ep.eat("distunit(")) distunit = real(ep.parsepar());
|
else if(ep.eat("distunit(")) distunit = real(ep.parsepar());
|
||||||
else if(ep.eat("line(")) {
|
else if(ep.eat("line(")) {
|
||||||
addflag(arcm::sfLINE);
|
addflag(arcm::sfLINE);
|
||||||
@ -893,6 +903,9 @@ int readArgs() {
|
|||||||
shift();
|
shift();
|
||||||
run(args());
|
run(args());
|
||||||
}
|
}
|
||||||
|
else if(argis("-arb-legacy")) {
|
||||||
|
legacy = true;
|
||||||
|
}
|
||||||
else if(argis("-arb-slider")) {
|
else if(argis("-arb-slider")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
shift();
|
shift();
|
||||||
|
12
util.cpp
12
util.cpp
@ -297,10 +297,14 @@ cld exp_parser::parse(int prio) {
|
|||||||
if(result < 0) result = -result;
|
if(result < 0) result = -result;
|
||||||
while(result > 2 * M_PI) result -= 2 * M_PI;
|
while(result > 2 * M_PI) result -= 2 * M_PI;
|
||||||
if(result > M_PI) result = 2 * M_PI - result;
|
if(result > M_PI) result = 2 * M_PI - result;
|
||||||
res = M_PI - result;
|
|
||||||
|
if(arb::legacy) {
|
||||||
if(extra_params.count("angleofs"))
|
res = M_PI - result;
|
||||||
res -= extra_params["angleofs"];
|
if(extra_params.count("angleofs"))
|
||||||
|
res -= extra_params["angleofs"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
res = result;
|
||||||
|
|
||||||
if(extra_params.count("angleunit"))
|
if(extra_params.count("angleunit"))
|
||||||
res /= extra_params["angleunit"];
|
res /= extra_params["angleunit"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user