1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-05 06:08:05 +00:00

used cyclefix and raddif in more places; (c)spin90, (c)spin180 and spin180 functions; rephrased M_PI in terms of TAU and x._deg when applicable

This commit is contained in:
Zeno Rogue
2022-11-12 22:38:45 +01:00
parent 563b9c1f74
commit 06523e063e
100 changed files with 750 additions and 757 deletions

View File

@@ -23,8 +23,8 @@ void apply_duality(shiftmatrix& S) {
S.T = Duality * S.T * Duality;
};
if(use_duality == 2) {
S = ads_matrix(Id, -90*degree) * S * ads_matrix(Id, +90*degree);
S.T = spin(90*degree) * S.T;
S = ads_matrix(Id, -90._deg) * S * ads_matrix(Id, +90._deg);
S.T = spin(90._deg) * S.T;
}
}
@@ -278,7 +278,7 @@ void view_ads_game() {
for(int u=0; u<30; u++) {
auto bcurrent = current;
transmatrix T = rgpushxto0( spin(12*degree*u) * xpush0(0.5) );
transmatrix T = rgpushxto0( spin(TAU*u/30) * xpush0(0.5) );
current.T = current.T * T;
auto base1 = findflat(ads_point(C0, 0));

View File

@@ -140,7 +140,7 @@ struct rock_generator {
for(int i=0; i<qty; i++) {
cshift ++;
for(ld j=-3; j<=3; j++) {
add(spin(alpha + i * spinv) * cspin(0, 2, j * step) * spin(90*degree) * lorentz(0, 3, rapidity));
add(spin(alpha + i * spinv) * cspin(0, 2, j * step) * spin90() * lorentz(0, 3, rapidity));
}
}
}
@@ -197,7 +197,7 @@ struct rock_generator {
ld step = rand_range(.2, .5);
ld alpha = rand_range(0, TAU);
cshift += rand_range(0.5, 1) * (1 + cshift / 10);
auto r = add(spin(alpha) * cspin(0, 2, step) * spin(90*degree) * lorentz(0, 3, rapidity));
auto r = add(spin(alpha) * cspin(0, 2, step) * spin90() * lorentz(0, 3, rapidity));
eResourceType rt = eResourceType(2 + rand() % 4);
if(rt == rtGold) rt = rtHull;
r->type = oResource;

View File

@@ -98,10 +98,10 @@ void draw_texture(texture_to_use& tu) {
int pts_id = 0;
auto add = [&] (int x, int y) {
ld x0 = (y-(YSCALE/2.)) / YSCALE * M_PI * 4;
ld x0 = (y-(YSCALE/2.)) / YSCALE * 720._deg;
ld mercator_y0 = (x-(XSCALE/2.)) / (XSCALE/2.) * M_PI * MWIDTH;
ld y0 = asin(tanh(2 * mercator_y0));
ld y1 = y0 - 90 * degree;
ld y1 = y0 - 90._deg;
et.tinf.tvertices.push_back(glhr::makevertex(x * 1. / XSCALE, .5 + (y-0.5) / MWIDTH / YSCALE, 0));
@@ -111,7 +111,7 @@ void draw_texture(texture_to_use& tu) {
ld s = current.shift - tu.ctr;
// We actually want to compute this, but this is not precise enough:
// cr = ds_cross0(current.T * lorentz(2, 3, -current.shift) * cspin(0, 1, x0) * cspin(0, 2, y0 - 90*degree));
// cr = ds_cross0(current.T * lorentz(2, 3, -current.shift) * cspin(0, 1, x0) * cspin(0, 2, y0 - 90._deg));
// Here is what we get for current.T == Id: (computed with sympy)
hyperpoint now;

View File

@@ -66,7 +66,7 @@ void compute_life(cell *c, transmatrix S1, const worldline_visitor& wv) {
int iter = 0;
cell *cur_c = c;
auto cur_w = hybrid::get_where(c);
while(t < 2 * M_PI) {
while(t < TAU) {
iter++;
auto last_w = cur_w;
auto next_w = cur_w;
@@ -74,7 +74,7 @@ void compute_life(cell *c, transmatrix S1, const worldline_visitor& wv) {
ld next_t;
ld last_time = t;
cell *next_c = nullptr;
binsearch(t, t+M_PI/2, [&] (ld t1) {
binsearch(t, t+90._deg, [&] (ld t1) {
S1 = S1 * chg_shift(t1 - last_time);
last_time = t1;
virtualRebase(cur_c, S1);

View File

@@ -228,7 +228,7 @@ bool handleKey(int sym, int uni) {
}
void auto_shift() {
current.T = spin(30*degree) * lorentz(0, 3, 1) * spin(-30*degree) * current.T;
current.T = spin(30._deg) * lorentz(0, 3, 1) * spin(-30._deg) * current.T;
}
/* in our cellular automaton, each tile is affected by its own history, and the spatial neighbors of its ms-step history */
@@ -509,7 +509,7 @@ void ads_ca_check() {
}
ld get_shift_cycles(ld shift) {
return floor(shift / 2 / M_PI + .5) * 2 * M_PI;
return floor(shift / TAU + .5) * TAU;
}
shiftpoint shift_perfect_mul(shiftmatrix T, shiftpoint h) {
@@ -524,8 +524,7 @@ shiftpoint shift_perfect_mul(shiftmatrix T, shiftpoint h) {
optimize_shift(cand);
if(i > 0) {
while(cand.shift > res.shift + M_PI) cand.shift -= 2 * M_PI;
while(cand.shift < res.shift - M_PI) cand.shift += 2 * M_PI;
cyclefix(cand.shift, res.shift);
}
res = cand;
}
@@ -567,7 +566,7 @@ flatresult findflat(shiftpoint h) {
/*
hyperpoint h = unshift(S0);
transmatrix deg90 = cspin(2, 3, 90*degree) * cspin(0, 1, 90*degree);
transmatrix deg90 = cspin(2, 3, 90._deg) * cspin(0, 1, 90._deg);
hyperpoint h0 = unshift(current) * h;
hyperpoint h90 = unshift(current) * deg90 * h;
@@ -586,7 +585,7 @@ flatresult findflat(shiftpoint h) {
else {
cost = 0;
sint = 1;
t = 90*degree;
t = 90._deg;
}
hyperpoint h2 = h0 * cost + h90 * sint;

View File

@@ -85,7 +85,7 @@ pair<hyperpoint, hyperpoint> trace_path(ld v) {
hyperpoint lctr = A;
ld angle = 0;
ld arclen = radius * M_PI/2;
ld arclen = radius * 90._deg;
auto change_angle = [&] (ld x) {
if(v == 0) return;
@@ -109,7 +109,7 @@ pair<hyperpoint, hyperpoint> trace_path(ld v) {
change_angle(4);
shift_to(E, true);
angle *= M_PI/2;
angle *= 90._deg;
if(v > 0) vperiod = vorig - v;
@@ -197,7 +197,7 @@ void prepare_nilform() {
println(hlog, "scale = ", scale);
println(hlog, nilize(E).second);
vperiod = radius * 2 * M_PI + hypot_d(3, B-A) + hypot_d(3, C-B) + hypot_d(3, D-C) + hypot_d(3, E-D);
vperiod = radius * TAU + hypot_d(3, B-A) + hypot_d(3, C-B) + hypot_d(3, D-C) + hypot_d(3, E-D);
println(hlog, "vperiod = ", vperiod);
make_routes();

View File

@@ -116,17 +116,17 @@ void face_animation() {
if(tf == 0) {
View = cspin(0, 2, 360 * degree * smoothen(t)) * View;
View = zpush(-0.1) * View;
View = cspin(0, 2, M_PI) * View;
View = cspin180(0, 2) * View;
back = 0;
}
else if(tf == 1) {
View = zpush(-0.1 * (1-smoothen(t))) * View;
if(t > .9)
back = -0.1 * smoothen(10*t-9);
View = cspin(0, 2, M_PI) * View;
View = cspin180(0, 2) * View;
}
else if(tf == 2) {
View = cspin(0, 2, 75*degree*sin(2*M_PI*smoothen(t))) * View;
View = cspin(0, 2, 75._deg*sin(TAU*smoothen(t))) * View;
}
else if(tf == 3) {
View = cspin(1, 2, up*degree*smoothen(t)) * View;

View File

@@ -35,7 +35,7 @@ void initialize(int max_ball) {
shShell.flags |= POLY_TRIANGLES;
auto pt = [] (int i, int j) {
cgi.hpcpush(direct_exp(/* cspin(0, 2, -30*degree) **/ cspin(2, 1, 90*degree) * cspin(0, 1, j * degree) * cspin(0, 2, i * M_PI / 2 / 16) * ztangent(r_big_ball)));
cgi.hpcpush(direct_exp(/* cspin(0, 2, -30._deg) **/ cspin90(2, 1) * cspin(0, 1, j * degree) * cspin(0, 2, i * 90._deg / 16) * ztangent(r_big_ball)));
};
for(int i=0; i<16; i++)
@@ -176,7 +176,7 @@ int args() {
cgi.require_shapes();
shift();
initialize(argi());
View = cspin(1, 2, M_PI/2);
View = cspin90(1, 2);
}
else return 1;

View File

@@ -889,16 +889,16 @@ void set_view() {
dist -= 1e-4;
move_dist = PIU(hdist(get_corner_position(currentmap->gamestart(), 0), get_corner_position(currentmap->gamestart(), 1)));
tView = xpush(-dist) * tView;
tView = spin(135*degree) * tView;
tView = spin(135._deg) * tView;
}
if(in_h2xe() && UNRECTIFIED)
tView = spin(135*degree) * tView;
tView = spin(135._deg) * tView;
if(in_h2xe() && S7 == 4)
tView = spin(90*degree) * tView;
tView = spin90() * tView;
if(in_s2xe())
tView = spin(90*degree) * tView;
tView = spin90() * tView;
if(in_e2xe())
tView = spin(90*degree) * tView;
tView = spin90() * tView;
}
void set_tview(transmatrix T) {
@@ -913,12 +913,12 @@ void set_tview(transmatrix T) {
ncenter = centerover;
// tView = View;
if(bgeom == 4)
tView = spin(72*degree*at.spin);
tView = spin(72._deg*at.spin);
else
tView = spin(90*degree*at.spin);
tView = spin(90._deg*at.spin);
if(at.mirrored)
tView = MirrorY * tView;
// tView = spin(90*degree*at.spin);
// tView = spin(90._deg*at.spin);
set_view();
pView = rel * tView;
@@ -934,7 +934,7 @@ void rotate_block(int d, bool camera_only) {
cellwalker at1 = flatspin(at, d);
if(camera_only || !shape_conflict(at1)) {
at = at1;
set_tview(spin(d*90*degree));
set_tview(spin(d*90._deg));
}
else playSound(cwt.at, "hit-crush3");
if(!camera_only) draw_shape();
@@ -1169,7 +1169,7 @@ void draw_screen(int xstart, bool show_next) {
#if CAP_VR
if(!explore) {
E4;
vrhr::hmd_at_ui = vrhr::hmd_ref_at * cspin(0, 2, 30*degree);
vrhr::hmd_at_ui = vrhr::hmd_ref_at * cspin(0, 2, 30._deg);
}
#endif
@@ -1190,16 +1190,16 @@ void draw_screen(int xstart, bool show_next) {
View = pView;
if(nil) {
centerover = at.at;
rotate_view(cspin(1, 2, -90*degree));
rotate_view(cspin90(2, 1));
shift_view(ztangent(3 * nilv::nilwidth));
rotate_view(cspin(0, 1, -90*degree));
rotate_view(cspin90(1, 0));
anims::moved();
}
else if(sol) {
centerover = at.at;
rotate_view(cspin(1, 2, 180*degree));
rotate_view(cspin180(1, 2));
shift_view(ztangent(1));
rotate_view(cspin(0, 1, -90*degree));
rotate_view(cspin90(1, 0));
anims::moved();
}
else {

View File

@@ -35,11 +35,8 @@ void do_analyze_grid(int maxv) {
alpha[qalpha++] = atan2(h1[0], h1[1]);
}
if(qalpha != 2) printf("Error: qalpha = %d\n", qalpha);
ld df = alpha[0] - alpha[1];
if(df<0) df = -df;
while(df > 2*M_PI) df -= 2*M_PI;
while(df > M_PI) df = 2*M_PI - df;
df /= 4*M_PI;
ld df = raddif(alpha[0], alpha[1]);
df /= 720._deg;
wstats[d][0] += df;
if(d==2) printf("df == %" PLDF " dd = %" PLDF "\n", df, dd);
wstats[d][1] += df*dd;

View File

@@ -114,7 +114,7 @@ void origcoords() {
using namespace rogueviz;
vertexcoords.resize(N);
for(int i=0; i<N; i++)
vertexcoords[i] = spin(coords[i].second * 2 * M_PI / 360) * xpush(coords[i].first) * C0;
vertexcoords[i] = spin(coords[i].second * degree) * xpush(coords[i].first) * C0;
}
// compute vertexcoords from the RogueViz representation

View File

@@ -100,8 +100,8 @@ void add_extra_projections() {
ld sy = y > 0 ? 1 : -1;
y /= sy;
ld z = 4. - 3. * (hyperbolic ? -sinh(y) : sin(y));
x = 2. * x * sqrt(z / 6. / M_PI);
y = sy * sqrt(2*M_PI/3) * (2. - sqrt(z));
x = 2. * x * sqrt(z / 1080._deg);
y = sy * sqrt(120._deg) * (2. - sqrt(z));
});
// https://en.wikipedia.org/wiki/Eckert_IV_projection
@@ -109,7 +109,7 @@ void add_extra_projections() {
cld theta = newton_inverse(
[] (cld th) { return th + sin(th) * cos(th) + 2. * sin(th); },
[] (cld th) { return 1. + cos(th) * cos(th) - sin(th) * sin(th) + 2. * cos(th); },
(2+M_PI/2) * sin(y), y);
(2+90._deg) * sin(y), y);
static ld cox = 2 / sqrt(4*M_PI+M_PI*M_PI);
static ld coy = 2 * sqrt(M_PI/(4+M_PI));
x = cox * x * (1. + cos(theta));
@@ -120,12 +120,12 @@ void add_extra_projections() {
add_complex("Ortelius", 0, [] (cld& x, cld& y) {
cld sx = (real(x)+imag(x)) > 0 ? 1 : -1;
x /= sx;
if(abs(real(x)) < 90*degree) {
if(abs(real(x)) < 90._deg) {
cld F = M_PI*M_PI / 8. / x + x / 2.;
x = (x - F + sqrt(F*F-y*y));
}
else {
x = sqrt(M_PI*M_PI/4 - y*y) + x - M_PI/2;
x = sqrt(M_PI*M_PI/4 - y*y) + x - 90._deg;
}
x *= sx;
});

View File

@@ -64,7 +64,7 @@ void compute_triangle_markers() {
println(hlog, triangle_markers);
for(int i=0; i<isize(fif); i++) {
turns.push_back(triangle_markers[i+1] == 0 ? 90*degree : 0);
turns.push_back(triangle_markers[i+1] == 0 ? 90._deg : 0);
}
}
@@ -480,7 +480,7 @@ auto fifteen_hook =
popScreenAll();
fullcenter();
if(lev == "coiled" || lev == "mobiusband")
View = spin(90*degree) * View;
View = spin90() * View;
if(lev == "mobiusband")
View = MirrorX * View;
}

View File

@@ -237,7 +237,7 @@ namespace flocking {
if(prod) {
NLP = inverse(vdata[0].m->ori);
NLP = hr::cspin(1, 2, 90 * degree) * spin(90 * degree) * NLP;
NLP = hr::cspin90(1, 2) * spin90() * NLP;
if(NLP[0][2]) {
auto downspin = -atan2(NLP[0][2], NLP[1][2]);
@@ -245,9 +245,9 @@ namespace flocking {
}
}
else {
View =spin(90 * degree) * View;
View =spin90() * View;
if(GDIM == 3) {
View = hr::cspin(1, 2, 90 * degree) * View;
View = hr::cspin90(1, 2) * View;
}
shift_view(ztangent(follow_dist));
}

View File

@@ -22,7 +22,7 @@ hyperpoint find_point(ld t) {
exp_parser ep;
auto &dict = ep.extra_params;
dict["t"] = t;
dict["phi"] = t * 2 * M_PI;
dict["phi"] = t * TAU;
dict["x"] = tan(t * M_PI - M_PI/2);
for(auto& ff: formula) {
ep.s = ff;

View File

@@ -52,7 +52,7 @@ shiftmatrix labelpos(shiftpoint h1, shiftpoint h2) {
shiftmatrix T = rgpushxto0(h);
hyperpoint hx = inverse_shift(T, h2);
ld alpha = atan2(-hx[1], hx[0]);
return T * xspinpush(alpha + M_PI/2, label_dist);
return T * xspinpush(alpha + 90._deg, label_dist);
}
ld widthfactor = 5;

View File

@@ -23,7 +23,7 @@ bool draw_horo63(cell *c, const shiftmatrix& V) {
array<hyperpoint, 6> c;
hyperpoint ctr;
for(int i=0; i<6; i++) {
hyperpoint h = spin(60*degree*i) * point31(1,0,0);
hyperpoint h = spin(TAU*i/6) * point31(1,0,0);
h[0] += x;
h[0] += y/2.;
h[1] += sqrt(3)/2. * y;

View File

@@ -55,7 +55,7 @@ void prepare_tf() {
hx[1] = h[1] * t * 2;
hx[2] = 0;
hx[3] = 1;
if(hyperbolic) hx = spin(45 * degree) * hx;
if(hyperbolic) hx = spin(45._deg) * hx;
hx = normalize(hx);
hx = zshift(hx, h[2]*(t*(sphere ? 3 : 7)));

View File

@@ -29,7 +29,7 @@ vector<reaction_t> models_to_use = {
pmodel = mdDisk;
pconf.alpha = 1000;
pconf.scale *= pconf.alpha;
View = cspin(1, 2, 20 * degree) * View;
View = cspin(1, 2, 20._deg) * View;
}
else {
pmodel = mdHyperboloid;
@@ -112,7 +112,7 @@ vector<reaction_t> models_to_use = {
pconf.scale = .5;
if(sphere) pconf.scale *= 2;
spherename = "loximuthal projection";
pconf.loximuthal_parameter = 15 * degree;
pconf.loximuthal_parameter = 15._deg;
},
[] {
pmodel = mdSinusoidal;
@@ -276,13 +276,13 @@ EX void compare() {
if(at4 == 0)
earthpart = lerp(255, earthpart, t4);
else if(at4 == 1)
View = spin(t4 * 180 * degree) * View;
View = spin(t4 * M_PI) * View;
else if(at4 == 2)
View = xpush(t4 * M_PI) * spin(M_PI) * View;
View = xpush(t4 * M_PI) * spin180() * View;
else if(at4 == 3)
View = ypush(t4 * M_PI) * xpush(M_PI) * spin(M_PI) * View;
View = ypush(t4 * M_PI) * xpush(M_PI) * spin180() * View;
else if(at4 == 4) {
View = ypush(M_PI) * xpush(M_PI) * spin(M_PI) * View;
View = ypush(M_PI) * xpush(M_PI) * spin180() * View;
earthpart = lerp(255, earthpart, 1-t4);
}
anims::moved();

View File

@@ -76,7 +76,7 @@ vector<cell*> cl_sphere() {
vector<cell*> lst;
auto all = currentmap->allcells();
for(cell *c: all) {
hyperpoint h = spin(45*degree) * currentmap->relative_matrix(c, cs.at, C0) * C0;
hyperpoint h = spin(45._deg) * currentmap->relative_matrix(c, cs.at, C0) * C0;
if(-h[2] < max(abs(h[0]), abs(h[1]))) {
lst.push_back(c);
}
@@ -266,9 +266,9 @@ void mine_slide(tour::presmode mode, reaction_t set_geom, function<vector<cell*>
cwt.at = centerover = starter;
View = Id;
if(hyperbolic)
View = spin(45*degree) * View;
View = spin(45._deg) * View;
if(sphere) {
View = spin(45*degree) * View;
View = spin(45._deg) * View;
slide_backup(pconf.scale, 1000);
slide_backup(pconf.alpha, 1000);
slide_backup(modelcolor, 0xFF);
@@ -343,7 +343,7 @@ void enable_earth() {
texture::config.color_alpha = 255;
mapeditor::drawplayer = false;
fullcenter();
View = spin(4 * M_PI / 5 + M_PI / 2) * View;
View = spin(234._deg) * View;
}
slide sweeper_slides[] = {
@@ -515,10 +515,10 @@ slide sweeper_slides[] = {
enable_earth();
View = Id;
View = spin(3 * M_PI / 5) * View;
View = spin(90*degree) * View;
View = cspin(2, 0, 45 * degree) * View;
View = cspin(1, 2, 30 * degree) * View;
View = spin(108._deg) * View;
View = spin(90._deg) * View;
View = cspin(2, 0, 45._deg) * View;
View = cspin(1, 2, 30._deg) * View;
playermoved = false;
tour::slide_backup(vid.axes, 0);
tour::slide_backup(vid.drawmousecircle, false);
@@ -569,7 +569,7 @@ slide sweeper_slides[] = {
start_game();
tour::slide_backup(vid.use_smart_range, 2);
tour::slide_backup(vid.smart_range_detail, 1);
View = spin(90*degree);
View = spin90();
using linepatterns::patTree;
tour::slide_backup(patTree.color, 0);
}
@@ -847,7 +847,7 @@ slide sweeper_slides[] = {
start_game();
tour::slide_backup(vid.use_smart_range, 2);
tour::slide_backup(vid.smart_range_detail, 1);
View = spin(90*degree);
View = spin90();
using linepatterns::patTree;
tour::slide_backup(patTree.color, 0);
}

View File

@@ -72,9 +72,9 @@ void circ_frame() {
shiftmatrix at = ggmatrix(cwt.at) * xpush(xdist);
ld kdegree = 2 * M_PI / prec;
ld kdegree = TAU / prec;
ld cs = 2*M_PI*cshift;
ld cs = TAU * cshift;
if(shape) {
auto shapefun = [&] (ld x) {

View File

@@ -61,12 +61,12 @@ struct iring {
ld delta = 0.004;
transmatrix T = cspin(1, 2, 45*degree);
transmatrix T = cspin(1, 2, 45._deg);
int switchat = nil ? 1024 : 2048;
auto step = [&] (int id) {
ld alpha = id * 1. / steps * 2 * M_PI;
ld alpha = id * 1. / steps * TAU;
if(id < switchat)
return T * point3(cos(alpha) * delta, sin(alpha) * delta, 0);
else
@@ -113,7 +113,7 @@ struct iring {
hyperpoint uds[3];
ld alpha = a * 1. / steps * 2 * M_PI;
ld alpha = a * 1. / steps * TAU;
if(a < switchat) {
uds[0] = T * point31(sin(alpha) * cscale, -cos(alpha) * cscale, 0) - C0;
uds[1] = T * point31(0, 0, cscale) - C0;

View File

@@ -237,7 +237,7 @@ void create_intra_120() {
hyperpoint h = currentmap->get_corner(s, 1);
for(cell *c: currentmap->allcells()) {
hyperpoint j = currentmap->relative_matrix(c, s, C0) * C0;
if(hdist(h, j) > M_PI/2) c->wall = waPalace;
if(hdist(h, j) > 90._deg) c->wall = waPalace;
}
for(cell *c: currentmap->allcells()) if(c->wall == waPalace) {
int nei = 0;
@@ -277,7 +277,7 @@ void create_intra_1440() {
for(cell *c: currentmap->allcells()) {
hyperpoint j = currentmap->relative_matrix(c, s, C0) * C0;
// hyperpoint j = inverse(currentmap->relative_matrix(cwt.at, c, C0)) * C0;
if(hdist(h, j) > M_PI/2)
if(hdist(h, j) > 90._deg)
set_wall(c, (celldistance(c, s)&1) ? 0xFF80FF : 0xFF00FF);
}
}

View File

@@ -58,7 +58,7 @@ void make() {
/* compute the vertices */
vertices.resize(magmav+1);
for(int i=0; i<=magmav; i++)
vertices[i] = spin(2*M_PI*(i+(v-7)/4.)/v) * xpush0(1);
vertices[i] = spin(TAU*(i+(v-7)/4.)/v) * xpush0(1);
ld xx = vertices[2][0];
int down = v/2 + 2;
@@ -196,7 +196,7 @@ void draw_at(transmatrix T, color_t col, int id) {
if(magmadebug) {
for(int i=0; i<magmav; i++) {
hyperpoint h = mid(vertices[i], vertices[i+1]);
h += spin(M_PI/2) * (vertices[i+1] - vertices[i]) * .05;
h += spin90() * (vertices[i+1] - vertices[i]) * .05;
queuestr(T * rgpushxto0(h), 0.4, its(i), 0x80);
}
queuestr(T * rgpushxto0(hcenter), 0.4, "#"+its(id), 0x80);

View File

@@ -489,7 +489,7 @@ int redraws;
void redraw_texture() {
View = Id;
if(arcm::in()) View = View * spin(45 * degree);
if(arcm::in()) View = View * spin(45._deg);
dynamicval<int> cgl(vid.cells_generated_limit, 9999999);
dynamicval<int> cdl(vid.cells_drawn_limit, 9999999);
dynamicval<bool> r(mousing, false);
@@ -629,7 +629,7 @@ void draw_ncee() {
period = 2 * hdist0(tC0(currentmap->adj(cwt.at, 0)));
}
period *= 2 / M_PI;
period /= 90._deg;
dynamicval<eModel> pm(pmodel, mdPixel);
dynamicval<eGeometry> pg(geometry, gEuclid);
@@ -919,7 +919,7 @@ void ncee() {
if(uni == 'X') {
int D = 100;
fmap = genellipse(D, -10 * degree), reset_vxy();
fmap = genellipse(D, -10._deg), reset_vxy();
#if CAP_NCONF
nconf_solve();
#endif

View File

@@ -219,8 +219,8 @@ void level::init_shapes() {
if(bmch == 'f' && (x&1) && (y&1)) {
for(int s=0; s<4; s++) {
hyperpoint st = point3(x+.1, y+.1, 0);
hyperpoint a = spin(90*degree*s) * point3(.1, .1, 0);
hyperpoint b = spin(90*degree*(s+1)) * point3(.1, .1, 0);
hyperpoint a = spin(90._deg*s) * point3(.1, .1, 0);
hyperpoint b = spin(90._deg*(s+1)) * point3(.1, .1, 0);
hyperpoint hi = point3(0, 0, 1);
for(int z=0; z<3; z++) {
ld z1 = (3-z) / 3.;
@@ -252,8 +252,8 @@ void level::init_shapes() {
ld need = safe_alt(ctr, -1) / scale / scale;
int max_y = need * 2 + 1;
hyperpoint a = spin(90*degree*s) * point3(1, 0, 0);
hyperpoint b = spin(90*degree*s) * point3(0, 1, 0);
hyperpoint a = spin(90._deg*s) * point3(1, 0, 0);
hyperpoint b = spin(90._deg*s) * point3(0, 1, 0);
auto pt = [&] (ld af, ld bf, ld yf) {
hyperpoint ha = a * af * scale; ha[3] = 1;
@@ -402,12 +402,12 @@ void level::init() {
dynamicval<bool> lop1(loaded_or_planned, true);
dynamicval<bool> lop2(planning_mode, false);
if(c.tick(this) == b) break;
start.heading_angle -= 1 * degree;
start.heading_angle -= degree;
}
if(flags & nrlOrder) {
sort(triangles.begin(), triangles.end(), [this] (triangledata a, triangledata b) {
return atan2(spin(120*degree)*(a.where - start.where)) < atan2(spin(120*degree)*(b.where - start.where));
return atan2(spin(120._deg)*(a.where - start.where)) < atan2(spin(120._deg)*(b.where - start.where));
});
for(auto t: triangles) println(hlog, t.where);
}
@@ -419,8 +419,7 @@ xy_float level::get_xy_f(hyperpoint h) {
if(flags & nrlPolar) {
tie(h[0], h[1]) = make_pair(atan2(h[0], h[1]), hypot(h[0], h[1]));
ld bar = (minx + maxx) / 2;
while(h[0] < bar - M_PI) h[0] += 2 * M_PI;
while(h[0] > bar + M_PI) h[0] -= 2 * M_PI;
cyclefix(h[0], bar);
}
int tY = isize(map_tiles);
int tX = isize(map_tiles[0]);
@@ -455,7 +454,7 @@ hyperpoint level::mappt(ld x, ld y, int s) {
};
void level::init_plan() {
plan.emplace_back(start.where, hpxy(cos(start.heading_angle + 90*degree) * 2, sin(start.heading_angle + 90*degree) * 2));
plan.emplace_back(start.where, hpxy(cos(start.heading_angle + 90._deg) * 2, sin(start.heading_angle + 90._deg) * 2));
current = start;
}

View File

@@ -62,7 +62,7 @@ ld geodesics_0(hyperpoint h) {
ld r = hypot_d(2, h);
ld phi = atan2(h[1], h[0]);
ld z = (phi / 2 / M_PI) * (M_PI * r * r + 2 * M_PI);
ld z = (phi / TAU) * (M_PI * r * r + TAU);
return z + rot_plane(h);
}
@@ -70,7 +70,7 @@ ld geodesics_at_4(hyperpoint h) {
ld r = 4;
ld phi = atan2(h[1], h[0]);
ld z = (phi / 2 / M_PI) * (M_PI * r * r + 2 * M_PI);
ld z = (phi / TAU) * (M_PI * r * r + TAU);
return z + rot_plane(h);
}
@@ -381,7 +381,7 @@ level geodesical(
"light rays are assumed to be geodesics.\n\n"
"Geodesics in Nil are horizontal, vertical, and helical. "
"In this level, all the roads are (fragments of) helical geodesics.",
-45*degree, 3*dft_block, 225*degree, 0,
-45._deg, 3*dft_block, 225._deg, 0,
// -8*dft_block, +8*dft_block, +8*dft_block, 0,
{
"ffffffffffffffff",
@@ -404,7 +404,7 @@ level geodesical(
level geodesical4(
"Helical Geodesic", 's', nrlPolar,
"The main road here is a helical geodesic. Orthogonal lines are horizontal.",
-80*degree, 8.5*dft_block, 260*degree, 0.5*dft_block,
-80._deg, 8.5*dft_block, 260._deg, 0.5*dft_block,
// -8*dft_block, +8*dft_block, +8*dft_block, 0,
{
"!!!!!!!!!!!!!!!!",
@@ -560,10 +560,9 @@ struct complex_surface {
auto d = hypot_d(2, h1);
ld r = 2;
h1 = h1 * (r / d);
ld phi = atan2(h1[1], h1[0]) + 90*degree;
ld phis = atan2((start-ctr)[1], (start-ctr)[0]) + 90 * degree;
if(phi < phis-M_PI) phi += 2 * M_PI;
if(phi > phis+M_PI) phi -= 2 * M_PI;
ld phi = atan2(h1[1], h1[0]) + 90._deg;
ld phis = atan2((start-ctr)[1], (start-ctr)[0]) + 90._deg;
cyclefix(phi, phis);
h1 += ctr;
auto z = [&] (ld a) { return point31(r*sin(a), -r*cos(a), (r * r / 2) * (a-sin(a)*cos(a))); };
@@ -577,11 +576,11 @@ struct complex_surface {
hyperpoint h2 = h; if(start[0] == ctr[0]) h2[1] = start[1]; else h2[0] = start[0];
hyperpoint pre = rgpushxto0(start) * flatpush(h2-start) * flatpush(h-h2) * C0;
hyperpoint last = rgpushxto0(start) * gpushxto0(z(phis)) * rgpushxto0(z(phis + dir * 90*degree)) * C0;
hyperpoint last = rgpushxto0(start) * gpushxto0(z(phis)) * rgpushxto0(z(phis + dir * 90._deg)) * C0;
hyperpoint h3 = h; if(start[0] != ctr[0]) h3[1] = last[1]; else h3[0] = last[0];
hyperpoint post = rgpushxto0(last) * flatpush(h3-last) * flatpush(h-h3) * C0;
ld p = (1+sin((phi-phis)*2 - 90*degree)) / 2.;
ld p = (1+sin((phi-phis)*2 - 90._deg)) / 2.;
pre[2] = pre[2] + (post[2] - pre[2]) * p;

View File

@@ -104,8 +104,8 @@ bool turn(int delta) {
}
#endif
if(min_gfx_slope < -90*degree) min_gfx_slope = -90*degree;
if(min_gfx_slope > +90*degree) min_gfx_slope = +90*degree;
if(min_gfx_slope < -90._deg) min_gfx_slope = -90._deg;
if(min_gfx_slope > +90._deg) min_gfx_slope = +90._deg;
backing = false;
@@ -659,7 +659,7 @@ auto celldemo = arg::add3("-unilcycle", initialize) + arg::add3("-unilplan", []
->editable(0, 5, 0.05, "camera distance", "how far is the unicycle from the camera", 'd')
->set_reaction([] { curlev->current.centerview(curlev); });
param_f(min_gfx_slope, "min_gfx_slope")
->editable(-90*degree, 90*degree, degree, "min camera slope", "affected by up/down", 'm');
->editable(-90._deg, 90._deg, degree, "min camera slope", "affected by up/down", 'm');
})
+ arg::add3("-fullsim", [] {
/* for animations */

View File

@@ -200,7 +200,7 @@ inline ld gravity = 1 / 16.;
inline ld whdist = 0.5;
/** minimum slope for rendering */
inline ld min_gfx_slope = +M_PI/2;
inline ld min_gfx_slope = +90._deg;
/** current slope for rendering */
inline ld gfx_slope = 0;

View File

@@ -95,8 +95,8 @@ bool closed_grid(int x, int y) {
template<class T1, class T2> void add_statue(const T1& grid, const T2& f) {
auto pt = [&] (int x, int y) {
ld x1 = x * M_PI / 16.;
ld y1 = y * M_PI / 32.;
ld x1 = x * TAU / 32;
ld y1 = y * TAU / 64;
cgi.hpcpush(f(x1,y1));
};
for(int y=-16; y<16; y++)
@@ -130,7 +130,7 @@ void init_statues() {
for(int i=0; i<8; i++) {
hyperpoint z = point31(0, 1e-6, 8);
hyperpoint ih = inverse_exp(shiftless(z));
ih = spin(i * 45 * degree) * ih;
ih = spin(i * TAU / 8) * ih;
add_statue(closed_grid, [&] (ld lon, ld lat) {
lat = lat * .75;
hyperpoint h = direct_exp(ih * (.5 + lat / M_PI));
@@ -141,7 +141,7 @@ void init_statues() {
cgi.extra_vertices();
cgi.add_texture(shGeostatue);
for(ld z: vector<ld> {M_PI/2+1e-2, M_PI+1e-2, M_PI*2+1e-2, 7, 10})
for(ld z: vector<ld> {90._deg+1e-2, M_PI+1e-2, TAU+1e-2, 7, 10})
for(hyperpoint h: {point31(0, 0, z), point31(1e-3, 0, z), point31(1e-6, 0, z), point31(0, 1e-6, z)}) {
hyperpoint i = inverse_exp(shiftless(h));
println(hlog, i, " @ ", hypot_d(3, i));

View File

@@ -25,7 +25,7 @@ void timestamp::draw_unilcycle(const shiftmatrix& V) {
hyperpoint base = Ta * Tb * point31(0, 0, whrad);
for(int a=0; a<points; a++) {
ld beta = 360 * degree * a / points + circpos;
ld beta = TAU * a / points + circpos;
whpoint[a] = base + Ta * point3(whrad*sin(beta),0,whrad*cos(beta));
}
whpoint[points] = whpoint[0];
@@ -116,7 +116,7 @@ bool timestamp::collect(level *lev) {
/* convert heading to integral units, to make saved replays consistent */
constexpr ld h_units = 360 * 60 * 60;
constexpr ld h_mul = h_units / 2 / M_PI;
constexpr ld h_mul = h_units / TAU;
int heading_to_int(ld a) {
a = a * h_mul;
@@ -252,7 +252,7 @@ void timestamp::draw_instruments(level* l) {
curvepoint(hpxy(0, rad));
curvepoint(hpxy(-rad/4, 0));
curvepoint(hpxy(rad/4, 0));
queuecurve(sId * atscreenpos(cx, cy, pix) * spin(90 * degree + slope), 0xFF, 0x40C040FF, PPR::ZERO);
queuecurve(sId * atscreenpos(cx, cy, pix) * spin(90._deg + slope), 0xFF, 0x40C040FF, PPR::ZERO);
// compass

View File

@@ -156,7 +156,7 @@ void run_snub(int v, int w) {
for(cell *c: currentmap->allcells()) {
int id = arcm::id_of(c->master);
if(among(id, 0, 1)) for(int d=0; d<v; d++) {
transmatrix T = rel * ggmatrix(c).T * spin(2*M_PI*d/v);
transmatrix T = rel * ggmatrix(c).T * spin(TAU*d/v);
array<hyperpoint,3> hts;
for(int i=0; i<3; i++)
hts[i] = T * ts[i] * C0;
@@ -213,12 +213,12 @@ void create_model() {
hyperpoint chk = ts[0] * xspinpush0(alpha, h);
mts[0] = chk;
mts[1] = spin(-2*M_PI/v) * chk;
mts[1] = spin(-TAU/v) * chk;
mts[2] = matrix2 * chk;
hyperpoint c[5];
for(int i=0; i<5; i++)
c[i] = hpxy(sin(2 * i * M_PI/5), cos(2 * i * M_PI/5));
c[i] = hpxy(sin(i * TAU/5), cos(i * TAU/5));
hyperpoint tria[5];
tria[0] = mts[0];
@@ -256,7 +256,7 @@ void create_model() {
// printf("createmodel with ticks = %d\n", ticks);
transmatrix t = hyperbolic ? hr::cspin(0, 2, M_PI) * xpush(sin(ticks * M_PI * 2 / anims::period)) : hr::cspin(0, 2, ticks * M_PI * 2 / anims::period);
transmatrix t = hyperbolic ? hr::cspin180(0, 2) * xpush(sin(ticks * TAU / anims::period)) : hr::cspin(0, 2, ticks * TAU / anims::period);
hyperpoint hs = hyperbolic ? hpxyz(0,0,-1) : hpxyz(0,0,0);

View File

@@ -112,7 +112,7 @@ void animate() {
/* set_view does not orient correctly, so we rotate it */
View = cspin(2, 0, M_PI/2) * View;
View = cspin90(2, 0) * View;
/* we move the camera backward */

View File

@@ -19,8 +19,8 @@ color_t gridcol = 0xFFFFFFFF;
hyperpoint fp(ld x, ld y) {
x *= scale;
y *= scale;
x *= M_PI/10 * sqrt(2)/2;
y *= M_PI/10 * sqrt(2)/2;
x *= A_PI/10 * sqrt(2)/2;
y *= A_PI/10 * sqrt(2)/2;
if(euclid)
return hyperpoint(x, y, 0, 1);
@@ -28,12 +28,12 @@ hyperpoint fp(ld x, ld y) {
ld a = sqrt(2)/2;
x /= a;
y /= a;
hyperpoint h = cspin(2, 3, -M_PI/4) * hyperpoint(sin(x)*a, sin(y)*a, cos(x)*a, cos(y)*a);
hyperpoint h = cspin(2, 3, -45._deg) * hyperpoint(sin(x)*a, sin(y)*a, cos(x)*a, cos(y)*a);
return h;
}
if(hyperbolic)
return cspin(0, 2, -M_PI/2) * tC0(parabolic13(x, y));
return cspin90(2, 0) * tC0(parabolic13(x, y));
if(nil)
return hyperpoint(0, y, x, 1);
@@ -45,7 +45,7 @@ hyperpoint fp(ld x, ld y) {
ld a = sqrt(2)/2;
x /= a;
y /= a;
hyperpoint h = cspin(2, 3, -M_PI/4) * hyperpoint(sinh(x)*a, sinh(y)*a, cosh(x)*a, cosh(y)*a);
hyperpoint h = cspin(2, 3, -45._deg) * hyperpoint(sinh(x)*a, sinh(y)*a, cosh(x)*a, cosh(y)*a);
return h;
}
@@ -90,16 +90,16 @@ void relocate() {
vid.fixed_yz = false;
if(nil) rotate_view(cspin(2, 0, M_PI/2));
if(prod) rotate_view(cspin(1, 2, M_PI/2));
if(nil) rotate_view(cspin90(2, 0));
if(prod) rotate_view(cspin90(1, 2));
if(emba == 1) {
rotate_view(cspin(0, 1, M_PI/4));
rotate_view(cspin(1, 2, M_PI/6));
rotate_view(cspin(0, 1, 45._deg));
rotate_view(cspin(1, 2, 30._deg));
}
if(emba == 2) {
rotate_view(cspin(1, 2, M_PI/2 * .9));
rotate_view(cspin(1, 2, 81._deg));
}
for(int a=0; a<100; a++)

View File

@@ -239,7 +239,7 @@ ld prec = 5;
void draw_earth() {
load_planets();
shiftmatrix S = ggmatrix(currentmap->gamestart()) * spin(90*degree);
shiftmatrix S = ggmatrix(currentmap->gamestart()) * spin90();
ld mte = radius[src_planet] / radius[tgt_planet];
@@ -425,7 +425,7 @@ EX void compare() {
dark = dark * dark * (3-2*dark);
}
alpha = dark * max_alpha;
View = cspin(0, 2, (rot - lrot) * 2 * M_PI) * View;
View = cspin(0, 2, (rot - lrot) * TAU) * View;
lrot = rot;
anims::moved();
}

View File

@@ -85,12 +85,12 @@ hyperpoint to_hyper(ld x, ld y) {
y -= 1;
hyperpoint h;
h[0] = -x; h[1] = y; h[2] = 1;
h = spin(-90*degree) * h;
h = spin270() * h;
return perspective_to_space(h, 1, gcHyperbolic);
}
pair<ld, ld> from_hyper(hyperpoint h) {
h = spin(+90*degree) * h; h[0] = -h[0];
h = spin90() * h; h[0] = -h[0];
h[2] += 1;
h /= h[2];

View File

@@ -120,7 +120,7 @@ void nil_screen(presmode mode, int id) {
else t = floor(t) + 2 * (t - floor(t));
t -= floor(t/4)*4;
ld t2 = 90 * degree * t;
ld t2 = 90._deg * t;
curvepoint(p2(0,0));
curvepoint(p2(5,5));
@@ -144,7 +144,7 @@ void nil_screen(presmode mode, int id) {
if(id < 3) {
if(id == 2) {
drawMonsterType(moEagle, nullptr, g.pos(5,5,1.5) * spin(-t * 90 * degree) * xyzscale(1.5), 0x40C040, ticks / 1000., 0);
drawMonsterType(moEagle, nullptr, g.pos(5,5,1.5) * spin(-t * 90._deg) * xyzscale(1.5), 0x40C040, ticks / 1000., 0);
}
color_t dark = 0xFF;
@@ -305,7 +305,7 @@ void geodesic_screen(presmode mode, int id) {
// flat_model_enabler fme;
initquickqueue();
dmv_grapher g(MirrorZ * cspin(1, 2, .3 * angle / (M_PI/2)) * spin(angle/2));
dmv_grapher g(MirrorZ * cspin(1, 2, .3 * angle / 90._deg) * spin(angle/2));
ld val = 25;
@@ -320,7 +320,7 @@ void geodesic_screen(presmode mode, int id) {
ld rrh = radh * sqrt(1/2.);
ld zmove = val - M_PI * radh * radh;
ld len = hypot(2 * M_PI * radh, zmove);
ld len = hypot(TAU * radh, zmove);
ld t = inHighQual ? ticks / 1000. : (ticks - geo_zero) / 500;
@@ -334,7 +334,7 @@ void geodesic_screen(presmode mode, int id) {
queuecurve(g.T, col, 0, PPR::LINE);
auto be_shadow = [&] (hyperpoint& h) {
// ld part = 1 - angle / (M_PI / 2);
// ld part = 1 - angle / 90._deg;
// h[0] += h[2] * part / 10;
h[2] = 0;
};
@@ -396,8 +396,8 @@ void geodesic_screen(presmode mode, int id) {
if(id >= 2)
draw_path([&] (ld t) {
ld tx = min(t, 2 * M_PI * rad);
ld ta = tx / rad - 135 * degree;
ld tx = min(t, TAU * rad);
ld ta = tx / rad - 135._deg;
ld x = rr + rad * cos(ta);
ld y = rr + rad * sin(ta);
ld z = rad * tx / 2 - ((rr * x) - (rr * y)) / 2;
@@ -407,10 +407,10 @@ void geodesic_screen(presmode mode, int id) {
if(id >= 3)
draw_path([&] (ld t) {
ld tx = min(t, len);
ld ta = tx / len * 2 * M_PI - 135 * degree;
ld ta = tx / len * TAU - 135._deg;
ld x = rrh + radh * cos(ta);
ld y = rrh + radh * sin(ta);
ld z = radh * radh * (tx/len*2*M_PI) / 2 - ((rrh * x) - (rrh * y)) / 2 + zmove * tx / len;
ld z = radh * radh * (tx/len*TAU) / 2 - ((rrh * x) - (rrh * y)) / 2 + zmove * tx / len;
return point31(x, y, z);
}, helix);
@@ -447,7 +447,7 @@ void geodesic_screen(presmode mode, int id) {
if(id >= 2) {
dialog::addBreak(100);
dialog_may_latex("\\textsf{circle}", "circle", circle >> 8);
dialog_may_latex("$"+fts(2 * M_PI * rad)+"$", fts(2 * M_PI * rad), circle >> 8);
dialog_may_latex("$"+fts(TAU * rad)+"$", fts(TAU * rad), circle >> 8);
}
else dialog::addBreak(300);
@@ -553,7 +553,7 @@ void impossible_ring_slide(tour::presmode mode) {
for(int id=0; id<2; id++) {
shiftmatrix T = ggmatrix(currentmap->gamestart());
println(hlog, "angle = ", angle);
if(id == 1) T = T * spin(180*degree) * xpush(1.5) * cspin(0, 2, angle) * xpush(-1.5);
if(id == 1) T = T * spin180() * xpush(1.5) * cspin(0, 2, angle) * xpush(-1.5);
for(ld z: {+.5, -.5}) {
for(ld d=0; d<=180; d++)
@@ -599,7 +599,7 @@ void enable_earth() {
texture::config.color_alpha = 255;
mapeditor::drawplayer = false;
fullcenter();
View = spin(4 * M_PI / 5 + M_PI / 2) * View;
View = spin(234._deg) * View;
}
slide dmv_slides[] = {
@@ -647,8 +647,8 @@ slide dmv_slides[] = {
shiftmatrix T = ggmatrix(currentmap->gamestart());
vid.linewidth *= 4;
shiftpoint h1 = T * xspinpush0(0, 2);
shiftpoint h2 = T * xspinpush0(120*degree, 2);
shiftpoint h3 = T * xspinpush0(240*degree, 2);
shiftpoint h2 = T * xspinpush0(120._deg, 2);
shiftpoint h3 = T * xspinpush0(240._deg, 2);
queueline(h1, h2, 0xFF0000FF, 4);
queueline(h2, h3, 0xFF0000FF, 4);
queueline(h3, h1, 0xFF0000FF, 4);
@@ -669,21 +669,21 @@ slide dmv_slides[] = {
enable_earth();
View = Id;
View = spin(3 * M_PI / 5) * View;
View = spin(90*degree) * View;
View = cspin(2, 0, 45 * degree) * View;
View = cspin(1, 2, 30 * degree) * View;
View = spin(108._deg) * View;
View = spin(90._deg) * View;
View = cspin(2, 0, 45._deg) * View;
View = cspin(1, 2, 30._deg) * View;
playermoved = false;
tour::slide_backup(vid.axes, 0);
tour::slide_backup(vid.drawmousecircle, false);
tour::slide_backup(draw_centerover, false);
}
add_temporary_hook(mode, hooks_frame, 200, [] {
shiftmatrix T = ggmatrix(currentmap->gamestart()) * spin(-3 * M_PI / 5);
shiftmatrix T = ggmatrix(currentmap->gamestart()) * spin(-108._deg);
vid.linewidth *= 4;
shiftpoint h1 = T * C0;
shiftpoint h2 = T * xpush0(M_PI/2);
shiftpoint h3 = T * ypush0(M_PI/2);
shiftpoint h2 = T * xpush0(90._deg);
shiftpoint h3 = T * ypush0(90._deg);
queueline(h1, h2, 0xFF0000FF, 3);
queueline(h2, h3, 0xFF0000FF, 3);
queueline(h3, h1, 0xFF0000FF, 3);
@@ -734,8 +734,8 @@ slide dmv_slides[] = {
shiftmatrix T = ggmatrix(currentmap->gamestart());
vid.linewidth *= 16;
shiftpoint h1 = T * xspinpush0(0, 2);
shiftpoint h2 = T * xspinpush0(120*degree, 2);
shiftpoint h3 = T * xspinpush0(240*degree, 2);
shiftpoint h2 = T * xspinpush0(120._deg, 2);
shiftpoint h3 = T * xspinpush0(240._deg, 2);
queueline(h1, h2, 0xFF0000FF, 4);
queueline(h2, h3, 0xFF0000FF, 4);
queueline(h3, h1, 0xFF0000FF, 4);
@@ -1270,7 +1270,7 @@ slide dmv_slides[] = {
rogueviz::balls::initialize(1);
rogueviz::balls::balls.resize(3);
pmodel = mdEquidistant;
View = cspin(1, 2, M_PI/2);
View = cspin90(1, 2);
}
non_game_slide_scroll(mode);
}

View File

@@ -46,8 +46,8 @@ void grapher::arrow(hyperpoint h1, hyperpoint h2, ld sca, color_t col) {
ld siz = hypot_d(2, h);
h *= sca / siz;
curvepoint(h2);
curvepoint(h2 - spin(15*degree) * h);
curvepoint(h2 - spin(-15*degree) * h);
curvepoint(h2 - spin(15._deg) * h);
curvepoint(h2 - spin(-15._deg) * h);
curvepoint(h2);
queuecurve(T, col, col, PPR::LINE);
}
@@ -429,7 +429,7 @@ void use_angledir(presmode mode, bool reset) {
angle = 0, dir = -1;
add_temporary_hook(mode, shmup::hooks_turn, 200, [] (int i) {
angle += dir * i / 500.;
if(angle > M_PI/2) angle = M_PI/2;
if(angle > 90._deg) angle = 90._deg;
if(angle < 0) angle = 0;
return false;
});

View File

@@ -25,7 +25,7 @@ int qmode;
color_t rainbow_color_at(hyperpoint h) {
ld sat = 1 - 1 / h[2];
ld hue = atan2(h[0], h[1]) / (2 * M_PI);
ld hue = atan2(h[0], h[1]) / TAU;
return rainbow_color(sat, hue);
}

View File

@@ -71,7 +71,7 @@ bool advance_walkers(int delta) {
auto& w = walkers[i];
hyperpoint h = tC0(w.T);
if(WDIM == 2) {
w.T = w.T * xspinpush(randd() * 2 * M_PI, step_size);
w.T = w.T * xspinpush(randd() * TAU, step_size);
}
else {
hyperpoint dir = random_spin() * xtangent(step_size);

View File

@@ -204,7 +204,7 @@ bool draw_bird(cell *c, const transmatrix& V) {
id++; if(id == isize(orig)) id = 0;
}
id = tot * WINGS / maxvol / 2;
queuepoly(rgpushxto0(tC0(V)) * cspin(0, 2, M_PI/2) * cspin(1, 2, 90 * degree) * cspin(0, 2, 45 * degree),
queuepoly(rgpushxto0(tC0(V)) * cspin90(0, 2) * cspin90(1, 2) * cspin(0, 2, 45._deg),
GDIM == 3 ? cgi.shAnimatedTinyEagle[id] : cgi.shTinyBird, 0xFFFFFFFF
);
}
@@ -312,9 +312,9 @@ auto hchook = addHook(hooks_drawcell, 100, draw_bird)
hyperpoint h = all[int(id)] * (1-id+int(id)) + all[int(id+1)] * (id-int(id));
h = normalize(h);
centerover = currentmap->gamestart();
View = /* cspin(2, 0, M_PI/2) * rspintox(gpushxto0(h) * C0) * */ gpushxto0(h);
View = /* cspin90(2, 0) * rspintox(gpushxto0(h) * C0) * */ gpushxto0(h);
View = spintox(View * C0) * View;
View = cspin(2, 0, M_PI/2) * View;
View = cspin90(2, 0) * View;
shift_view(point3(0, 0, -1e-2));

View File

@@ -16,8 +16,8 @@ bool draw_simple_scene() {
shiftmatrix Where = ggmatrix(currentmap->gamestart());
curvepoint(xpush0(0.2));
curvepoint(spin(120*degree) * xpush0(0.2));
curvepoint(spin(240*degree) * xpush0(0.2));
curvepoint(spin(120._deg) * xpush0(0.2));
curvepoint(spin(240._deg) * xpush0(0.2));
curvepoint(xpush0(0.2));
queuecurve(Where, 0xFF0000FF, 0x00FF00FF, PPR::LINE);

View File

@@ -180,7 +180,7 @@ void draw_ro() {
vector<hyperpoint> path;
void build(bool in_pair) {
to_iso = cspin(1, 2, atan(1/sqrt(2))) * cspin(0, 2, M_PI/4);
to_iso = cspin(1, 2, atan(1/sqrt(2))) * cspin(0, 2, 45._deg);
from_iso = inverse(to_iso);
last_co = euc::coord(0, 0, 3);
@@ -242,7 +242,7 @@ void build(bool in_pair) {
}
void build_net() {
to_iso = cspin(1, 2, atan(1/sqrt(2))) * cspin(0, 2, M_PI/4);
to_iso = cspin(1, 2, atan(1/sqrt(2))) * cspin(0, 2, 45._deg);
from_iso = inverse(to_iso);
last_co = euc::coord(0, 0, 0);
@@ -315,22 +315,22 @@ void build_stair() {
hs[3] = point31(+xx, -xx, -hei);
}
else if(dix == 3 || (dix == 2 && step == 0) || (dix == 1 && step > 0)) {
transmatrix T = spin(90*degree*diy);
transmatrix T = spin(90._deg*diy);
hs[0] = T * point31(+xx, -xx, -hei);
hs[1] = T * point31(+xx, +xx, -hei);
hs[2] = T * point31(+xx, +xx, +hei);
hs[3] = T * point31(+xx, -xx, +hei);
}
else if(dix == 0) {
transmatrix T = spin(90*degree*diy);
transmatrix T = spin(90._deg*diy);
hs[0] = T * point31(+xx, -xx, -hei);
hs[1] = T * point31(+xx, +xx, -hei);
hs[2] = to_rot(eupush(C0 + shift) * to_heis(T * point31(-xx, +xx, -hei)));
hs[3] = to_rot(eupush(C0 + shift) * to_heis(T * point31(-xx, -xx, -hei)));
}
else {
transmatrix T = spin(90*degree*diy);
hyperpoint lshift = step ? shift : spin(-90*degree) * shift;
transmatrix T = spin(90._deg*diy);
hyperpoint lshift = step ? shift : spin270() * shift;
hs[0] = to_rot(eupush(C0 - lshift) * to_heis(T * point31(-xx, +xx, hei)));
hs[1] = to_rot(eupush(C0 - lshift) * to_heis(T * point31(-xx, -xx, hei)));
hs[2] = T * point31(+xx, -xx, hei);
@@ -343,7 +343,7 @@ void build_stair() {
at = eupush(at) * (C0 + shift);
}
shift = spin(90*degree) * shift;
shift = spin90() * shift;
}
println(hlog, "path = ", path);

View File

@@ -281,22 +281,22 @@ void snap_to_center() {
dialog::addItem("mouse up", 'w');
dialog::add_action([] {
View = spin(90*degree) * spintox(unshift(mapeditor::mouse_snap())) * View;
View = spin90() * spintox(unshift(mapeditor::mouse_snap())) * View;
});
dialog::addItem("mouse down", 's');
dialog::add_action([] {
View = spin(-90*degree) * spintox(unshift(mapeditor::mouse_snap())) * View;
View = spin270() * spintox(unshift(mapeditor::mouse_snap())) * View;
});
dialog::addItem("mouse left", 'a');
dialog::add_action([] {
View = spin(180*degree) * spintox(unshift(mapeditor::mouse_snap())) * View;
View = spin180() * spintox(unshift(mapeditor::mouse_snap())) * View;
});
dialog::addItem("mouse left", 'd');
dialog::add_action([] {
View = spin(0*degree) * spintox(unshift(mapeditor::mouse_snap())) * View;
View = Id * spintox(unshift(mapeditor::mouse_snap())) * View;
});
dialog::addBack();

View File

@@ -93,7 +93,7 @@ ld hrandd() {
ld gaussian_random() {
ld u1 = hrandd();
ld u2 = hrandd();
return sqrt(-2*log(u1)) * cos(2*M_PI*u2);
return sqrt(-2*log(u1)) * cos(TAU*u2);
}
void apply_delta(cellwalker cw, kohvec& v) {
@@ -226,9 +226,9 @@ void get_coordinates(kohvec& v, cell *c, cell *c0) {
alloc(v);
int s = T0[0][0];
for(int i=0; i<3; i++) {
hyperpoint h1 = spin(120*degree*i) * h;
hyperpoint h1 = spin(120._deg*i) * h;
ld x = h1[1];
ld alpha = 2 * M_PI * x / s / (sqrt(3) / 2);
ld alpha = TAU * x / s / (sqrt(3) / 2);
// println(hlog, kz(x), " -> ", kz(alpha));
v[2*i] = cos(alpha);
v[2*i+1] = sin(alpha);
@@ -250,7 +250,7 @@ void get_coordinates(kohvec& v, cell *c, cell *c0) {
auto& T0 = eu_input.user_axes;
for(int i=0; i<3; i++) {
int s = T0[i][i];
ld alpha = 2 * M_PI * h[i] / s;
ld alpha = TAU * h[i] / s;
v[2*i] = cos(alpha) * s;
v[2*i+1] = sin(alpha) * s;
}

View File

@@ -358,7 +358,7 @@ void distribute_neurons() {
if(!triangulate(data[s].val, w, find, vdata[id].m->at))
vdata[id].m->at =
spin(2*M_PI*w.csample / w.drawn_samples) * xpush(rad * (w.drawn_samples-1) / w.drawn_samples);
spin(TAU*w.csample / w.drawn_samples) * xpush(rad * (w.drawn_samples-1) / w.drawn_samples);
w.csample++;
for(auto& e: vdata[id].edges) e.second->orig = nullptr;
}

View File

@@ -735,7 +735,7 @@ void shot_settings() {
brm_limit = GDIM == 2 ? 1000 : 0;
if(GDIM == 3)
View = cspin(0, 2, 30 * degree) * cspin(1, 2, 30*degree) * View;
View = cspin(0, 2, 30 * degree) * cspin(1, 2, 30._deg) * View;
shift_view(ctangent(2, -0.5));

View File

@@ -13,7 +13,7 @@ namespace spiral {
ld mul;
transmatrix at(double d) {
return spin(log(d) * 2 * M_PI / log(mul)) * xpush(log(d));
return spin(log(d) * TAU / log(mul)) * xpush(log(d));
}
void place(int N, ld _mul) {

View File

@@ -19,7 +19,7 @@ basic_textureinfo tinf;
hyperpoint spcoord(hyperpoint h) {
ld phi = h[0], y = h[1], z = h[2], r = global_r;
ld aphi = (r+phi + floor(progress))*M_PI/6;
ld aphi = (r+phi + floor(progress))*30._deg;
return zpush(acurvature*(y + r - frac(progress))/szoom) * xspinpush0(aphi, acurvature * z);
}
@@ -106,7 +106,7 @@ void make_texture() {
pix(2,x,y) = 0xFF400000 + 0x10000 * (y * 63 / fw);
pix(8,x,y) = 0xFF101010;
pix(10,x,y) = 0xFF000000 + gradient(0, 0xFFD500, 0, x*(fw-x), fw*fw/4);
pix(5,x,y) = 0xFF000000 + gradient(0, 0x804000, -1, sin(2*M_PI*8*y/fw), 1);
pix(5,x,y) = 0xFF000000 + gradient(0, 0x804000, -1, sin(TAU*8*y/fw), 1);
pix(7,x,y) = 0xFF000000 + gradient(0, 0x808080, 0, x*ll(fw-x)*y*(fw-y), ll(fw/2)*(fw/2)*(fw-fw/2)*(fw-fw/2));
}

View File

@@ -74,8 +74,8 @@ bool sunflower_cell(cell *c, shiftmatrix V) {
if(sphere) {
if(infer == 'r')
range = qty * density * M_PI/2;
else qd = range * 2/M_PI;
range = qty * density * 90._deg;
else qd = range / 90._deg;
}
else if(euclid) {
if(infer == 'r')
@@ -108,7 +108,7 @@ bool sunflower_cell(cell *c, shiftmatrix V) {
ld best_error = 1;
vector<int> sgns;
for(int i=1; i<iqty; i++) {
ld v = i * step_angle / (2*M_PI);
ld v = i * step_angle / TAU;
v = frac(v);
auto sgn = v > .5;
if(sgn) v = 1-v;
@@ -263,7 +263,7 @@ void show() {
dialog::addSelItem("radius", fts(range), 'q');
dialog::add_action([] {
if(infer == 'r') infer = 'd';
dialog::editNumber(range, 0, 10, .1, 2*M_PI, "range", "range");
dialog::editNumber(range, 0, 10, .1, TAU, "range", "range");
dialog::scaleLog();
});