mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +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:
parent
563b9c1f74
commit
06523e063e
@ -606,7 +606,7 @@ void geometry_information::animate_bird(hpcshape& orig, hpcshape_animated& anima
|
||||
for(int i=0; i<=WINGS; i++) {
|
||||
auto& tgt = animated[i];
|
||||
clone_shape(orig, tgt);
|
||||
ld alpha = cos(180. * degree * i / WINGS) * 30 * degree;
|
||||
ld alpha = cos(M_PI * i / WINGS) * 30 * degree;
|
||||
for(int i=tgt.s; i<tgt.e; i++) {
|
||||
if(abs(hpc[i][1]) > body) {
|
||||
ld off = hpc[i][1] > 0 ? body : -body;
|
||||
@ -787,17 +787,17 @@ void geometry_information::shift_last_straight(ld z) {
|
||||
|
||||
EX void queueball(const shiftmatrix& V, ld rad, color_t col, eItem what) {
|
||||
if(what == itOrbSpeed) {
|
||||
shiftmatrix V1 = V * cspin(1, 2, M_PI/2);
|
||||
shiftmatrix V1 = V * cspin90(1, 2);
|
||||
ld tt = ptick(100);
|
||||
for(int t=0; t<5; t++) {
|
||||
for(int a=-50; a<50; a++)
|
||||
curvepoint(cspin(0, 2, a * M_PI/100.) * cspin(0, 1, t * 72 * degree + tt + a*2*M_PI/50.) * xpush0(rad));
|
||||
curvepoint(cspin(0, 2, a * M_PI/100.) * cspin(0, 1, t * 72._deg + tt + a*TAU/50.) * xpush0(rad));
|
||||
queuecurve(V1, col, 0, PPR::LINE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
ld z = 63.43 * degree;
|
||||
shiftmatrix V1 = V * cspin(0, 2, M_PI/2);
|
||||
shiftmatrix V1 = V * cspin90(0, 2);
|
||||
if(what == itOrbShield) V1 = V * cspin(0, 1, ptick(500));
|
||||
if(what == itOrbFlash) V1 = V * cspin(0, 1, ptick(1500));
|
||||
if(what == itOrbShield) V1 = V * cspin(1, 2, ptick(1000));
|
||||
@ -821,7 +821,7 @@ EX void queueball(const shiftmatrix& V, ld rad, color_t col, eItem what) {
|
||||
line(a, c);
|
||||
line(a, d);
|
||||
line(d, c);
|
||||
line(c, spin(M_PI));
|
||||
line(c, spin180());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,7 +1256,7 @@ hpcshape& geometry_information::generate_pipe(ld length, ld width, ePipeEnd endt
|
||||
const int MAX_R = 20;
|
||||
auto at = [&] (ld i, ld a, ld z = 1, ld s = 1) {
|
||||
a += 0.5;
|
||||
ld alpha = 360 * degree * a / MAX_R;
|
||||
ld alpha = TAU * a / MAX_R;
|
||||
hpcpush(xpush(i * length / MAX_X) * cspin(1, 2, alpha) * ypush0(width*z));
|
||||
#if CAP_GL
|
||||
if(floor_textures) utt.tvertices.push_back(glhr::makevertex(0, pers ? 0.549 - s * 0.45 * sin(alpha) : 0.999, 0));
|
||||
@ -1282,10 +1282,10 @@ hpcshape& geometry_information::generate_pipe(ld length, ld width, ePipeEnd endt
|
||||
if(endtype == ePipeEnd::ball) for(int a=0; a<MAX_R; a++) for(int x=-MAX_R; x<MAX_R; x++) {
|
||||
ld xb = x < 0 ? 0 : MAX_X;
|
||||
ld mul = MAX_X * width/length * .9; // .9 to prevent Z-fighting
|
||||
ld x0 = xb + mul * sin(x * 90 * degree / MAX_R);
|
||||
ld x1 = xb + mul * sin((x+1) * 90 * degree / MAX_R);
|
||||
ld z0 = cos(x * 90 * degree / MAX_R);
|
||||
ld z1 = cos((x+1) * 90 * degree / MAX_R);
|
||||
ld x0 = xb + mul * sin(x * 90._deg / MAX_R);
|
||||
ld x1 = xb + mul * sin((x+1) * 90._deg / MAX_R);
|
||||
ld z0 = cos(x * 90._deg / MAX_R);
|
||||
ld z1 = cos((x+1) * 90._deg / MAX_R);
|
||||
at(x0, a, z0, z0);
|
||||
at(x0, a+1, z0, z0);
|
||||
at(x1, a, z1, z1);
|
||||
|
@ -610,8 +610,8 @@ EX bool compute_vertex_valence_flat(arb::arbi_tiling& ac) {
|
||||
if(at.sid == at1.sid && (at.eid-at1.eid) % ac.shapes[at.sid].cycle_length == 0) pqty = 0;
|
||||
if(qty && pqty == 0 && !total) break;
|
||||
ld a = ac.shapes[at.sid].angles[at.eid];
|
||||
while(a < 0) a += 360 * degree;
|
||||
while(a > 360 * degree) a -= 360 * degree;
|
||||
while(a < 0) a += TAU;
|
||||
while(a > TAU) a -= TAU;
|
||||
total += a;
|
||||
anglelist.push_back(a);
|
||||
qty++;
|
||||
@ -622,9 +622,9 @@ EX bool compute_vertex_valence_flat(arb::arbi_tiling& ac) {
|
||||
|
||||
at = ac.shapes[at.sid].connections[at.eid];
|
||||
}
|
||||
while(total < 360*degree - 1e-6);
|
||||
while(total < TAU - 1e-6);
|
||||
if(total == 0) qty = OINF;
|
||||
if(total > 360*degree + 1e-6) throw hr_parse_exception("improper total in compute_stats");
|
||||
if(total > TAU + 1e-6) throw hr_parse_exception("improper total in compute_stats");
|
||||
if(at.sid != i) throw hr_parse_exception("ended at wrong type determining vertex_valence");
|
||||
if((at.eid - k) % ac.shapes[i].cycle_length) {
|
||||
reduce_gcd(ac.shapes[i].cycle_length, at.eid - k);
|
||||
@ -1997,8 +1997,7 @@ EX void convert() {
|
||||
v0 = T * v0;
|
||||
v2 = T * v2;
|
||||
ld alpha = atan2(v0) - atan2(v2);
|
||||
while(alpha > M_PI) alpha -= 360*degree;
|
||||
while(alpha < -M_PI) alpha += 360*degree;
|
||||
cyclefix(alpha, 0);
|
||||
sh.angles.push_back(alpha);
|
||||
}
|
||||
if(debugflags & DF_GEOM) {
|
||||
@ -2117,7 +2116,7 @@ EX void choose() {
|
||||
}
|
||||
|
||||
EX pair<ld, ld> rep_ideal(ld e, ld u IS(1)) {
|
||||
ld alpha = 2 * M_PI / e;
|
||||
ld alpha = TAU / e;
|
||||
hyperpoint h1 = point3(cos(alpha)*u, -sin(alpha)*u, 1);
|
||||
hyperpoint h2 = point3(u, 0, 1);
|
||||
hyperpoint h3 = point3(cos(alpha)*u, sin(alpha)*u, 1);
|
||||
@ -2129,7 +2128,7 @@ EX pair<ld, ld> rep_ideal(ld e, ld u IS(1)) {
|
||||
auto Th23 = T * h23;
|
||||
ld beta = atan2(T0);
|
||||
ld gamma = atan2(Th23);
|
||||
return {len, 90 * degree - (gamma - beta)};
|
||||
return {len, 90._deg - (gamma - beta)};
|
||||
}
|
||||
|
||||
EX void swap_vertices() {
|
||||
|
@ -447,22 +447,22 @@ void archimedean_tiling::compute_geometry() {
|
||||
|
||||
if(real_faces == 2) {
|
||||
/* standard methods fail for dihedra, but the answer is easy */
|
||||
edgelength = 2 * M_PI / faces[0];
|
||||
edgelength = TAU / faces[0];
|
||||
for(int i=0; i<N; i++)
|
||||
if(faces[i] == 2)
|
||||
alphas[i] = 0,
|
||||
circumradius[i] = M_PI / real_face_type,
|
||||
inradius[i] = 0;
|
||||
else
|
||||
alphas[i] = M_PI/2,
|
||||
circumradius[i] = inradius[i] = M_PI/2;
|
||||
alphas[i] = 90._deg,
|
||||
circumradius[i] = inradius[i] = 90._deg;
|
||||
}
|
||||
else if(real_faces == 0) {
|
||||
// these are called hosohedra
|
||||
edgelength = M_PI;
|
||||
for(int i=0; i<N; i++)
|
||||
alphas[i] = M_PI / N,
|
||||
circumradius[i] = M_PI/2,
|
||||
circumradius[i] = 90._deg,
|
||||
inradius[i] = 0;
|
||||
}
|
||||
else for(int p=0; p<100; p++) {
|
||||
@ -504,7 +504,7 @@ void archimedean_tiling::compute_geometry() {
|
||||
triangles.resize(2*N+2);
|
||||
for(int i=0; i<N; i++) for(int j=0; j<2; j++)
|
||||
for(int k=0; k<faces[i]; k++)
|
||||
triangles[2*i+j].emplace_back(2*M_PI/faces[i], circumradius[i]);
|
||||
triangles[2*i+j].emplace_back(TAU/faces[i], circumradius[i]);
|
||||
|
||||
for(int k=0; k<N; k++) {
|
||||
triangles[2*N].emplace_back(alphas[k], circumradius[k]);
|
||||
@ -529,9 +529,9 @@ void archimedean_tiling::compute_geometry() {
|
||||
}
|
||||
|
||||
ld archimedean_tiling::scale() {
|
||||
if(real_faces == 0 && N == 2) return M_PI / 2;
|
||||
if(real_faces == 2) return M_PI / 2;
|
||||
if(real_faces == 0) return 2 * M_PI / N;
|
||||
if(real_faces == 0 && N == 2) return 90._deg;
|
||||
if(real_faces == 2) return 90._deg;
|
||||
if(real_faces == 0) return TAU / N;
|
||||
return edgelength;
|
||||
}
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ EX void drawCircle(int x, int y, int size, color_t color, color_t fillcolor IS(0
|
||||
if(pts > 1500) pts = 1500;
|
||||
if(ISMOBILE && pts > 72) pts = 72;
|
||||
for(int r=0; r<pts; r++) {
|
||||
float rr = (M_PI * 2 * r) / pts;
|
||||
float rr = (TAU * r) / pts;
|
||||
glcoords.push_back(glhr::makevertex(x + size * sin(rr), y + size * pconf.stretch * cos(rr), 0));
|
||||
}
|
||||
current_display->set_all(0, lband_shift);
|
||||
|
@ -478,7 +478,7 @@ EX namespace bt {
|
||||
}
|
||||
if(d == NODIR) return 0;
|
||||
if(d == c->type-1) d++;
|
||||
return -(d+2)*M_PI/4;
|
||||
return -(d+2) * 45._deg;
|
||||
}
|
||||
|
||||
transmatrix adj(heptagon *h, int dir) override {
|
||||
@ -726,20 +726,20 @@ EX namespace bt {
|
||||
}
|
||||
if(geometry == gHoroTris) {
|
||||
ld r3 = sqrt(3);
|
||||
direct_tmatrix[0] = xpush(-log(2)) * cspin(1,2, M_PI);
|
||||
direct_tmatrix[0] = xpush(-log(2)) * cspin180(1,2);
|
||||
direct_tmatrix[1] = parabolic3(0, +r3/3) * xpush(-log(2));
|
||||
direct_tmatrix[2] = parabolic3(-0.5, -r3/6) * xpush(-log(2));
|
||||
direct_tmatrix[3] = parabolic3(+0.5, -r3/6) * xpush(-log(2));
|
||||
direct_tmatrix[4] = parabolic3(0, -r3*2/3) * cspin(1,2, M_PI);
|
||||
direct_tmatrix[5] = parabolic3(1, r3/3) * cspin(1,2,M_PI);
|
||||
direct_tmatrix[6] = parabolic3(-1, r3/3) * cspin(1,2,M_PI);
|
||||
direct_tmatrix[4] = parabolic3(0, -r3*2/3) * cspin180(1,2);
|
||||
direct_tmatrix[5] = parabolic3(1, r3/3) * cspin180(1,2);
|
||||
direct_tmatrix[6] = parabolic3(-1, r3/3) * cspin180(1,2);
|
||||
}
|
||||
if(geometry == gHoroRec) {
|
||||
ld r2 = sqrt(2);
|
||||
ld l = -log(2)/2;
|
||||
ld z = hororec_scale;
|
||||
direct_tmatrix[0] = parabolic3(0, -z) * xpush(l) * cspin(2,1,M_PI/2);
|
||||
direct_tmatrix[1] = parabolic3(0, +z) * xpush(l) * cspin(2,1,M_PI/2);
|
||||
direct_tmatrix[0] = parabolic3(0, -z) * xpush(l) * cspin90(2,1);
|
||||
direct_tmatrix[1] = parabolic3(0, +z) * xpush(l) * cspin90(2,1);
|
||||
direct_tmatrix[2] = parabolic3(+2*r2*z, 0);
|
||||
direct_tmatrix[3] = parabolic3(0, +4*z);
|
||||
direct_tmatrix[4] = parabolic3(-2*r2*z, 0);
|
||||
@ -749,9 +749,9 @@ EX namespace bt {
|
||||
// also generated with the help of hexb.cpp
|
||||
ld l = log(3)/2;
|
||||
auto& t = direct_tmatrix;
|
||||
t[0] = parabolic3(horohex_scale, 0) * xpush(-l) * cspin(1, 2, M_PI/2);
|
||||
t[1] = cspin(1, 2, 2*M_PI/3) * t[0];
|
||||
t[2] = cspin(1, 2, 4*M_PI/3) * t[0];
|
||||
t[0] = parabolic3(horohex_scale, 0) * xpush(-l) * cspin(1, 2, 90._deg);
|
||||
t[1] = cspin(1, 2, 120*degree) * t[0];
|
||||
t[2] = cspin(1, 2, 240*degree) * t[0];
|
||||
auto it = iso_inverse(t[0]);
|
||||
|
||||
t[5] = it * t[1] * t[1];
|
||||
@ -978,7 +978,7 @@ EX int celldistance3_hex(heptagon *c1, heptagon *c2) {
|
||||
while(isize(d1)) {
|
||||
xsteps -= 2;
|
||||
|
||||
T = euscalezoom(hpxy(0,sqrt(3))) * eupush(1,0) * spin(-d2.back() * 2 * M_PI/3) * T * spin(d1.back() * 2 * M_PI/3) * eupush(-1,0) * euscalezoom(hpxy(0,-1/sqrt(3)));
|
||||
T = euscalezoom(hpxy(0,sqrt(3))) * eupush(1,0) * spin(-d2.back() * 120._deg) * T * spin(d1.back() * 2 * M_PI/3) * eupush(-1,0) * euscalezoom(hpxy(0,-1/sqrt(3)));
|
||||
|
||||
d1.pop_back(); d2.pop_back();
|
||||
|
||||
@ -1166,7 +1166,7 @@ EX void create_faces() {
|
||||
hyperpoint down = point3(0,0,2*z);
|
||||
|
||||
for(int j=0; j<4; j++) for(int i=0; i<3; i++) {
|
||||
transmatrix T = cspin(0, 1, 2*M_PI*i/3);
|
||||
transmatrix T = cspin(0, 1, 120._deg * i);
|
||||
|
||||
hyperpoint hcenter = point3(0,0,-z);
|
||||
hyperpoint hu0 = T*point3(+h, +r3,-z);
|
||||
|
@ -241,7 +241,7 @@ EX void drawArrowTraps() {
|
||||
hyperpoint trel = inverse_shift(tu, tC0(tv));
|
||||
shiftmatrix tpartial = tu * rspintox(trel) * xpush(hdist0(trel) * tt / 401.0);
|
||||
tpartial = tpartial * ypush(.05);
|
||||
if(GDIM == 3) tpartial = tpartial * cspin(1, 2, M_PI/2);
|
||||
if(GDIM == 3) tpartial = tpartial * cspin90(1, 2);
|
||||
queuepoly(tpartial, cgi.shTrapArrow, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
2
cell.cpp
2
cell.cpp
@ -1071,7 +1071,7 @@ int ld_to_int(ld x) {
|
||||
#if CAP_ARCM
|
||||
EX gp::loc pseudocoords(cell *c) {
|
||||
transmatrix T = arcm::archimedean_gmatrix[c->master].second;
|
||||
return {ld_to_int(T[0][LDIM]), ld_to_int((spin(60*degree) * T)[0][LDIM])};
|
||||
return {ld_to_int(T[0][LDIM]), ld_to_int((spin(60._deg) * T)[0][LDIM])};
|
||||
}
|
||||
|
||||
EX cdata *arcmCdata(cell *c) {
|
||||
|
@ -89,6 +89,8 @@ void eclectic_red(color_t& col) {
|
||||
part(col, 0) = part(col, 2) * 3 / 4;
|
||||
}
|
||||
|
||||
constexpr ld spinspeed = .75 / M_PI;
|
||||
|
||||
void celldrawer::setcolors() {
|
||||
|
||||
wcol = fcol = winf[c->wall].color;
|
||||
@ -105,7 +107,7 @@ void celldrawer::setcolors() {
|
||||
0x90 + 8 * sintick(1000, windmap::windcodes[windmap::getId(c)] / 256.)
|
||||
) :
|
||||
#endif
|
||||
0x1010C0 + int(32 * sintick(500, (ls::any_chaos() ? c->CHAOSPARAM : c->landparam)*.75/M_PI));
|
||||
0x1010C0 + int(32 * sintick(500, (ls::any_chaos() ? c->CHAOSPARAM : c->landparam)*spinspeed));
|
||||
else if(c->land == laOceanWall)
|
||||
fcol = 0x2020FF;
|
||||
else if(c->land == laVariant)
|
||||
@ -118,7 +120,7 @@ void celldrawer::setcolors() {
|
||||
if(c->move(i)->wall != waSea && c->move(i)->wall != waBoat)
|
||||
nearshore = true;
|
||||
if(nearshore) mafcol += 30; */
|
||||
fcol = fcol + mafcol * (4+sintick(500, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*.75/M_PI))/5;
|
||||
fcol = fcol + mafcol * (4+sintick(500, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*spinspeed))/5;
|
||||
}
|
||||
else if(c->land == laDocks) {
|
||||
fcol = 0x0000A0;
|
||||
@ -126,7 +128,7 @@ void celldrawer::setcolors() {
|
||||
else if(c->land == laAlchemist)
|
||||
fcol = 0x900090;
|
||||
else if(c->land == laWhirlpool)
|
||||
fcol = 0x0000C0 + int(32 * sintick(200, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*.75/M_PI));
|
||||
fcol = 0x0000C0 + int(32 * sintick(200, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*spinspeed));
|
||||
else if(c->land == laLivefjord)
|
||||
fcol = 0x000080;
|
||||
else if(isWarpedType(c->land))
|
||||
@ -638,7 +640,7 @@ void celldrawer::tune_colors() {
|
||||
celldist(c);
|
||||
|
||||
int dc =
|
||||
0x10101 * (127 + int(127 * sintick(200, d*.75/M_PI)));
|
||||
0x10101 * (127 + int(127 * sintick(200, d*spinspeed)));
|
||||
wcol = gradient(wcol, dc, 0, .3, 1);
|
||||
fcol = gradient(fcol, dc, 0, .3, 1);
|
||||
}
|
||||
@ -686,7 +688,7 @@ void celldrawer::draw_wall() {
|
||||
int hdir = 0;
|
||||
for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate)
|
||||
hdir = i;
|
||||
queuepolyat(V * ddspin(c, hdir, M_PI), cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
||||
queuepolyat(V * ddspin180(c, hdir), cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
||||
return;
|
||||
}
|
||||
color_t wcol0 = wcol;
|
||||
@ -712,7 +714,7 @@ void celldrawer::draw_wall() {
|
||||
int hdir = 0;
|
||||
for(int i=0; i<c->type; i++) if(c->move(i) && c->move(i)->wall == waClosedGate)
|
||||
hdir = i;
|
||||
shiftmatrix V2 = mscale(V, wmspatial?cgi.WALL:1) * ddspin(c, hdir, M_PI);
|
||||
shiftmatrix V2 = mscale(V, wmspatial?cgi.WALL:1) * ddspin180(c, hdir);
|
||||
queuepolyat(V2, cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
||||
starcol = 0;
|
||||
}
|
||||
@ -787,7 +789,7 @@ void celldrawer::draw_boat() {
|
||||
Vboat = V;
|
||||
nospin = c->wall == waBoat && applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
||||
if(!nospin) Vboat = face_the_player(V);
|
||||
else Vboat = Vboat * cspin(0, 2, M_PI);
|
||||
else Vboat = Vboat * cspin180(0, 2);
|
||||
queuepolyat(mscale(Vboat, cgi.scalefactor/2), cgi.shBoatOuter, outcol, PPR::BOATLEV2);
|
||||
queuepolyat(mscale(Vboat, cgi.scalefactor/2-0.01), cgi.shBoatInner, incol, PPR::BOATLEV2);
|
||||
return;
|
||||
@ -795,7 +797,7 @@ void celldrawer::draw_boat() {
|
||||
|
||||
if(wmspatial && c->wall == waBoat) {
|
||||
nospin = c->wall == waBoat && applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
||||
if(!nospin && c->mondir != NODIR) Vboat = Vboat * ddspin(c, c->mondir, M_PI);
|
||||
if(!nospin && c->mondir != NODIR) Vboat = Vboat * ddspin180(c, c->mondir);
|
||||
queuepolyat(Vboat, cgi.shBoatOuter, outcol, PPR::BOATLEV);
|
||||
Vboat = V;
|
||||
}
|
||||
@ -803,7 +805,7 @@ void celldrawer::draw_boat() {
|
||||
nospin = applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
||||
}
|
||||
if(!nospin && c->mondir != NODIR)
|
||||
Vboat = Vboat * ddspin(c, c->mondir, M_PI);
|
||||
Vboat = Vboat * ddspin180(c, c->mondir);
|
||||
else {
|
||||
shiftmatrix Vx;
|
||||
if(applyAnimation(c, Vx, footphase, LAYER_SMALL))
|
||||
@ -964,7 +966,7 @@ void celldrawer::draw_halfvine() {
|
||||
queuepolyat(GDIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
|
||||
if(!noshadow) {
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
queuepolyat(V2 * spin(M_PI*2/3), cgi.shSemiFloorShadow, SHADOW_WALL, GDIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW);
|
||||
queuepolyat(V2 * spin(120._deg), cgi.shSemiFloorShadow, SHADOW_WALL, GDIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW);
|
||||
}
|
||||
#if MAXMDIM >= 4
|
||||
if(GDIM == 3 && qfi.fshape) {
|
||||
@ -1032,7 +1034,7 @@ void celldrawer::draw_mirrorwall() {
|
||||
queuepolyat(V2, cgi.shHalfMirror[2], 0xC0C0C080, PPR::WALL3);
|
||||
}
|
||||
else {
|
||||
qfi.spin = ddspin(c, d, M_PI);
|
||||
qfi.spin = ddspin180(c, d);
|
||||
shiftmatrix V2 = V * qfi.spin;
|
||||
if(!wmblack) {
|
||||
inmirrorcount++;
|
||||
@ -1526,7 +1528,7 @@ void celldrawer::draw_features() {
|
||||
queuepoly(V, cgi.shThorns, 0xC080C0FF);
|
||||
|
||||
for(int u=0; u<4; u+=2)
|
||||
queuepoly(V * spin(2*M_PI / 3 / 4 * u), cgi.shRose, darkena(wcol, 0, 0xC0));
|
||||
queuepoly(V * spin(30._deg * u), cgi.shRose, darkena(wcol, 0, 0xC0));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1712,7 +1714,7 @@ void celldrawer::draw_features() {
|
||||
ld rad = cgi.hexf * (.3 * (u + ds));
|
||||
int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * cgi.hexf), 0, 0xFF);
|
||||
PRING(a)
|
||||
curvepoint(xspinpush0(a * M_PI / cgi.S42, rad));
|
||||
curvepoint(xspinpush0(a * cgi.S_step, rad));
|
||||
queuecurve(V, tcol, 0, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -1904,7 +1906,7 @@ void celldrawer::check_rotations() {
|
||||
ds.point = normalize_flat(ds.total);
|
||||
if(prod) ds.point = zshift(ds.point, ds.depth / ds.qty);
|
||||
if(side == 2) for(int i=0; i<3; i++) ds.point[i] = -ds.point[i];
|
||||
if(side == 1) ds.point = spin(-M_PI/2) * ds.point;
|
||||
if(side == 1) ds.point = spin(-90._deg) * ds.point;
|
||||
}
|
||||
};
|
||||
|
||||
@ -2535,7 +2537,7 @@ void celldrawer::add_map_effects() {
|
||||
cell *c2 = c->move(i);
|
||||
if(airdist(c2) < airdist(c)) {
|
||||
ld airdir = calcAirdir(c2); // printf("airdir = %d\n", airdir);
|
||||
transmatrix V0 = ddspin(c, i, M_PI);
|
||||
transmatrix V0 = ddspin180(c, i);
|
||||
|
||||
double ph = ptick(PURE?150:75) + airdir;
|
||||
|
||||
@ -2570,7 +2572,7 @@ void celldrawer::add_map_effects() {
|
||||
for(int t=0; t<c->type; t++) if(c->move(t)) {
|
||||
if(c->move(t)->ligon) {
|
||||
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
|
||||
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
||||
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * cgi.S_step, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
||||
}
|
||||
for(int u: {-1, 1}) {
|
||||
cellwalker cw = cellwalker(c, t) + wstep + u;
|
||||
@ -2578,7 +2580,7 @@ void celldrawer::add_map_effects() {
|
||||
cell *c2 = cw.peek();
|
||||
if(c2 && c2->ligon) {
|
||||
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
|
||||
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t)*currentmap->adj(cw.at, cw.spin), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
||||
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * cgi.S_step, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t)*currentmap->adj(cw.at, cw.spin), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2596,8 +2598,7 @@ void celldrawer::add_map_effects() {
|
||||
|
||||
int aircol = 0xC0C0FF40;
|
||||
|
||||
if(hdir1 < hdir0-M_PI) hdir1 += 2 * M_PI;
|
||||
if(hdir1 >= hdir0+M_PI) hdir1 -= 2 * M_PI;
|
||||
cyclefix(hdir1, hdir0);
|
||||
|
||||
ld hdir = (hdir1*ph1+hdir0*(1-ph1));
|
||||
|
||||
@ -2733,7 +2734,7 @@ void celldrawer::draw() {
|
||||
inmirrorcount += cmc;
|
||||
draw_grid();
|
||||
if(cw2.mirrored != cw.mirrored) V = V * Mirror;
|
||||
if(cw2.spin) V = V * spin(2*M_PI*cw2.spin/cw2.at->type);
|
||||
if(cw2.spin) V = V * spin(TAU*cw2.spin/cw2.at->type);
|
||||
cw2.spin = 0;
|
||||
dynamicval<shiftmatrix> dc(cwtV, cwtV);
|
||||
cwtV = V * inverse_shift(ggmatrix(cw2.at), cwtV);
|
||||
|
@ -248,12 +248,14 @@ EX int firegradient(double p) {
|
||||
return gradient(0xFFFF00, 0xFF0000, 0, p, 1);
|
||||
}
|
||||
|
||||
constexpr ld PI1000 = 0.001 / A_PI;
|
||||
|
||||
EX int firecolor(int phase IS(0), int mul IS(1)) {
|
||||
return gradient(0xFFFF00, 0xFF0000, -1, sintick(100*mul, phase/200./M_PI), 1);
|
||||
return gradient(0xFFFF00, 0xFF0000, -1, sintick(100*mul, phase * 5 * PI1000), 1);
|
||||
}
|
||||
|
||||
EX int watercolor(int phase) {
|
||||
return 0x0080C0FF + 256 * int(63 * sintick(50, phase/100./M_PI));
|
||||
return 0x0080C0FF + 256 * int(63 * sintick(50, phase * 10 * PI1000));
|
||||
}
|
||||
|
||||
EX int aircolor(int phase) {
|
||||
@ -270,7 +272,7 @@ EX int fghostcolor(cell *c) {
|
||||
}
|
||||
|
||||
EX int weakfirecolor(int phase) {
|
||||
return gradient(0xFF8000, 0xFF0000, -1, sintick(500, phase/1000./M_PI), 1);
|
||||
return gradient(0xFF8000, 0xFF0000, -1, sintick(500, phase * PI1000), 1);
|
||||
}
|
||||
|
||||
/* HTML color names */
|
||||
|
@ -256,31 +256,31 @@ int arg::readCommon() {
|
||||
PHASE(3); start_game();
|
||||
shift(); ld a = argf();
|
||||
shift(); ld b = argf();
|
||||
View = View * spin(M_PI * 2 * a / b);
|
||||
View = View * spin(TAU * a / b);
|
||||
playermoved = false;
|
||||
}
|
||||
else if(argis("-rotate-up")) {
|
||||
start_game();
|
||||
shiftmatrix S = ggmatrix(cwt.at->master->move(0)->c7);
|
||||
View = spin(90*degree) * spintox(S.T*C0) * View;
|
||||
View = spin90() * spintox(S.T*C0) * View;
|
||||
playermoved = false;
|
||||
}
|
||||
else if(argis("-rotate3")) {
|
||||
PHASE(3); start_game();
|
||||
shift(); ld a = argf();
|
||||
shift(); ld b = argf();
|
||||
View = View * cspin(1, 2, M_PI * 2 * a / b);
|
||||
View = View * cspin(1, 2, TAU * a / b);
|
||||
playermoved = false;
|
||||
}
|
||||
else if(argis("-face-vertex")) {
|
||||
PHASE(3); start_game();
|
||||
auto &ss = currentmap->get_cellshape(cwt.at);
|
||||
View = cspin(0, 2, M_PI/2) * spintox(ss.vertices_only_local[0]);
|
||||
View = cspin90(0, 2) * spintox(ss.vertices_only_local[0]);
|
||||
playermoved = false;
|
||||
}
|
||||
else if(argis("-face-face")) {
|
||||
PHASE(3); start_game();
|
||||
View = cspin(0, 2, M_PI/2);
|
||||
View = cspin90(0, 2);
|
||||
}
|
||||
else if(argis("-grotate")) {
|
||||
PHASE(3); start_game();
|
||||
|
10
complex2.cpp
10
complex2.cpp
@ -1239,7 +1239,7 @@ EX namespace dice {
|
||||
}
|
||||
}
|
||||
|
||||
shiftmatrix V1 = V * ddspin(c, dir) * spin(M_PI);
|
||||
shiftmatrix V1 = V * ddspin(c, dir + M_PI);
|
||||
if(dd.mirrored) V1 = V1 * MirrorY;
|
||||
|
||||
// loop:
|
||||
@ -1260,8 +1260,8 @@ EX namespace dice {
|
||||
|
||||
if(1) {
|
||||
dynamicval<eGeometry> g(geometry, gSphere);
|
||||
ld alpha = 360 * degree / dw->order;
|
||||
ld beta = 180 * degree / dw->facesides;
|
||||
ld alpha = TAU / dw->order;
|
||||
ld beta = M_PI / dw->facesides;
|
||||
inradius = edge_of_triangle_with_angles(alpha, beta, beta);
|
||||
outradius = edge_of_triangle_with_angles(beta, alpha, beta);
|
||||
}
|
||||
@ -1320,7 +1320,7 @@ EX namespace dice {
|
||||
|
||||
for(int d=0; d<si; d++) {
|
||||
dynamicval<eGeometry> g(geometry, highdim);
|
||||
add_to_queue(T * cspin(0, 1, 2*M_PI*d/si) * cspin(2, 0, inradius) * cspin(0, 1, M_PI-2*M_PI*dw->spins[ws][d]/si), dw->sides[ws][d]);
|
||||
add_to_queue(T * cspin(0, 1, TAU*d/si) * cspin(2, 0, inradius) * cspin(0, 1, M_PI-TAU*dw->spins[ws][d]/si), dw->sides[ws][d]);
|
||||
}
|
||||
|
||||
if(1) {
|
||||
@ -1363,7 +1363,7 @@ EX namespace dice {
|
||||
hyperpoint h, hs;
|
||||
if(1) {
|
||||
dynamicval<eGeometry> g(geometry, highdim);
|
||||
h = zpush(base_to_base) * T * cspin(0, 1, 2*M_PI*(d+.5)/si) * cspin(2, 0, outradius) * zpush0(dieradius);
|
||||
h = zpush(base_to_base) * T * cspin(0, 1, TAU*(d+.5)/si) * cspin(2, 0, outradius) * zpush0(dieradius);
|
||||
if(d < si) face[d] = h;
|
||||
hs = sphere_to_space(h);
|
||||
}
|
||||
|
22
config.cpp
22
config.cpp
@ -1005,7 +1005,7 @@ EX void initConfig() {
|
||||
if(ginf[i].flags & qELLIPTIC)
|
||||
sightranges[i] = M_PI;
|
||||
else if(ginf[i].cclass == gcSphere)
|
||||
sightranges[i] = 2 * M_PI;
|
||||
sightranges[i] = TAU;
|
||||
else if(ginf[i].cclass == gcEuclid)
|
||||
sightranges[i] = 10;
|
||||
else if(ginf[i].cclass == gcSL2)
|
||||
@ -1028,21 +1028,21 @@ EX void initConfig() {
|
||||
|
||||
addsaver(sightranges[gBinary3], "sight-binary3", 3.1 + bonus);
|
||||
addsaver(sightranges[gCubeTiling], "sight-cubes", 10);
|
||||
addsaver(sightranges[gCell120], "sight-120cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell120], "sight-120cell", TAU);
|
||||
addsaver(sightranges[gECell120], "sight-120cell-elliptic", M_PI);
|
||||
addsaver(sightranges[gRhombic3], "sight-rhombic", 10.5 * emul);
|
||||
addsaver(sightranges[gBitrunc3], "sight-bitrunc", 12 * emul);
|
||||
addsaver(sightranges[gSpace534], "sight-534", 4 + bonus);
|
||||
addsaver(sightranges[gSpace435], "sight-435", 3.8 + bonus);
|
||||
|
||||
addsaver(sightranges[gCell5], "sight-5cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell8], "sight-8cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell5], "sight-5cell", TAU);
|
||||
addsaver(sightranges[gCell8], "sight-8cell", TAU);
|
||||
addsaver(sightranges[gECell8], "sight-8cell-elliptic", M_PI);
|
||||
addsaver(sightranges[gCell16], "sight-16cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell16], "sight-16cell", TAU);
|
||||
addsaver(sightranges[gECell16], "sight-16cell-elliptic", M_PI);
|
||||
addsaver(sightranges[gCell24], "sight-24cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell24], "sight-24cell", TAU);
|
||||
addsaver(sightranges[gECell24], "sight-24cell-elliptic", M_PI);
|
||||
addsaver(sightranges[gCell600], "sight-600cell", 2 * M_PI);
|
||||
addsaver(sightranges[gCell600], "sight-600cell", TAU);
|
||||
addsaver(sightranges[gECell600], "sight-600cell-elliptic", M_PI);
|
||||
addsaver(sightranges[gHoroTris], "sight-horotris", 2.9 + bonus);
|
||||
addsaver(sightranges[gHoroRec], "sight-hororec", 2.2 + bonus);
|
||||
@ -1402,14 +1402,14 @@ EX void edit_sightrange() {
|
||||
if(GDIM == 3) {
|
||||
dialog::addSelItem(XLAT("3D sight range for the fog effect"), fts(sightranges[geometry]), 'r');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(sightranges[geometry], 0, 2 * M_PI, 0.5, M_PI, XLAT("fog effect"), "");
|
||||
dialog::editNumber(sightranges[geometry], 0, TAU, 0.5, M_PI, XLAT("fog effect"), "");
|
||||
});
|
||||
}
|
||||
}
|
||||
if(WDIM == 3) {
|
||||
dialog::addSelItem(XLAT("3D sight range"), fts(sightranges[geometry]), 'r');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(sightranges[geometry], 0, 2 * M_PI, 0.5, M_PI, XLAT("3D sight range"),
|
||||
dialog::editNumber(sightranges[geometry], 0, TAU, 0.5, M_PI, XLAT("3D sight range"),
|
||||
XLAT(
|
||||
"Sight range for 3D geometries is specified in the absolute units. This value also affects the fog effect.\n\n"
|
||||
"In spherical geometries, the sight range of 2π will let you see things behind you as if they were in front of you, "
|
||||
@ -2403,7 +2403,7 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
|
||||
param_f(linepatterns::parallel_count, "parallel_count")
|
||||
->editable(0, 24, 1, "number of parallels drawn", "", 'n');
|
||||
param_f(linepatterns::parallel_max, "parallel_max")
|
||||
->editable(0, 360*degree, 15*degree, "last parallel drawn", "", 'n');
|
||||
->editable(0, TAU, 15*degree, "last parallel drawn", "", 'n');
|
||||
param_f(vid.depth_bonus, "depth_bonus", 0)
|
||||
->editable(-5, 5, .1, "depth bonus in pseudohedral", "", 'b');
|
||||
param_b(vid.pseudohedral, "pseudohedral", false)
|
||||
@ -2588,7 +2588,7 @@ EX void showCustomizeChar() {
|
||||
initquickqueue();
|
||||
transmatrix V = atscreenpos(vid.xres/2, firsty, scale);
|
||||
|
||||
double alpha = atan2(mousex - vid.xres/2, mousey - firsty) - M_PI/2;
|
||||
double alpha = atan2(mousex - vid.xres/2, mousey - firsty) - 90._deg;
|
||||
V = V * spin(alpha);
|
||||
drawMonsterType(moPlayer, NULL, shiftless(V), 0, cc_footphase / scale, NOCOLOR);
|
||||
quickqueue();
|
||||
|
27
control.cpp
27
control.cpp
@ -99,7 +99,6 @@ EX movedir vectodir(hyperpoint P) {
|
||||
ld d1 = geo_dist(U * T * C0, Centered * P);
|
||||
ld d2 = geo_dist(U * T * C0, Centered * C0);
|
||||
dirdist[i] = d1 - d2;
|
||||
//xspinpush0(-i * 2 * M_PI /cwt.at->type, .5), P);
|
||||
}
|
||||
|
||||
movedir res;
|
||||
@ -122,11 +121,9 @@ EX void remission() {
|
||||
}
|
||||
|
||||
EX hyperpoint move_destination_vec(int d) {
|
||||
if(WDIM == 2) return spin(-d * M_PI/4) * smalltangent();
|
||||
// else if(WDIM == 2 && pmodel == mdPerspective) return cspin(0, 2, d * M_PI/4) * tC0(pushone());
|
||||
// else if(WDIM == 2) return spin(-d * M_PI/4) * tC0(pushone());
|
||||
else if(d&1) return cspin(0, 1, d > 4 ? M_PI/2 : -M_PI/2) * smalltangent();
|
||||
else return cspin(0, 2, d * M_PI/4) * smalltangent();
|
||||
if(WDIM == 2) return spin(-d * 45._deg) * smalltangent();
|
||||
else if(d&1) return cspin(0, 1, d > 4 ? 45._deg : -45._deg) * smalltangent();
|
||||
else return cspin(0, 2, d * 45._deg) * smalltangent();
|
||||
}
|
||||
|
||||
EX void movepckeydir(int d) {
|
||||
@ -401,7 +398,7 @@ EX void full_rotate_camera(int dir, ld val) {
|
||||
else if(GDIM == 3) {
|
||||
val *= camera_rot_speed;
|
||||
if(third_person_rotation) shift_view(ctangent(2, -third_person_rotation)), didsomething = true, playermoved = false;
|
||||
ld max_angle = quarter_circle - 1e-4;
|
||||
ld max_angle = 90._deg - 1e-4;
|
||||
if(walking::on && dir == 1) {
|
||||
max_angle /= degree;
|
||||
walking::eye_angle += val * walking::eye_angle_scale / degree;
|
||||
@ -461,8 +458,8 @@ EX void handlePanning(int sym, int uni) {
|
||||
}
|
||||
#endif
|
||||
if(!smooth_scrolling) {
|
||||
if(sym == SDLK_PAGEUP) full_rotate_view(1, M_PI/cgi.S21/2*shiftmul);
|
||||
if(sym == SDLK_PAGEDOWN) full_rotate_view(-1, -M_PI/cgi.S21/2*shiftmul);
|
||||
if(sym == SDLK_PAGEUP) full_rotate_view(1, cgi.S_step*shiftmul);
|
||||
if(sym == SDLK_PAGEDOWN) full_rotate_view(-1, -cgi.S_step*shiftmul);
|
||||
if(sym == SDLK_PAGEUP || sym == SDLK_PAGEDOWN)
|
||||
if(isGravityLand(cwt.at->land) && !rug::rug_control()) playermoved = false;
|
||||
}
|
||||
@ -925,8 +922,8 @@ EX void mainloopiter() {
|
||||
if(keystate[SDL_SCANCODE_LEFT] && DEFAULTNOR(SDL_SCANCODE_LEFT)) full_rotate_camera(0, t);
|
||||
if(keystate[SDL_SCANCODE_UP] && DEFAULTNOR(SDL_SCANCODE_UP)) full_rotate_camera(1, t);
|
||||
if(keystate[SDL_SCANCODE_DOWN] && DEFAULTNOR(SDL_SCANCODE_DOWN)) full_rotate_camera(1, -t);
|
||||
if(keystate[SDL_SCANCODE_PAGEUP] && DEFAULTNOR(SDL_SCANCODE_PAGEUP)) full_rotate_view(t * 180 / M_PI, t);
|
||||
if(keystate[SDL_SCANCODE_PAGEDOWN] && DEFAULTNOR(SDL_SCANCODE_PAGEDOWN)) full_rotate_view(-t * 180 / M_PI, -t);
|
||||
if(keystate[SDL_SCANCODE_PAGEUP] && DEFAULTNOR(SDL_SCANCODE_PAGEUP)) full_rotate_view(t / degree, t);
|
||||
if(keystate[SDL_SCANCODE_PAGEDOWN] && DEFAULTNOR(SDL_SCANCODE_PAGEDOWN)) full_rotate_view(-t / degree, -t);
|
||||
|
||||
#else
|
||||
|
||||
@ -936,8 +933,8 @@ EX void mainloopiter() {
|
||||
if(keystate[SDLK_LEFT] && DEFAULTNOR(SDLK_LEFT)) full_rotate_camera(0, t);
|
||||
if(keystate[SDLK_UP] && DEFAULTNOR(SDLK_UP)) full_rotate_camera(1, t);
|
||||
if(keystate[SDLK_DOWN] && DEFAULTNOR(SDLK_DOWN)) full_rotate_camera(1, -t);
|
||||
if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) full_rotate_view(t * 180 / M_PI, t);
|
||||
if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) full_rotate_view(-t * 180 / M_PI, -t);
|
||||
if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) full_rotate_view(t / degree, t);
|
||||
if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) full_rotate_view(-t / degree, -t);
|
||||
#endif
|
||||
}
|
||||
else sc_ticks = ticks;
|
||||
@ -952,8 +949,8 @@ EX void mainloopiter() {
|
||||
if(keystate['a'] && DEFAULTNOR('a')) full_rotate_camera(0, t);
|
||||
if(keystate['w'] && DEFAULTNOR('w')) full_rotate_camera(1, t);
|
||||
if(keystate['s'] && DEFAULTNOR('s')) full_rotate_camera(1, -t);
|
||||
if(keystate['q'] && DEFAULTNOR('q')) full_rotate_view(t * 180 / M_PI, t);
|
||||
if(keystate['e'] && DEFAULTNOR('e')) full_rotate_view(-t * 180 / M_PI, -t);
|
||||
if(keystate['q'] && DEFAULTNOR('q')) full_rotate_view(t / degree, t);
|
||||
if(keystate['e'] && DEFAULTNOR('e')) full_rotate_view(-t / degree, -t);
|
||||
|
||||
if(keystate['i'] && GDIM == 3 && DEFAULTNOR('i')) full_forward_camera(-t);
|
||||
if(keystate['k'] && GDIM == 3 && DEFAULTNOR('k')) full_forward_camera(t);
|
||||
|
13
crystal.cpp
13
crystal.cpp
@ -801,7 +801,7 @@ EX colortable coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0
|
||||
|
||||
EX ld compass_angle() {
|
||||
bool bitr = ginf[gCrystal].vertex == 3;
|
||||
return (bitr ? M_PI/8 : 0) - master_to_c7_angle();
|
||||
return (bitr ? 22.5_deg : 0) - master_to_c7_angle();
|
||||
}
|
||||
|
||||
EX bool crystal_cell(cell *c, shiftmatrix V) {
|
||||
@ -822,7 +822,7 @@ EX bool crystal_cell(cell *c, shiftmatrix V) {
|
||||
ld dist = cellgfxdist(c, 0);
|
||||
|
||||
for(int i=0; i<S7; i++) {
|
||||
shiftmatrix T = V * spin(compass_angle() - 2 * M_PI * i / S7) * xpush(dist*.3);
|
||||
shiftmatrix T = V * spin(compass_angle() - TAU * i / S7) * xpush(dist*.3);
|
||||
|
||||
auto co = m->hcoords[c->master];
|
||||
auto lw = m->makewalker(co, i);
|
||||
@ -1118,8 +1118,9 @@ EX void init_rotation() {
|
||||
|
||||
if(ho & 1) {
|
||||
for(int i=(draw_cut ? 2 : cs.dim-1); i>=1; i--) {
|
||||
ld c = cos(M_PI / 2 / (i+1));
|
||||
ld s = sin(M_PI / 2 / (i+1));
|
||||
ld alpha = 90._deg / (i+1);
|
||||
ld c = cos(alpha);
|
||||
ld s = sin(alpha);
|
||||
for(int j=0; j<cs.dim; j++)
|
||||
tie(crug_rotation[j][0], crug_rotation[j][i]) =
|
||||
make_pair(
|
||||
@ -1724,8 +1725,8 @@ void transform_crystal_to_euclid () {
|
||||
|
||||
clearAnimations();
|
||||
cwt.spin = neighborId(cwt.at, infront);
|
||||
View = iddspin(cwt.at, cwt.spin, M_PI/2);
|
||||
if(!flipplayer) View = cspin(0, 2, M_PI) * View;
|
||||
View = iddspin(cwt.at, cwt.spin, 90._deg);
|
||||
if(!flipplayer) View = cspin180(0, 2) * View;
|
||||
|
||||
if(pmodel == mdDisk) pmodel = mdPerspective;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ int read_cheat_args() {
|
||||
showstartmenu = false;
|
||||
}
|
||||
else if(argis("-top")) {
|
||||
PHASE(3); View = View * spin(-M_PI/2);
|
||||
PHASE(3); View = View * spin(-90._deg);
|
||||
}
|
||||
else if(argis("-idv")) {
|
||||
PHASE(3); View = Id;
|
||||
|
18
dialogs.cpp
18
dialogs.cpp
@ -471,9 +471,9 @@ EX namespace dialog {
|
||||
|
||||
curvepoint(hyperpoint(x-si, yt, 1, 1));
|
||||
for(int i=0; i<=a/2; i++)
|
||||
curvepoint(hyperpoint(x - si * cos(i*2*M_PI/a), yb + si * sin(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(x - si * cos(i*TAU/a), yb + si * sin(i*TAU/a), 1, 1));
|
||||
for(int i=(a+1)/2; i<=a; i++)
|
||||
curvepoint(hyperpoint(x - si * cos(i*2*M_PI/a), yt + si * sin(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(x - si * cos(i*TAU/a), yt + si * sin(i*TAU/a), 1, 1));
|
||||
queuecurve(V, col, 0x80, PPR::LINE);
|
||||
|
||||
int yt1 = yt + (list_actual_size * list_skip) / list_full_size;
|
||||
@ -481,9 +481,9 @@ EX namespace dialog {
|
||||
|
||||
curvepoint(hyperpoint(x-siz, yt1, 1, 1));
|
||||
for(int i=0; i<=a/2; i++)
|
||||
curvepoint(hyperpoint(x - siz * cos(i*2*M_PI/a), yb1 + siz * sin(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(x - siz * cos(i*TAU/a), yb1 + siz * sin(i*TAU/a), 1, 1));
|
||||
for(int i=(a+1)/2; i<=a; i++)
|
||||
curvepoint(hyperpoint(x - siz * cos(i*2*M_PI/a), yt1 + siz * sin(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(x - siz * cos(i*TAU/a), yt1 + siz * sin(i*TAU/a), 1, 1));
|
||||
queuecurve(V, col, 0x80, PPR::LINE);
|
||||
|
||||
quickqueue();
|
||||
@ -516,9 +516,9 @@ EX namespace dialog {
|
||||
|
||||
curvepoint(hyperpoint(sl, y-si, 1, 1));
|
||||
for(int i=0; i<=a/2; i++)
|
||||
curvepoint(hyperpoint(sr + si * sin(i*2*M_PI/a), y - si * cos(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(sr + si * sin(i*TAU/a), y - si * cos(i*TAU/a), 1, 1));
|
||||
for(int i=(a+1)/2; i<=a; i++)
|
||||
curvepoint(hyperpoint(sl + si * sin(i*2*M_PI/a), y - si * cos(i*2*M_PI/a), 1, 1));
|
||||
curvepoint(hyperpoint(sl + si * sin(i*TAU/a), y - si * cos(i*TAU/a), 1, 1));
|
||||
queuecurve(V, col, 0x80, PPR::LINE);
|
||||
quickqueue();
|
||||
|
||||
@ -535,7 +535,7 @@ EX namespace dialog {
|
||||
queuecurve(V, col, 0x80, PPR::LINE);
|
||||
quickqueue();
|
||||
}
|
||||
for(int i=0; i<=a; i++) curvepoint(hyperpoint(x + siz * sin(i*2*M_PI/a), y - siz * cos(i*2*M_PI/a), 1, 1));
|
||||
for(int i=0; i<=a; i++) curvepoint(hyperpoint(x + siz * sin(i*TAU/a), y - siz * cos(i*TAU/a), 1, 1));
|
||||
queuecurve(V, col, col, PPR::LINE);
|
||||
quickqueue();
|
||||
}
|
||||
@ -629,7 +629,7 @@ EX namespace dialog {
|
||||
int bx = (c == 1 || c == 3 || c == 5) ? x+1 : x;
|
||||
int by = (c == 2 || c == 4 || c == 5) ? vid.yres : 0;
|
||||
int cx = bx == 0 ? 0 : bx == 16 ?vid.xres :
|
||||
vid.xres - dwidth + width * tan((bx-8)/8. * 90 * degree);
|
||||
vid.xres - dwidth + width * tan((bx-8)/8. * 90._deg);
|
||||
part(col, 0) = lerp(0, full, bx / 16.);
|
||||
if(c == 0) println(hlog, "bx = ", bx, " -> cx = ", cx, " darken = ", part(col, 0));
|
||||
auravertices.emplace_back(hyperpoint(cx - current_display->xcenter, by - current_display->ycenter, 0, 1), col);
|
||||
@ -754,7 +754,7 @@ EX namespace dialog {
|
||||
color_t col = addalpha(I.color);
|
||||
ld sizf = dfsize * I.scale / 150;
|
||||
ld siz = sizf * sqrt(0.15+0.85*I.param/255.);
|
||||
for(int i=0; i<=a; i++) curvepoint(hyperpoint(siz * sin(i*2*M_PI/a), -siz * cos(i*2*M_PI/a), 1, 1));
|
||||
for(int i=0; i<=a; i++) curvepoint(hyperpoint(siz * sin(i*TAU/a), -siz * cos(i*TAU/a), 1, 1));
|
||||
shiftmatrix V = shiftless(atscreenpos(valuex + sizf, mid, pix));
|
||||
queuecurve(V, col, (I.colorv << 8) | 0xFF, PPR::LINE);
|
||||
quickqueue();
|
||||
|
48
drawing.cpp
48
drawing.cpp
@ -439,10 +439,10 @@ void addpoint(const shiftpoint& H) {
|
||||
if(sphere && pmodel == mdSpiral) {
|
||||
if(isize(glcoords)) {
|
||||
hyperpoint Hscr1;
|
||||
shiftpoint H1 = H; H1.shift += 2 * M_PI;
|
||||
shiftpoint H1 = H; H1.shift += TAU;
|
||||
applymodel(H1, Hscr1);
|
||||
if(hypot_d(2, Hlast-Hscr1) < hypot_d(2, Hlast-Hscr)) { Hscr = Hscr1; }
|
||||
H1.shift -= 4 * M_PI;
|
||||
H1.shift -= 2 * TAU;
|
||||
applymodel(H1, Hscr1);
|
||||
if(hypot_d(2, Hlast-Hscr1) < hypot_d(2, Hlast-Hscr)) { Hscr = Hscr1; }
|
||||
}
|
||||
@ -1108,7 +1108,7 @@ EX namespace s2xe {
|
||||
}
|
||||
|
||||
void add2(pt h, int gen) {
|
||||
glcoords.push_back(glhr::pointtogl(point31(sin(h[0]) * (h[1] + 2 * M_PI * gen), cos(h[0]) * (h[1] + 2 * M_PI * gen), h[2])));
|
||||
glcoords.push_back(glhr::pointtogl(point31(sin(h[0]) * (h[1] + TAU * gen), cos(h[0]) * (h[1] + TAU * gen), h[2])));
|
||||
stinf.tvertices.push_back(glhr::makevertex(h[3], h[4], 0));
|
||||
}
|
||||
|
||||
@ -1125,13 +1125,13 @@ EX namespace s2xe {
|
||||
bool to_right(const pt& h2, const pt& h1) {
|
||||
ld x2 = h2[0];
|
||||
ld x1 = h1[0];
|
||||
if(x2 < x1) x2 += 2 * M_PI;
|
||||
if(x2 < x1) x2 += TAU;
|
||||
return x2 >= x2 && x2 <= x1 + M_PI;
|
||||
}
|
||||
|
||||
EX int qrings = 32;
|
||||
|
||||
ld seg() { return 2 * M_PI / qrings; }
|
||||
ld seg() { return TAU / qrings; }
|
||||
|
||||
void add_ortho_triangle(pt bl, pt tl, pt br, pt tr) {
|
||||
|
||||
@ -1164,12 +1164,12 @@ EX namespace s2xe {
|
||||
}
|
||||
|
||||
void add_ordered_triangle(array<pt, 3> v) {
|
||||
if(v[1][0] < v[0][0]) v[1][0] += 2 * M_PI;
|
||||
if(v[2][0] < v[1][0]) v[2][0] += 2 * M_PI;
|
||||
if(v[1][0] < v[0][0]) v[1][0] += TAU;
|
||||
if(v[2][0] < v[1][0]) v[2][0] += TAU;
|
||||
if(v[2][0] - v[0][0] < 1e-6) return;
|
||||
ld x = (v[1][0] - v[0][0]) / (v[2][0] - v[0][0]);
|
||||
|
||||
if(v[2][0] < v[0][0] + M_PI / 4 && maxy < M_PI - M_PI/4 && sightranges[geometry] <= 5) {
|
||||
if(v[2][0] < v[0][0] + 45._deg && maxy < 135._deg && sightranges[geometry] <= 5) {
|
||||
addall(v[0], v[1], v[2]);
|
||||
return;
|
||||
}
|
||||
@ -1195,16 +1195,16 @@ EX namespace s2xe {
|
||||
}
|
||||
|
||||
void add_triangle_around(array<pt, 3> v) {
|
||||
ld baseheight = (v[0][1] > M_PI/2) ? M_PI : 0;
|
||||
ld baseheight = (v[0][1] > 90._deg) ? M_PI : 0;
|
||||
ld tu = (v[0][3] + v[1][3] + v[2][3]) / 3;
|
||||
ld tv = (v[0][4] + v[1][4] + v[2][4]) / 3;
|
||||
array<pt, 3> vhigh;
|
||||
for(int i=0; i<3; i++) { vhigh[i] = v[i]; vhigh[i][1] = baseheight; vhigh[i][3] = tu; vhigh[i][4] = tv; }
|
||||
if(v[1][0] < v[0][0]) v[1][0] = v[1][0] + 2 * M_PI, vhigh[1][0] = vhigh[1][0] + 2 * M_PI;
|
||||
if(v[1][0] < v[0][0]) v[1][0] = v[1][0] + TAU, vhigh[1][0] = vhigh[1][0] + TAU;
|
||||
add_ortho_triangle(v[0], vhigh[0], v[1], vhigh[1]);
|
||||
if(v[2][0] < v[1][0]) v[2][0] = v[2][0] + 2 * M_PI, vhigh[2][0] = vhigh[2][0] + 2 * M_PI;
|
||||
if(v[2][0] < v[1][0]) v[2][0] = v[2][0] + TAU, vhigh[2][0] = vhigh[2][0] + TAU;
|
||||
add_ortho_triangle(v[1], vhigh[1], v[2], vhigh[2]);
|
||||
if(v[0][0] < v[2][0]) v[0][0] = v[0][0] + 2 * M_PI, vhigh[0][0] = vhigh[0][0] + 2 * M_PI;
|
||||
if(v[0][0] < v[2][0]) v[0][0] = v[0][0] + TAU, vhigh[0][0] = vhigh[0][0] + TAU;
|
||||
add_ortho_triangle(v[2], vhigh[2], v[0], vhigh[0]);
|
||||
}
|
||||
|
||||
@ -1215,12 +1215,12 @@ EX namespace s2xe {
|
||||
|
||||
minz = min(abs(v[0][2]), max(abs(v[1][2]), abs(v[2][2])));
|
||||
auto& s = sightranges[geometry];
|
||||
maxgen = sqrt(s * s - minz * minz) / (2 * M_PI) + 1;
|
||||
maxgen = sqrt(s * s - minz * minz) / TAU + 1;
|
||||
|
||||
maxy = max(v[0][1], max(v[1][1], v[2][1]));
|
||||
miny = min(v[0][1], min(v[1][1], v[2][1]));
|
||||
with_zero = true;
|
||||
if(maxy < M_PI / 4) {
|
||||
if(maxy < 45._deg) {
|
||||
add2(v[0], 0);
|
||||
add2(v[1], 0);
|
||||
add2(v[2], 0);
|
||||
@ -1310,7 +1310,7 @@ void draw_s2xe0(dqi_poly *p) {
|
||||
set_width(1);
|
||||
glcoords.clear();
|
||||
|
||||
int maxgen = sightranges[geometry] / (2 * M_PI) + 1;
|
||||
int maxgen = sightranges[geometry] / TAU + 1;
|
||||
|
||||
auto crossdot = [&] (const hyperpoint h1, const hyperpoint h2) { return make_pair(h1[0] * h2[1] - h1[1] * h2[0], h1[0] * h2[0] + h1[1] * h2[1]); };
|
||||
vector<point_data> pd;
|
||||
@ -1342,7 +1342,7 @@ void draw_s2xe0(dqi_poly *p) {
|
||||
for(int i=0; i<p->cnt; i++) {
|
||||
auto &c1 = pd[i];
|
||||
auto &c0 = pd[i==0?p->cnt-1 : i-1];
|
||||
if(c1.distance > M_PI/2 && c0.distance > M_PI/2 && crossdot(c0.direction, c1.direction).second < 0) return;
|
||||
if(c1.distance > 90._deg && c0.distance > 90._deg && crossdot(c0.direction, c1.direction).second < 0) return;
|
||||
if(c1.bad == 2) return;
|
||||
if(c1.bad == 1) no_gens = true;
|
||||
}
|
||||
@ -1354,12 +1354,12 @@ void draw_s2xe0(dqi_poly *p) {
|
||||
angles[i] = atan2(pd[i].direction[1], pd[i].direction[0]);
|
||||
}
|
||||
sort(angles.begin(), angles.end());
|
||||
angles.push_back(angles[0] + 2 * M_PI);
|
||||
angles.push_back(angles[0] + TAU);
|
||||
bool ok = false;
|
||||
for(int i=1; i<isize(angles); i++)
|
||||
if(angles[i] >= angles[i-1] + M_PI) ok = true;
|
||||
if(!ok) {
|
||||
for(auto &c: pd) if(c.distance > M_PI/2) return;
|
||||
for(auto &c: pd) if(c.distance > 90._deg) return;
|
||||
no_gens = true;
|
||||
}
|
||||
}
|
||||
@ -1369,7 +1369,7 @@ void draw_s2xe0(dqi_poly *p) {
|
||||
for(int gen=-g; gen<=g; gen++) {
|
||||
for(int i=0; i<p->cnt; i++) {
|
||||
auto& cur = pd[i];
|
||||
ld d = cur.distance + 2 * M_PI * gen;
|
||||
ld d = cur.distance + TAU * gen;
|
||||
hyperpoint h;
|
||||
h[0] = cur.direction[0] * d;
|
||||
h[1] = cur.direction[1] * d;
|
||||
@ -1572,9 +1572,9 @@ EX namespace ods {
|
||||
|
||||
for(int j=0; j<6; j++) {
|
||||
// let Delta be from 0 to 2PI
|
||||
if(h[j][2]<0) h[j][2] += 2 * M_PI;
|
||||
if(h[j][2]<0) h[j][2] += TAU;
|
||||
// Theta is from -PI/2 to PI/2. Let it be from 0 to PI
|
||||
h[j][1] += global_projection * M_PI/2;
|
||||
h[j][1] += global_projection * 90._deg;
|
||||
h[j][3] = 1;
|
||||
}
|
||||
|
||||
@ -1591,8 +1591,8 @@ EX namespace ods {
|
||||
cyclefix(h[4][0], h[3][0]);
|
||||
cyclefix(h[5][0], h[3][0]);
|
||||
|
||||
if(abs(h[1][1] - h[0][1]) > M_PI/2) goto next_i;
|
||||
if(abs(h[2][1] - h[0][1]) > M_PI/2) goto next_i;
|
||||
if(abs(h[1][1] - h[0][1]) > 90._deg) goto next_i;
|
||||
if(abs(h[2][1] - h[0][1]) > 90._deg) goto next_i;
|
||||
|
||||
if(h[0][0] < -M_PI || h[0][0] > M_PI) println(hlog, h[0][0]);
|
||||
|
||||
@ -1601,7 +1601,7 @@ EX namespace ods {
|
||||
if(h[1][0] < -M_PI || h[2][0] < -M_PI) lst++;
|
||||
if(h[1][0] > +M_PI || h[2][0] > +M_PI) fst--;
|
||||
for(int x=fst; x<=lst; x++) for(int j=0; j<3; j++) {
|
||||
glcoords.push_back(glhr::makevertex(h[j][0] + 2 * M_PI * x, h[j][1], h[j][2]));
|
||||
glcoords.push_back(glhr::makevertex(h[j][0] + TAU * x, h[j][1], h[j][2]));
|
||||
if(npoly.tinf) stinf.tvertices.push_back(p->tinf->tvertices[p->offset_texture+i+j]);
|
||||
}
|
||||
}
|
||||
|
8
fake.cpp
8
fake.cpp
@ -237,19 +237,17 @@ EX namespace fake {
|
||||
auto h1 = V * befake(FPIU(get_corner_position(c, (i+1) % c->type)));
|
||||
ld b0 = atan2(unshift(h0));
|
||||
ld b1 = atan2(unshift(h1));
|
||||
while(b1 < b0) b1 += 2 * M_PI;
|
||||
while(b1 < b0) b1 += TAU;
|
||||
if(a0 == -1) {
|
||||
draw_recursive(c->move(i), optimized_shift(V * adj(c, i)), b0, b1, c, depth+1);
|
||||
}
|
||||
else {
|
||||
if(b1 - b0 > M_PI) continue;
|
||||
|
||||
if(b0 < a0 - M_PI) b0 += 2 * M_PI;
|
||||
if(b0 > a0 + M_PI) b0 -= 2 * M_PI;
|
||||
cyclefix(b0, a0);
|
||||
if(b0 < a0) b0 = a0;
|
||||
|
||||
if(b1 > a1 + M_PI) b1 -= 2 * M_PI;
|
||||
if(b1 < a1 - M_PI) b1 += 2 * M_PI;
|
||||
cyclefix(b1, a1);
|
||||
if(b1 > a1) b1 = a1;
|
||||
|
||||
if(b0 > b1) continue;
|
||||
|
@ -106,8 +106,8 @@ mesher msh(eGeometry g, int sym, ld main, ld v0, ld v1, ld bspi, ld scale) {
|
||||
dynamicval<eGeometry> dg(geometry, g);
|
||||
|
||||
hyperpoint rot = xpush(v0) * xspinpush0(M_PI - M_PI/sym, main);
|
||||
hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush0(hdist0(rot));
|
||||
hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush0(hdist0(rot));
|
||||
hyperpoint bnlfar = xpush(v0) * spin180() * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush0(hdist0(rot));
|
||||
hyperpoint bnrfar = xpush(v0) * spin180() * spintox(rot) * spintox(rot) * spintox(rot) * xpush0(hdist0(rot));
|
||||
|
||||
m.lcorner = xspinpush0 (bspi - M_PI/sym, main);
|
||||
m.rcorner = xspinpush0 (bspi + M_PI/sym, main);
|
||||
@ -115,8 +115,8 @@ mesher msh(eGeometry g, int sym, ld main, ld v0, ld v1, ld bspi, ld scale) {
|
||||
m.mfar[1] = xspinpush0 (bspi, v1);
|
||||
m.vfar[0] = spin(bspi) * bnlfar;
|
||||
m.vfar[2] = spin(bspi) * bnrfar;
|
||||
m.vfar[1] = spin(-2*M_PI/sym) * m.vfar[2];
|
||||
m.vfar[3] = spin(+2*M_PI/sym) * m.vfar[0];
|
||||
m.vfar[1] = spin(-TAU/sym) * m.vfar[2];
|
||||
m.vfar[3] = spin(+TAU/sym) * m.vfar[0];
|
||||
|
||||
return m;
|
||||
}
|
||||
@ -131,7 +131,7 @@ matrixitem genitem(const transmatrix& m1, const transmatrix& m2, int nsym) {
|
||||
mi.first = m1;
|
||||
mi.second.resize(nsym);
|
||||
for(int i=0; i<nsym; i++)
|
||||
mi.second[i] = spin(2*M_PI*i/nsym) * m2;
|
||||
mi.second[i] = spin(TAU*i/nsym) * m2;
|
||||
return mi;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ EX hyperpoint may_kleinize(hyperpoint h) {
|
||||
|
||||
void addmatrix(matrixlist& matrices, hyperpoint o0, hyperpoint o1, hyperpoint o2, hyperpoint n0, hyperpoint n1, hyperpoint n2, int d, int osym, int nsym) {
|
||||
if(do_kleinize()) o0 = kleinize(o0), o1 = kleinize(o1), o2 = kleinize(o2), n0 = kleinize(n0), n1 = kleinize(n1), n2 = kleinize(n2);
|
||||
matrices.v.push_back(genitem(inverse(spin(2*M_PI*d/osym)*build_matrix(o0, o1, o2,C02)), spin(2*M_PI*d/nsym)*build_matrix(n0, n1, n2,C02), nsym));
|
||||
matrices.v.push_back(genitem(inverse(spin(TAU*d/osym)*build_matrix(o0, o1, o2,C02)), spin(TAU*d/nsym)*build_matrix(n0, n1, n2,C02), nsym));
|
||||
}
|
||||
|
||||
matrixlist hex_matrices, hept_matrices;
|
||||
@ -225,10 +225,10 @@ void geometry_information::bshape2(hpcshape& sh, PPR prio, int shapeid, matrixli
|
||||
hyperpoint lstmid = hpxyz(0,0,0);
|
||||
for(auto pp: lst) lstmid += pp;
|
||||
transmatrix T = spin(-m.o.bspi);
|
||||
while((spin(2*M_PI / rots) * T* lstmid)[0] < (T*lstmid)[0])
|
||||
T = spin(2*M_PI / rots) * T;
|
||||
while((spin(-2*M_PI / rots) * T* lstmid)[0] < (T*lstmid)[0])
|
||||
T = spin(-2*M_PI / rots) * T;
|
||||
while((spin(TAU / rots) * T* lstmid)[0] < (T*lstmid)[0])
|
||||
T = spin(TAU / rots) * T;
|
||||
while((spin(-TAU / rots) * T* lstmid)[0] < (T*lstmid)[0])
|
||||
T = spin(-TAU / rots) * T;
|
||||
T = spin(m.o.bspi) * T;
|
||||
for(auto &pp: lst) pp = T * pp;
|
||||
|
||||
@ -238,7 +238,7 @@ void geometry_information::bshape2(hpcshape& sh, PPR prio, int shapeid, matrixli
|
||||
int rep = rots / osym;
|
||||
int s = lst.size();
|
||||
for(int i=0; i<s*(rep-1); i++)
|
||||
lst.push_back(spin(2*M_PI/rots) * lst[i]);
|
||||
lst.push_back(spin(TAU/rots) * lst[i]);
|
||||
rots /= rep;
|
||||
}
|
||||
|
||||
@ -333,11 +333,11 @@ void geometry_information::bshape_regular(floorshape &fsh, int id, int sides, ld
|
||||
|
||||
bshape(fsh.b[id], fsh.prio);
|
||||
for(int t=0; t<=sides; t++)
|
||||
hpcpush(xspinpush0(t*2 * M_PI / sides + shift * M_PI / S42, size));
|
||||
hpcpush(xspinpush0(t * TAU / sides + shift * S_step, size));
|
||||
|
||||
bshape(fsh.shadow[id], fsh.prio);
|
||||
for(int t=0; t<=sides; t++)
|
||||
hpcpush(xspinpush0(t*2 * M_PI / sides + shift * M_PI / S42, size * SHADMUL));
|
||||
hpcpush(xspinpush0(t * TAU / sides + shift * S_step, size * SHADMUL));
|
||||
|
||||
for(int k=0; k<SIDEPARS; k++) {
|
||||
fsh.side[k].resize(2);
|
||||
@ -1218,7 +1218,7 @@ void draw_shape_for_texture(floorshape* sh) {
|
||||
queuepoly(shiftless(eupush(gx+a, gy+b)), sh->b[0], 0xFFFFFFFF);
|
||||
|
||||
if(sh == &cgi.shCrossFloor) {
|
||||
queuepoly(shiftless(eupush(gx, gy) * spin(M_PI/4)), cgi.shCross, 0x808080FF);
|
||||
queuepoly(shiftless(eupush(gx, gy) * spin(45._deg)), cgi.shCross, 0x808080FF);
|
||||
}
|
||||
|
||||
if(1) {
|
||||
@ -1237,8 +1237,8 @@ void draw_shape_for_texture(floorshape* sh) {
|
||||
ld d = hdist(h1, h2);
|
||||
hyperpoint h3 = h1 + (h2-h1) /d * min(d, .1);
|
||||
for(int a=0; a<4; a++) {
|
||||
curvepoint(eupush(gx,gy) * eupush(spin(90*degree*a) * h1) * C0);
|
||||
curvepoint(eupush(gx,gy) * eupush(spin(90*degree*a) * h3) * C0);
|
||||
curvepoint(eupush(gx,gy) * eupush(spin(90._deg*a) * h1) * C0);
|
||||
curvepoint(eupush(gx,gy) * eupush(spin(90._deg*a) * h3) * C0);
|
||||
queuecurve(shiftless(Id), 0x10101010, 0, PPR::LINE);
|
||||
}
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ EX geometry_data compute_geometry_data() {
|
||||
gd.size_str =
|
||||
disksize ? its(isize(currentmap->allcells())) :
|
||||
#if CAP_BT
|
||||
bt::in() ? fts(8 * M_PI * sqrt(2) * log(2) / pow(vid.binary_width, WDIM-1), 4) + " exp(∞)" :
|
||||
bt::in() ? fts(1440._deg * sqrt(2) * log(2) / pow(vid.binary_width, WDIM-1), 4) + " exp(∞)" :
|
||||
#endif
|
||||
#if CAP_ARCM
|
||||
arcm::in() && (WDIM == 2) ? arcm::current.world_size() :
|
||||
|
27
geometry.cpp
27
geometry.cpp
@ -410,6 +410,7 @@ hpcshape
|
||||
hpcshape shFullCross[2];
|
||||
|
||||
int SD3, SD6, SD7, S12, S14, S21, S28, S42, S36, S84;
|
||||
ld S_step;
|
||||
|
||||
vector<pair<int, cell*>> walloffsets;
|
||||
|
||||
@ -582,7 +583,7 @@ void geometry_information::prepare_basics() {
|
||||
|
||||
hexshift = 0;
|
||||
|
||||
ld ALPHA = 2 * M_PI / S7;
|
||||
ld ALPHA = TAU / S7;
|
||||
|
||||
ld fmin, fmax;
|
||||
|
||||
@ -612,7 +613,7 @@ void geometry_information::prepare_basics() {
|
||||
t->hcrossf = cgi.crossf / d;
|
||||
t->tessf = cgi.tessf / d;
|
||||
t->hexvdist = cgi.hexvdist / d;
|
||||
t->hexhexdist = hdist(xpush0(cgi.hcrossf), xspinpush0(M_PI*2/S7, cgi.hcrossf)) / d;
|
||||
t->hexhexdist = hdist(xpush0(cgi.hcrossf), xspinpush0(TAU/S7, cgi.hcrossf)) / d;
|
||||
t->base_distlimit = cgi.base_distlimit-1;
|
||||
});
|
||||
goto hybrid_finish;
|
||||
@ -629,13 +630,13 @@ void geometry_information::prepare_basics() {
|
||||
s3 = S3;
|
||||
if(fake::in() && !arcm::in()) s3 = fake::around;
|
||||
|
||||
beta = (S3 >= OINF && !fake::in()) ? 0 : 2*M_PI/s3;
|
||||
beta = (S3 >= OINF && !fake::in()) ? 0 : TAU/s3;
|
||||
|
||||
tessf = euclid ? 1 : edge_of_triangle_with_angles(beta, M_PI/S7, M_PI/S7);
|
||||
|
||||
if(elliptic && S7 == 4 && !fake::in()) tessf = M_PI/2;
|
||||
if(elliptic && S7 == 4 && !fake::in()) tessf = 90._deg;
|
||||
|
||||
hcrossf = euclid ? tessf / 2 / sin(M_PI/s3) : edge_of_triangle_with_angles(M_PI/2, M_PI/S7, beta/2);
|
||||
hcrossf = euclid ? tessf / 2 / sin(M_PI/s3) : edge_of_triangle_with_angles(90._deg, M_PI/S7, beta/2);
|
||||
|
||||
if(S3 >= OINF) hcrossf = 10;
|
||||
|
||||
@ -645,15 +646,15 @@ void geometry_information::prepare_basics() {
|
||||
for(int p=0; p<100; p++) {
|
||||
ld f = (fmin+fmax) / 2;
|
||||
hyperpoint H = xpush0(f);
|
||||
hyperpoint H1 = spin(2*M_PI/S7) * H;
|
||||
hyperpoint H1 = spin(TAU/S7) * H;
|
||||
hyperpoint H2 = xpush0(tessf-f);
|
||||
ld v1 = intval(H, H1), v2 = intval(H, H2);
|
||||
|
||||
if(fake::in() && WDIM == 2) {
|
||||
hexvdist = hdist(xpush0(f), xspinpush0(ALPHA/2, hcrossf));
|
||||
v2 = hdist(
|
||||
spin(M_PI/2/S3) * xpush0(hexvdist),
|
||||
spin(-M_PI/2/S3) * xpush0(hexvdist)
|
||||
spin(90._deg/S3) * xpush0(hexvdist),
|
||||
spin(-90._deg/S3) * xpush0(hexvdist)
|
||||
);
|
||||
|
||||
v1 = hdist(
|
||||
@ -667,7 +668,7 @@ void geometry_information::prepare_basics() {
|
||||
hexf = fmin;
|
||||
|
||||
rhexf = BITRUNCATED ? hexf : hcrossf;
|
||||
edgelen = hdist(xpush0(rhexf), xspinpush0(M_PI*2/S7, rhexf));
|
||||
edgelen = hdist(xpush0(rhexf), xspinpush0(TAU/S7, rhexf));
|
||||
|
||||
if(BITRUNCATED && !(S7&1))
|
||||
hexshift = ALPHA/2 + ALPHA * ((S7-1)/2) + M_PI;
|
||||
@ -690,7 +691,7 @@ void geometry_information::prepare_basics() {
|
||||
|
||||
hexhexdist = fake::in() ?
|
||||
2 * hdist0(mid(xspinpush0(M_PI/S6, hexvdist), xspinpush0(-M_PI/S6, hexvdist)))
|
||||
: hdist(xpush0(crossf), xspinpush0(M_PI*2/S7, crossf));
|
||||
: hdist(xpush0(crossf), xspinpush0(TAU/S7, crossf));
|
||||
|
||||
DEBB(DF_GEOM | DF_POLY,
|
||||
(format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
|
||||
@ -968,7 +969,7 @@ EX namespace geom3 {
|
||||
BIRD = 1.20;
|
||||
}
|
||||
else {
|
||||
INFDEEP = GDIM == 3 ? (sphere ? M_PI/2 : +5) : (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(vid.camera);
|
||||
INFDEEP = GDIM == 3 ? (sphere ? 90._deg : +5) : (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(vid.camera);
|
||||
ld wh = actual_wall_height();
|
||||
WALL = lev_to_factor(wh);
|
||||
FLOOR = lev_to_factor(0);
|
||||
@ -1091,8 +1092,8 @@ EX void switch_always3() {
|
||||
ld ms = min<ld>(cgi.scalefactor, 1);
|
||||
vid.wall_height = 1.5 * ms;
|
||||
if(sphere) {
|
||||
vid.depth = M_PI / 6;
|
||||
vid.wall_height = M_PI / 3;
|
||||
vid.depth = 30 * degree;
|
||||
vid.wall_height = 60 * degree;
|
||||
}
|
||||
vid.human_wall_ratio = 0.8;
|
||||
if(euclid && allowIncreasedSight() && vid.use_smart_range == 0) {
|
||||
|
@ -57,7 +57,7 @@ transmatrix hrmap_standard::master_relative(cell *c, bool get_inverse) {
|
||||
#if CAP_IRR
|
||||
else if(IRREGULAR) {
|
||||
int id = irr::cellindex[c];
|
||||
ld alpha = 2 * M_PI / S7 * irr::periodmap[c->master].base.spin;
|
||||
ld alpha = TAU / S7 * irr::periodmap[c->master].base.spin;
|
||||
return get_inverse ? irr::cells[id].rpusher * spin(-alpha-master_to_c7_angle()): spin(alpha + master_to_c7_angle()) * irr::cells[id].pusher;
|
||||
}
|
||||
#endif
|
||||
@ -100,12 +100,12 @@ transmatrix hrmap_standard::adj(heptagon *h, int d) {
|
||||
int t0 = h->type;
|
||||
int t1 = h->cmove(d)->type;
|
||||
int sp = h->c.spin(d);
|
||||
return spin(-d * 2 * M_PI / t0) * xpush(spacedist(h->c7, d)) * spin(M_PI + 2*M_PI*sp/t1);
|
||||
return spin(-d * TAU / t0) * xpush(spacedist(h->c7, d)) * spin(M_PI + TAU * sp / t1);
|
||||
}
|
||||
transmatrix T = cgi.heptmove[d];
|
||||
if(h->c.mirror(d)) T = T * Mirror;
|
||||
int sp = h->c.spin(d);
|
||||
if(sp) T = T * spin(2*M_PI*sp/S7);
|
||||
if(sp) T = T * spin(TAU*sp/S7);
|
||||
return T;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ EX bool no_easy_spin() {
|
||||
ld hrmap_standard::spin_angle(cell *c, int d) {
|
||||
if(WDIM == 3) return SPIN_NOT_AVAILABLE;
|
||||
ld hexshift = 0;
|
||||
if(c == c->master->c7 && (S7 % 2 == 0) && BITRUNCATED) hexshift = cgi.hexshift + 2*M_PI/c->type;
|
||||
if(c == c->master->c7 && (S7 % 2 == 0) && BITRUNCATED) hexshift = cgi.hexshift + TAU/c->type;
|
||||
else if(cgi.hexshift && c == c->master->c7) hexshift = cgi.hexshift;
|
||||
#if CAP_IRR
|
||||
if(IRREGULAR) {
|
||||
@ -454,7 +454,7 @@ ld hrmap_standard::spin_angle(cell *c, int d) {
|
||||
return -atan2(p[1], p[0]) - hexshift;
|
||||
}
|
||||
#endif
|
||||
return M_PI - d * 2 * M_PI / c->type - hexshift;
|
||||
return M_PI - d * TAU / c->type - hexshift;
|
||||
}
|
||||
|
||||
EX transmatrix ddspin(cell *c, int d, ld bonus IS(0)) { return currentmap->spin_to(c, d, bonus); }
|
||||
@ -543,14 +543,14 @@ EX hyperpoint randomPointIn(int t) {
|
||||
if(NONSTDVAR || arcm::in() || kite::in()) {
|
||||
// Let these geometries be less confusing.
|
||||
// Also easier to implement ;)
|
||||
return xspinpush0(2 * M_PI * randd(), asinh(randd() / 20));
|
||||
return xspinpush0(TAU * randd(), asinh(randd() / 20));
|
||||
}
|
||||
while(true) {
|
||||
hyperpoint h = xspinpush0(2*M_PI*(randd()-.5)/t, asinh(randd()));
|
||||
hyperpoint h = xspinpush0(TAU * (randd()-.5)/t, asinh(randd()));
|
||||
double d =
|
||||
PURE ? cgi.tessf : t == 6 ? cgi.hexhexdist : cgi.crossf;
|
||||
if(hdist0(h) < hdist0(xpush(-d) * h))
|
||||
return spin(2*M_PI/t * (rand() % t)) * h;
|
||||
return spin(TAU / t * (rand() % t)) * h;
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ EX hyperpoint nearcorner(cell *c, int i) {
|
||||
auto& t = ac.get_triangle(c->master, i-1);
|
||||
int id = arcm::id_of(c->master);
|
||||
int id1 = ac.get_adj(ac.get_adj(c->master, i-1), -2).first;
|
||||
return xspinpush0(-t.first - M_PI / c->type, ac.inradius[id/2] + ac.inradius[id1/2] + (ac.real_faces == 0 ? 2 * M_PI / (ac.N == 2 ? 2.1 : ac.N) : 0));
|
||||
return xspinpush0(-t.first - M_PI / c->type, ac.inradius[id/2] + ac.inradius[id1/2] + (ac.real_faces == 0 ? TAU / (ac.N == 2 ? 2.1 : ac.N) : 0));
|
||||
}
|
||||
if(BITRUNCATED) {
|
||||
auto &ac = arcm::current;
|
||||
|
@ -646,12 +646,12 @@ EX namespace gp {
|
||||
}
|
||||
if(sp>SG3) sp -= SG6;
|
||||
|
||||
return normalize(spin(2*M_PI*sp/S7) * cornmul(T, corner));
|
||||
return normalize(spin(TAU*sp/S7) * cornmul(T, corner));
|
||||
}
|
||||
|
||||
transmatrix dir_matrix(int i) {
|
||||
auto ddspin = [] (int d) -> transmatrix {
|
||||
return spin(M_PI - d * 2 * M_PI / S7 - cgi.hexshift);
|
||||
return spin(M_PI - d * TAU / S7 - cgi.hexshift);
|
||||
};
|
||||
return spin(-cgi.gpdata->alpha) * build_matrix(
|
||||
C0,
|
||||
@ -678,7 +678,7 @@ EX namespace gp {
|
||||
|
||||
hyperpoint h = atz(T, cgi.gpdata->corners, at, 6);
|
||||
hyperpoint hl = atz(T, cgi.gpdata->corners, at + eudir(d), 6);
|
||||
cgi.gpdata->Tf[i][x&GOLDBERG_MASK][y&GOLDBERG_MASK][d] = rgpushxto0(h) * rspintox(gpushxto0(h) * hl) * spin(M_PI);
|
||||
cgi.gpdata->Tf[i][x&GOLDBERG_MASK][y&GOLDBERG_MASK][d] = rgpushxto0(h) * rspintox(gpushxto0(h) * hl) * spin180();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
125
graph.cpp
125
graph.cpp
@ -45,6 +45,9 @@ EX bool hide_player() {
|
||||
;
|
||||
}
|
||||
|
||||
EX transmatrix ddspin180(cell *c, int dir) { return ddspin(c, dir, M_PI); }
|
||||
EX transmatrix iddspin180(cell *c, int dir) { return iddspin(c, dir, M_PI); }
|
||||
|
||||
#if HDR
|
||||
template<class T>
|
||||
class span {
|
||||
@ -74,11 +77,11 @@ EX int animation_lcm = 0;
|
||||
|
||||
EX ld ptick(int period, ld phase IS(0)) {
|
||||
if(animation_lcm) animation_lcm = animation_lcm * (period / gcd(animation_lcm, period));
|
||||
return (ticks * animation_factor * vid.ispeed) / period + phase * 2 * M_PI;
|
||||
return (ticks * animation_factor * vid.ispeed) / period + phase * TAU;
|
||||
}
|
||||
|
||||
EX ld fractick(int period, ld phase IS(0)) {
|
||||
ld t = ptick(period, phase) / 2 / M_PI;
|
||||
ld t = ptick(period, phase) / TAU;
|
||||
t -= floor(t);
|
||||
if(t<0) t++;
|
||||
return t;
|
||||
@ -137,7 +140,7 @@ EX bool doHighlight() {
|
||||
int dlit;
|
||||
|
||||
ld spina(cell *c, int dir) {
|
||||
return 2 * M_PI * dir / c->type;
|
||||
return TAU * dir / c->type;
|
||||
}
|
||||
|
||||
/** @brief used to alternate colors depending on distance to something. In chessboard-patterned geometries, also use a third step */
|
||||
@ -186,7 +189,7 @@ EX void drawShield(const shiftmatrix& V, eItem it) {
|
||||
#endif
|
||||
else {
|
||||
for(ld a=0; a<=cgi.S84*mt+1e-6; a+=pow(.5, vid.linequality))
|
||||
curvepoint(xspinpush0(a * M_PI/cgi.S42, d + sin(ds + M_PI*2*a/4/mt)*.1));
|
||||
curvepoint(xspinpush0(a * cgi.S_step, d + sin(ds + 90._deg*a/mt)*.1));
|
||||
queuecurve(V, darkena(col, 0, 0xFF), 0x8080808, PPR::LINE);
|
||||
}
|
||||
#endif
|
||||
@ -202,7 +205,7 @@ void drawSpeed(const shiftmatrix& V, ld scale=1) {
|
||||
#endif
|
||||
for(int b=0; b<cgi.S84; b+=cgi.S14) {
|
||||
PRING(a)
|
||||
curvepoint(xspinpush0((ds+b+a) * M_PI/cgi.S42, cgi.hexf*a/cgi.S84*scale));
|
||||
curvepoint(xspinpush0((ds+b+a) * cgi.S_step, cgi.hexf*a/cgi.S84*scale));
|
||||
queuecurve(V, col, 0x8080808, PPR::LINE);
|
||||
}
|
||||
#endif
|
||||
@ -219,7 +222,7 @@ void drawSafety(const shiftmatrix& V, int ct) {
|
||||
}
|
||||
#endif
|
||||
for(int a=0; a<ct; a++)
|
||||
queueline(V*xspinpush0((ds+a*cgi.S84/ct) * M_PI/cgi.S42, 2*cgi.hexf), V*xspinpush0((ds+(a+(ct-1)/2)*cgi.S84/ct) * M_PI / cgi.S42, 2*cgi.hexf), col, vid.linequality);
|
||||
queueline(V*xspinpush0((ds+a*cgi.S84/ct) * cgi.S_step, 2*cgi.hexf), V*xspinpush0((ds+(a+(ct-1)/2)*cgi.S84/ct) * cgi.S_step, 2*cgi.hexf), col, vid.linequality);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -238,7 +241,7 @@ void drawFlash(const shiftmatrix& V) {
|
||||
if(1) ;
|
||||
#endif
|
||||
else {
|
||||
PRING(a) curvepoint(xspinpush0(a * M_PI / cgi.S42, rad));
|
||||
PRING(a) curvepoint(xspinpush0(a * cgi.S_step, rad));
|
||||
queuecurve(V, col, 0x8080808, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -275,12 +278,12 @@ void drawLove(const shiftmatrix& V, int hdir) {
|
||||
for(int u=0; u<5; u++) {
|
||||
shiftmatrix V1 = chei(V, u, 5);
|
||||
PRING(a) {
|
||||
double d = (1 + cos(a * M_PI/cgi.S42)) / 2;
|
||||
double d = (1 + cos(a * cgi.S_step)) / 2;
|
||||
double z = a; if(z>cgi.S42) z = cgi.S84-z;
|
||||
if(z <= 10) d += (10-z) * (10-z) * (10-z) / 3000.;
|
||||
|
||||
ld rad = cgi.hexf * (2.5 + .5 * sin(ds+u*.3)) * d;
|
||||
curvepoint(xspinpush0((cgi.S42+hdir+a-1) * M_PI/cgi.S42, rad));
|
||||
curvepoint(xspinpush0((cgi.S42+hdir+a-1) * cgi.S_step, rad));
|
||||
}
|
||||
queuecurve(V1, col, 0x8080808, PPR::LINE);
|
||||
}
|
||||
@ -292,7 +295,7 @@ void drawWinter(const shiftmatrix& V, ld hdir, color_t col) {
|
||||
float ds = ptick(300);
|
||||
col = darkena(col, 0, 0xFF);
|
||||
for(int u=0; u<20; u++) {
|
||||
ld rad = sin(ds+u * 2 * M_PI / 20) * M_PI / S7;
|
||||
ld rad = sin(ds+u * TAU / 20) * M_PI / S7;
|
||||
shiftmatrix V1 = chei(V, u, 20);
|
||||
queueline(V1*xspinpush0(M_PI+hdir+rad, cgi.hexf*.5), V1*xspinpush0(M_PI+hdir+rad, cgi.hexf*3), col, 2 + vid.linequality);
|
||||
}
|
||||
@ -312,7 +315,7 @@ void drawLightning(const shiftmatrix& V) {
|
||||
else {
|
||||
if(u % 5) leng = 1.25 + sintick(200, ld(u) * 1.25) * 0.25;
|
||||
else leng = 2 + sintick(200, ld(u) * 1.25);
|
||||
rad = (u + ds) * (M_PI / 10);
|
||||
rad = (u + ds) * TAU / 20;
|
||||
}
|
||||
shiftmatrix V1 = chei(V, u, 20);
|
||||
queueline(V1*xspinpush0(rad, cgi.hexf*0.3), V1*xspinpush0(rad, cgi.hexf*leng), col, 2 + vid.linequality);
|
||||
@ -332,7 +335,7 @@ void drawCurse(const shiftmatrix& V, eItem it) {
|
||||
}
|
||||
else {
|
||||
leng = 0.85 + sintick(150, ld(u) * 1.25) * 0.15;
|
||||
rad = (u + ds) * (M_PI / 10);
|
||||
rad = (u + ds) * TAU / 20;
|
||||
}
|
||||
shiftmatrix V1 = chei(V, u, 20);
|
||||
queueline(V1*xspinpush0(rad, cgi.hexf*0.3), V1*xspinpush0(rad, cgi.hexf*leng), col, 2 + vid.linequality);
|
||||
@ -368,7 +371,7 @@ EX void drawPlayerEffects(const shiftmatrix& V, const shiftmatrix& Vparam, cell
|
||||
else if(SWORDDIM == 3) {
|
||||
#if CAP_SHAPES
|
||||
shiftmatrix Vsword =
|
||||
shmup::on ? V * shmup::swordmatrix[multi::cpid] * cspin(2, 0, M_PI/2)
|
||||
shmup::on ? V * shmup::swordmatrix[multi::cpid] * cspin90(2, 0)
|
||||
: Vparam * rgpushxto0(inverse_shift(gmatrix[c], tC0(V))) * sword::dir[multi::cpid].T;
|
||||
|
||||
if(items[itOrbSword])
|
||||
@ -384,7 +387,7 @@ EX void drawPlayerEffects(const shiftmatrix& V, const shiftmatrix& Vparam, cell
|
||||
ang %= sword::sword_angles;
|
||||
|
||||
#if CAP_QUEUE || CAP_SHAPES
|
||||
shiftmatrix Vnow = Vparam * rgpushxto0(inverse_shift(Vparam, tC0(V))) * ddspin(c,0,M_PI);
|
||||
shiftmatrix Vnow = Vparam * rgpushxto0(inverse_shift(Vparam, tC0(V))) * ddspin180(c,0);
|
||||
#endif
|
||||
|
||||
int adj = 1 - ((sword_angles/cwt.at->type)&1);
|
||||
@ -444,7 +447,7 @@ EX void drawPlayerEffects(const shiftmatrix& V, const shiftmatrix& Vparam, cell
|
||||
ld rad = cgi.hexf * u / 250;
|
||||
color_t col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
||||
PRING(a)
|
||||
curvepoint(xspinpush0(a * M_PI / cgi.S42, rad));
|
||||
curvepoint(xspinpush0(a * cgi.S_step, rad));
|
||||
queuecurve(V, col, 0, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -453,7 +456,7 @@ EX void drawPlayerEffects(const shiftmatrix& V, const shiftmatrix& Vparam, cell
|
||||
void drawStunStars(const shiftmatrix& V, int t) {
|
||||
#if CAP_SHAPES
|
||||
for(int i=0; i<3*t; i++) {
|
||||
shiftmatrix V2 = V * spin(M_PI * 2 * i / (3*t) + ptick(200));
|
||||
shiftmatrix V2 = V * spin(TAU * i / (3*t) + ptick(200));
|
||||
#if MAXMDIM >= 4
|
||||
if(GDIM == 3) V2 = V2 * zpush(cgi.HEAD);
|
||||
#endif
|
||||
@ -519,7 +522,7 @@ EX namespace tortoise {
|
||||
if(d > 0) mcol = 0xFFFFFF;
|
||||
else if(d < 0) mcol = 0;
|
||||
|
||||
int dd = 0xFF * (atan(fabs(d)/2) / (M_PI/2));
|
||||
int dd = 0xFF * (atan(fabs(d)/2) / 90._deg);
|
||||
|
||||
return gradient(0x487830, mcol, 0, dd, 0xFF);
|
||||
}
|
||||
@ -754,7 +757,7 @@ EX shiftmatrix face_the_player(const shiftmatrix V) {
|
||||
if(vrhr::enabled) {
|
||||
shiftpoint h = tC0(V);
|
||||
hyperpoint uh = unshift(h);
|
||||
return shiftless(cspin(1, 2, 90*degree) * rspintox(cspin(2, 1, 90*degree) * uh) * xpush(hdist0(uh)) * cspin(0, 2, 90*degree) * cspin(1, 0, 90*degree));
|
||||
return shiftless(cspin90(1, 2) * rspintox(cspin90(2, 1) * uh) * xpush(hdist0(uh)) * cspin90(0, 2) * spin270());
|
||||
}
|
||||
#endif
|
||||
return rgpushxto0(tC0(V));
|
||||
@ -853,7 +856,7 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
|
||||
#if CAP_SHAPES
|
||||
auto sinptick = [c, pticks] (int period) { return c ? sintick(period) : sin(animation_factor * vid.ispeed * pticks / period);};
|
||||
auto spinptick = [c, pticks] (int period, ld phase) { return c ? spintick(period, phase) : spin((animation_factor * vid.ispeed * pticks) / period + phase * 2 * M_PI); };
|
||||
auto spinptick = [c, pticks] (int period, ld phase) { return c ? spintick(period, phase) : spin((animation_factor * vid.ispeed * pticks) / period + phase * TAU); };
|
||||
int ct6 = c ? ctof(c) : 1;
|
||||
hpcshape *xsh =
|
||||
(it == itPirate || it == itKraken) ? &cgi.shPirateX :
|
||||
@ -1005,16 +1008,14 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
|
||||
else if(it == itRose) {
|
||||
for(int u=0; u<4; u++)
|
||||
queuepoly(Vit * spinptick(1500, 0) * spin(2*M_PI / 3 / 4 * u), cgi.shRoseItem, darkena(icol, 0, hidden ? 0x30 : 0xA0));
|
||||
queuepoly(Vit * spinptick(1500, 0) * spin(30._deg * u), cgi.shRoseItem, darkena(icol, 0, hidden ? 0x30 : 0xA0));
|
||||
}
|
||||
|
||||
else if(it == itBarrow && c) {
|
||||
for(int i = 0; i<c->landparam; i++)
|
||||
queuepolyat(Vit * spin(2 * M_PI * i / c->landparam) * xpush(.15) * spinptick(1500, 0), *xsh, darkena(icol, 0, hidden ? 0x40 :
|
||||
queuepolyat(Vit * spin(TAU * i / c->landparam) * xpush(.15) * spinptick(1500, 0), *xsh, darkena(icol, 0, hidden ? 0x40 :
|
||||
(highwall(c) && wmspatial) ? 0x60 : 0xFF),
|
||||
PPR::HIDDEN);
|
||||
|
||||
// queuepoly(Vit*spin(M_PI+(1-2*ang)*2*M_PI/cgi.S84), cgi.shMagicSword, darkena(0xC00000, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
|
||||
}
|
||||
|
||||
else if(xsh) {
|
||||
@ -1072,12 +1073,12 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
auto dark = darkena(icol1, 0, inice ? 0x80 : hidden ? 0x20 : (it == itOrbBeauty) ? 0xA0 : 0xC0);
|
||||
auto dark1 = darkena(icol1, 0, inice ? 0x40 : hidden ? 0x10 : (it == itOrbBeauty) ? 0x50 : 0x60);
|
||||
if(c && GDIM == 2) Vit = rgpushxto0(tC0(Vit));
|
||||
auto Vit1 = Vit * spin(90 * degree);
|
||||
auto Vit1 = Vit * spin90();
|
||||
|
||||
if (it == itOrbBeauty) {
|
||||
queuepolyat(Vit, cgi.shDisk, dark1, prio);
|
||||
for(int u=0; u<3; u++)
|
||||
queuepolyat(Vit1 * spin(2*M_PI / 3 / 3 * u), cgi.shSmallRose, dark, prio);
|
||||
queuepolyat(Vit1 * spin(40._deg * u), cgi.shSmallRose, dark, prio);
|
||||
}
|
||||
else if (it == itOrbLife) {
|
||||
queuepolyat(Vit, cgi.shDisk, dark1, prio);
|
||||
@ -1113,7 +1114,7 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
queuepolyat(Vit, cgi.shDisk, dark1, prio);
|
||||
queuepolyat(Vit, cgi.shDiskM, dark, prio);
|
||||
for (int i=0; i<5; i++) {
|
||||
shiftmatrix V2 = Vit * spin(2*M_PI * i / 5 + ptick(300));
|
||||
shiftmatrix V2 = Vit * spin(TAU * i / 5 + ptick(300));
|
||||
queuepolyat(V2, cgi.shSmallFlailBall, dark, prio);
|
||||
}
|
||||
}
|
||||
@ -1189,7 +1190,7 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
bool reversed = (shape == &cgi.shTreeIcon || shape == &cgi.shHumanoid || it == itOrbSword2);
|
||||
bool left90 = (shape == &cgi.shLeafIcon || shape == &cgi.shLightningBolt);
|
||||
if (shape)
|
||||
queuepolyat(reversed ? Vit1 * MirrorX : left90 ? Vit1 * spin(-90*degree) : Vit1, *shape, (it == itOrbInvis || it == itOrbTeleport) ? 0x20 : 0x80, prio);
|
||||
queuepolyat(reversed ? Vit1 * MirrorX : left90 ? Vit1 * spin270() : Vit1, *shape, (it == itOrbInvis || it == itOrbTeleport) ? 0x20 : 0x80, prio);
|
||||
if (it == itOrbSide1 || (shape == &cgi.shEccentricDisk && it != itOrbDiscord))
|
||||
queuepolyat(Vit1*Mirror, *shape, 0x80, prio);
|
||||
if (jump || it == itOrbEnergy)
|
||||
@ -1381,7 +1382,7 @@ EX void drawPlayer(eMonster m, cell *where, const shiftmatrix& V, color_t col, d
|
||||
}
|
||||
|
||||
if(items[itOrbSide1] && !shmup::on)
|
||||
queuepoly(VBODY * VBS * spin(-M_PI/24), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, fc(314, cs.swordcolor, 3)); // 3 not colored
|
||||
queuepoly(VBODY * VBS * spin(-15._deg), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, fc(314, cs.swordcolor, 3)); // 3 not colored
|
||||
|
||||
shiftmatrix VWPN = cs.lefthanded ? VBODY * VBS * Mirror : VBODY * VBS;
|
||||
|
||||
@ -1451,7 +1452,7 @@ EX int wingphase(int period, int phase IS(0)) {
|
||||
}
|
||||
|
||||
transmatrix wingmatrix(int period, int phase = 0) {
|
||||
ld t = fractick(period, phase) * 2 * M_PI;
|
||||
ld t = fractick(period, phase) * TAU;
|
||||
transmatrix Vwing = Id;
|
||||
Vwing[1][1] = .85 + .15 * sin(t);
|
||||
return Vwing;
|
||||
@ -1508,7 +1509,7 @@ void drawMimic(eMonster m, cell *where, const shiftmatrix& V, color_t col, doubl
|
||||
if(items[itOrbThorns] && emp)
|
||||
queuepoly(VBODY * VBS, cgi.shHedgehogBladePlayer, darkena(col, 0, 0x40));
|
||||
if(items[itOrbSide1] && !shmup::on)
|
||||
queuepoly(VBODY * VBS * spin(-M_PI/24), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, darkena(col, 0, 0x40));
|
||||
queuepoly(VBODY * VBS * spin(-15._deg), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, darkena(col, 0, 0x40));
|
||||
if(items[itOrbSide3] && emp)
|
||||
queuepoly(VBODY * VBS, (cs.charid&1) ? cgi.shFerocityF : cgi.shFerocityM, darkena(col, 0, 0x40));
|
||||
|
||||
@ -1547,7 +1548,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
|
||||
char xch = minf[m].glyph;
|
||||
|
||||
shiftmatrix V = V1;
|
||||
if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where && !hybri) V = V1 * cspin(0, 2, M_PI/2);
|
||||
if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where && !hybri) V = V1 * cspin90(0, 2);
|
||||
|
||||
#if CAP_SHAPES
|
||||
if(among(m, moTortoise, moWorldTurtle) && where && where->stuntime >= 3)
|
||||
@ -1590,7 +1591,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
|
||||
|
||||
case moBullet:
|
||||
ShadowV(V, cgi.shKnife);
|
||||
queuepoly(VBODY * spin(-M_PI/4), cgi.shKnife, getcs().swordcolor);
|
||||
queuepoly(VBODY * spin270(), cgi.shKnife, getcs().swordcolor);
|
||||
return true;
|
||||
|
||||
case moKnight: case moKnightMoved: {
|
||||
@ -2109,7 +2110,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
|
||||
|
||||
case moJiangshi: {
|
||||
ShadowV(V, cgi.shJiangShi);
|
||||
auto z2 = WDIM == 3 ? 0 : GDIM == 3 ? -abs(sin(footphase * M_PI * 2)) * cgi.human_height/3 : geom3::lev_to_factor(abs(sin(footphase * M_PI * 2)) * cgi.human_height);
|
||||
auto z2 = WDIM == 3 ? 0 : GDIM == 3 ? -abs(sin(footphase * TAU)) * cgi.human_height/3 : geom3::lev_to_factor(abs(sin(footphase * TAU)) * cgi.human_height);
|
||||
auto V0 = V;
|
||||
auto V = mmscale(V0, z2);
|
||||
otherbodyparts(V, darkena(col, 0, 0xFF), m, m == moJiangshi ? 0 : footphase);
|
||||
@ -2328,7 +2329,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
|
||||
case moLancer: case moFlailer: case moMiner: {
|
||||
shiftmatrix V2 = V;
|
||||
if(m == moLancer)
|
||||
V2 = V * spin((where && where->type == 6) ? -M_PI/3 : -M_PI/2 );
|
||||
V2 = V * spin((where && where->type == 6) ? -60._deg : -90._deg );
|
||||
shiftmatrix Vh = mmscale(V2, cgi.HEAD);
|
||||
shiftmatrix Vb = mmscale(V2, cgi.BODY);
|
||||
Vb = Vb * otherbodyparts(V2, darkena(col, 1, 0xFF), m, footphase);
|
||||
@ -2512,7 +2513,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
|
||||
}
|
||||
else if(isMagneticPole(m)) {
|
||||
if(m == moNorthPole)
|
||||
queuepolyat(VBODY * spin(M_PI), cgi.shTentacle, 0x000000C0, PPR::TENTACLE1);
|
||||
queuepolyat(VBODY * spin180(), cgi.shTentacle, 0x000000C0, PPR::TENTACLE1);
|
||||
queuepolyat(VBODY, cgi.shDisk, darkena(col, 0, 0xFF), PPR::MONSTER_BODY);
|
||||
}
|
||||
else if(isMetalBeast(m) || m == moBrownBug) {
|
||||
@ -2660,7 +2661,6 @@ EX bool applyAnimation(cell *c, shiftmatrix& V, double& footphase, int layer) {
|
||||
V = V * a.wherenow;
|
||||
if(a.mirrored) V = V * Mirror;
|
||||
if(a.attacking == 2) V = V * pispin;
|
||||
// if(GDIM == 3) V = V * cspin(0, 2, M_PI/2);
|
||||
a.ltick = ticks;
|
||||
return true;
|
||||
}
|
||||
@ -2874,7 +2874,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
if(doHighlight())
|
||||
poly_outline = outline;
|
||||
shiftmatrix Vbx = Vb;
|
||||
if(WDIM == 2) Vbx = Vbx * spin(sin(M_PI * i / 6.) * wav / (i+.1));
|
||||
if(WDIM == 2) Vbx = Vbx * spin(sin(TAU * i / 12) * wav / (i+.1));
|
||||
Vbx = Vbx * xpush(length * (i) / 12.0);
|
||||
// shiftmatrix Vbx2 = Vnext * xpush(length2 * i / 6.0);
|
||||
// Vbx = Vbx * rspintox(inverse(Vbx) * Vbx2 * C0) * pispin;
|
||||
@ -2889,7 +2889,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
shiftmatrix T = Vparam * ddspin(c, c->mondir);
|
||||
color_t col = darkena(0x606020, 0, 0xFF);
|
||||
for(int u=-1; u<=1; u++)
|
||||
queueline(T*xspinpush0(M_PI/2, u*cgi.crossf/5), T*xspinpush(0, cgi.crossf)*xspinpush0(M_PI/2, u*cgi.crossf/5), col, 2 + vid.linequality);
|
||||
queueline(T*xspinpush0(90._deg, u*cgi.crossf/5), T*xspinpush(0, cgi.crossf)*xspinpush0(90._deg, u*cgi.crossf/5), col, 2 + vid.linequality);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2898,7 +2898,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
if(hybri) {
|
||||
queuepoly(Vb, cgi.shILeaf[ctof(c)], darkena(col, 0, 0xFF));
|
||||
for(int a=0; a<c->type-2; a++)
|
||||
queuepoly(Vb * spin(a * 2 * M_PI / (c->type-2)), cgi.shILeaf[2], darkena(col, 0, 0xFF));
|
||||
queuepoly(Vb * spin(a * TAU / (c->type-2)), cgi.shILeaf[2], darkena(col, 0, 0xFF));
|
||||
}
|
||||
else if(GDIM == 3) {
|
||||
queuepoly(face_the_player(Vb), cgi.shILeaf[1], darkena(col, 0, 0xFF));
|
||||
@ -2949,7 +2949,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
Vb = Vb * pispin;
|
||||
}
|
||||
else {
|
||||
Vb = Vb0 * ddspin(c, nd, M_PI);
|
||||
Vb = Vb0 * ddspin180(c, nd);
|
||||
}
|
||||
if(c->monmirror) Vb = Vb * Mirror;
|
||||
shiftmatrix Vbb = mmscale(Vb, cgi.ABODY);
|
||||
@ -2969,8 +2969,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
/* todo what if no spin_angle */
|
||||
ld hdir0 = currentmap->spin_angle(c, nd) + M_PI;
|
||||
ld hdir1 = currentmap->spin_angle(c, c->mondir);
|
||||
while(hdir1 > hdir0 + M_PI) hdir1 -= 2*M_PI;
|
||||
while(hdir1 < hdir0 - M_PI) hdir1 += 2*M_PI;
|
||||
cyclefix(hdir1, hdir0);
|
||||
Vb = Vb0 * spin((hdir0 + hdir1)/2 + M_PI);
|
||||
}
|
||||
if(c->monmirror) Vb = Vb * Mirror;
|
||||
@ -2999,7 +2998,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
Vb = Vb * pispin;
|
||||
}
|
||||
else {
|
||||
Vb = Vb0 * ddspin(c, nd, M_PI);
|
||||
Vb = Vb0 * ddspin180(c, nd);
|
||||
}
|
||||
if(c->monmirror) Vb = Vb * Mirror;
|
||||
shiftmatrix Vbb = mmscale(Vb, cgi.ABODY) * pispin;
|
||||
@ -3087,7 +3086,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
Vb = Vb * T * rspintox(tC0(iso_inverse(T))) * xpush(cgi.tentacle_length);
|
||||
}
|
||||
else {
|
||||
Vb = Vb * ddspin(c, c->mondir, M_PI);
|
||||
Vb = Vb * ddspin180(c, c->mondir);
|
||||
Vb = Vb * xpush(cgi.tentacle_length - cellgfxdist(c, c->mondir));
|
||||
}
|
||||
if(c->monmirror) Vb = Vb * Mirror;
|
||||
@ -3109,7 +3108,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
|
||||
else if((hasFacing(c) && c->mondir != NODIR) || history::on || quotient || dont_face_pc) {
|
||||
if(c->monst == moKrakenH) Vs = Vb, nospins = nospinb;
|
||||
if(!nospins && c->mondir < c->type) Vs = Vs * ddspin(c, c->mondir, M_PI);
|
||||
if(!nospins && c->mondir < c->type) Vs = Vs * ddspin180(c, c->mondir);
|
||||
if(c->monst == moPair) Vs = Vs * xpush(-.12);
|
||||
if(c->monmirror) Vs = Vs * Mirror;
|
||||
if(isFriendly(c)) drawPlayerEffects(Vs, Vparam, c, c->monst);
|
||||
@ -3141,7 +3140,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col
|
||||
// cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs));
|
||||
}
|
||||
if(c->monst == moHunterChanging)
|
||||
Vs = Vs * (hybri ? spin(M_PI) : cspin(WDIM-2, WDIM-1, M_PI));
|
||||
Vs = Vs * (hybri ? spin180() : cspin180(WDIM-2, WDIM-1));
|
||||
}
|
||||
if(c->monmirror) Vs = Vs * Mirror;
|
||||
|
||||
@ -3240,7 +3239,7 @@ void apply_joukowsky_aura(shiftpoint& h) {
|
||||
EX void addauraspecial(shiftpoint h, color_t col, int dir) {
|
||||
if(!haveaura_cached) return;
|
||||
apply_joukowsky_aura(h);
|
||||
int r = int(2*AURA + dir + atan2(h[1], h[0]) * AURA / 2 / M_PI) % AURA;
|
||||
int r = int(2*AURA + dir + atan2(h[1], h[0]) * AURA / TAU) % AURA;
|
||||
auraspecials.emplace_back(r, col);
|
||||
}
|
||||
|
||||
@ -3248,7 +3247,7 @@ EX void addaura(shiftpoint h, color_t col, int fd) {
|
||||
if(!haveaura_cached) return;
|
||||
apply_joukowsky_aura(h);
|
||||
|
||||
int r = gmod(atan2(h[1], h[0]) * AURA / 2 / M_PI, AURA);
|
||||
int r = gmod(atan2(h[1], h[0]) * AURA / TAU, AURA);
|
||||
aurac[r][3] += auramemo << fd;
|
||||
col = darkened(col);
|
||||
aurac[r][0] += (col>>16)&255;
|
||||
@ -3322,7 +3321,7 @@ EX void drawaura() {
|
||||
if(cmul>1) cmul=1;
|
||||
if(cmul<0) cmul=0;
|
||||
|
||||
ld alpha = AURA * atan2(hx,hy) / (2 * M_PI);
|
||||
ld alpha = AURA * atan2(hx,hy) / TAU;
|
||||
if(alpha<0) alpha += AURA;
|
||||
if(alpha >= AURA) alpha -= AURA;
|
||||
|
||||
@ -3363,7 +3362,7 @@ EX void drawaura() {
|
||||
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && pconf.model_transition < 1;
|
||||
|
||||
for(int r=0; r<=AURA; r++) for(int z=0; z<11; z++) {
|
||||
float rr = (M_PI * 2 * r) / AURA;
|
||||
float rr = (TAU * r) / AURA;
|
||||
float rad0 = inversion ? rad / facs[z] : rad * facs[z];
|
||||
int rm = r % AURA;
|
||||
ld c = cos(rr);
|
||||
@ -3467,14 +3466,14 @@ EX int countMinesAround(cell *c) {
|
||||
|
||||
EX transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) {
|
||||
if(NONSTDVAR || bt::in()) return Id;
|
||||
transmatrix V = ddspin(c, si.dir, M_PI);
|
||||
transmatrix V = ddspin180(c, si.dir);
|
||||
if(si.reflect) V = V * Mirror;
|
||||
if(euclid) return V;
|
||||
return V * iddspin(c, 0, M_PI);
|
||||
return V * iddspin180(c, 0);
|
||||
}
|
||||
|
||||
EX transmatrix applyDowndir(cell *c, const cellfunction& cf) {
|
||||
return ddspin(c, patterns::downdir(c, cf), M_PI);
|
||||
return ddspin180(c, patterns::downdir(c, cf));
|
||||
}
|
||||
|
||||
void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
|
||||
@ -3488,7 +3487,7 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
|
||||
|
||||
for(int d=0; d<8; d++) {
|
||||
|
||||
movedir md = vectodir(spin(-d * M_PI/4) * smalltangent());
|
||||
movedir md = vectodir(spin(-d * 45._deg) * smalltangent());
|
||||
cellwalker xc = cwt + md.d;
|
||||
if(xc.spin != df) continue;
|
||||
xc += wstep;
|
||||
@ -3504,7 +3503,7 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
|
||||
|
||||
if(vid.axes >= 5) keylist += key;
|
||||
else
|
||||
queuepoly(shiftless(fixrot * spin(-d * M_PI/4)), cgi.shArrow, col);
|
||||
queuepoly(shiftless(fixrot * spin(-d * 45._deg)), cgi.shArrow, col);
|
||||
|
||||
if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) {
|
||||
transmatrix Centered = rgpushxto0(unshift(tC0(cwtV)));
|
||||
@ -3552,7 +3551,7 @@ EX color_t reptilecolor(cell *c) {
|
||||
|
||||
ld wavefun(ld x) {
|
||||
return sin(x);
|
||||
/* x /= (2*M_PI);
|
||||
/* x /= TAU;
|
||||
x -= (int) x;
|
||||
if(x > .5) return (x-.5) * 2;
|
||||
else return 0; */
|
||||
@ -4490,7 +4489,7 @@ EX void drawDirectionalParticle(cell *c, int dir, color_t col, int maxspeed IS(1
|
||||
int speed = 1 + rand() % maxspeed;
|
||||
auto fd = flashdata(ticks, rand() % 16, c, col, speed);
|
||||
fd.angle = -atan2(tC0(currentmap->adj(c, dir)));
|
||||
fd.angle += 2 * M_PI * (rand() % 100 - rand() % 100) / 100 / c->type;
|
||||
fd.angle += TAU * (rand() % 100 - rand() % 100) / 100 / c->type;
|
||||
flashes.push_back(fd);
|
||||
}
|
||||
}
|
||||
@ -4914,7 +4913,7 @@ EX void draw_flash(struct flashdata& f, const shiftmatrix& V, bool& kill) {
|
||||
ld rad[25];
|
||||
for(int a=0; a<24; a++) rad[a] = (0.5 + randd() * .3 + 0.5 * (a&1)) / (2.8 + celldistance(f.where, cwt.at) * .2);
|
||||
rad[24] = rad[0];
|
||||
for(int a=0; a<24; a++) curvepoint(xspinpush0(15 * degree * a, rad[a]));
|
||||
for(int a=0; a<24; a++) curvepoint(xspinpush0(TAU * a / 24, rad[a]));
|
||||
queuecurve(V, 0xFF, 0xFF0000FF, PPR::SUPERLINE);
|
||||
}
|
||||
}
|
||||
@ -4948,7 +4947,7 @@ EX void draw_flash(struct flashdata& f, const shiftmatrix& V, bool& kill) {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
PRING(a) curvepoint(xspinpush0(a * M_PI / cgi.S42, rad));
|
||||
PRING(a) curvepoint(xspinpush0(a * cgi.S_step, rad));
|
||||
queuecurve(V, flashcol, 0x8080808, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -4969,7 +4968,7 @@ EX void draw_flash(struct flashdata& f, const shiftmatrix& V, bool& kill) {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
PRING(a) curvepoint(xspinpush0(a * M_PI / cgi.S42, rad));
|
||||
PRING(a) curvepoint(xspinpush0(a * cgi.S_step, rad));
|
||||
queuecurve(V, flashcol, 0x8080808, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -5387,7 +5386,7 @@ EX void drawmovestar(double dx, double dy) {
|
||||
if(rightclick && (d == 2 || d == 6 || d == 3 || d == 5)) col &= 0xFFFFFF3F;
|
||||
if(!leftclick && !rightclick && (d&1)) col &= 0xFFFFFF3F;
|
||||
#endif
|
||||
queueline(tC0(Centered), Centered * xspinpush0(d * M_PI / 4, cgi.scalefactor/2), col, 3 + vid.linequality);
|
||||
queueline(tC0(Centered), Centered * xspinpush0(d * 45._deg, cgi.scalefactor/2), col, 3 + vid.linequality);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -5877,7 +5876,7 @@ EX void restartGraph() {
|
||||
if(!autocheat) linepatterns::clearAll();
|
||||
if(currentmap) {
|
||||
resetview();
|
||||
if(sphere) View = spin(-M_PI/2);
|
||||
if(sphere) View = spin(-90._deg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6037,7 +6036,7 @@ EX void drawBug(const cellwalker& cw, color_t col) {
|
||||
#if CAP_SHAPES
|
||||
initquickqueue();
|
||||
shiftmatrix V = ggmatrix(cw.at);
|
||||
if(cw.spin) V = V * ddspin(cw.at, cw.spin, M_PI);
|
||||
if(cw.spin) V = V * ddspin180(cw.at, cw.spin);
|
||||
queuepoly(V, cgi.shBugBody, col);
|
||||
quickqueue();
|
||||
#endif
|
||||
|
@ -41,11 +41,11 @@ namespace spiral {
|
||||
SX = out->w;
|
||||
SY = out->h;
|
||||
|
||||
ld k = -2*M_PI*M_PI / log(2.6180339);
|
||||
ld prec = 2*M_PI*M_PI;
|
||||
|
||||
// cxld mnoznik = cxld(0, M_PI) / cxld(k, M_PI);
|
||||
ld k = -prec / log(2.6180339);
|
||||
|
||||
cxld factor = cxld(0, -CY/2/M_PI/M_PI) * cxld(k, M_PI);
|
||||
cxld factor = cxld(0, -CY/prec) * cxld(k, M_PI);
|
||||
|
||||
Yshift = CY * k / M_PI;
|
||||
|
||||
|
@ -13,11 +13,18 @@
|
||||
namespace hr {
|
||||
|
||||
#if HDR
|
||||
static const ld full_circle = 2 * M_PI;
|
||||
static const ld quarter_circle = M_PI / 2;
|
||||
static const ld degree = M_PI / 180;
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979
|
||||
#endif
|
||||
|
||||
static constexpr ld A_PI = M_PI;
|
||||
static const ld TAU = 2 * A_PI;
|
||||
static const ld degree = A_PI / 180;
|
||||
static const ld golden_phi = (sqrt(5)+1)/2;
|
||||
static const ld log_golden_phi = log(golden_phi);
|
||||
|
||||
constexpr ld operator"" _deg(long double deg) { return deg * A_PI / 180; }
|
||||
#endif
|
||||
|
||||
eGeometry geometry;
|
||||
@ -231,10 +238,6 @@ constexpr hyperpoint C03 = hyperpoint(0,0,0,1);
|
||||
// basic functions and types
|
||||
//===========================
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979
|
||||
#endif
|
||||
|
||||
EX ld squar(ld x) { return x*x; }
|
||||
|
||||
EX int sig(int z) { return ginf[geometry].g.sig[z]; }
|
||||
@ -284,7 +287,7 @@ EX ld acos_auto(ld x) {
|
||||
/** \brief volume of a three-dimensional ball of radius r in the current isotropic geometry */
|
||||
EX ld volume_auto(ld r) {
|
||||
switch(cgclass) {
|
||||
case gcEuclid: return 4 * r * r * r / 3 * M_PI;
|
||||
case gcEuclid: return r * r * r * 240._deg;
|
||||
case gcHyperbolic: return M_PI * (sinh(2*r) - 2 * r);
|
||||
case gcSphere: return M_PI * (2 * r - sin(2*r));
|
||||
default: return 0;
|
||||
@ -295,8 +298,8 @@ EX ld volume_auto(ld r) {
|
||||
EX ld area_auto(ld r) {
|
||||
switch(cgclass) {
|
||||
case gcEuclid: return r * r * M_PI;
|
||||
case gcHyperbolic: return 2 * M_PI * (cosh(r) - 1);
|
||||
case gcSphere: return 2 * M_PI * (1 - cos(r));
|
||||
case gcHyperbolic: return TAU * (cosh(r) - 1);
|
||||
case gcSphere: return TAU * (1 - cos(r));
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@ -307,7 +310,7 @@ EX ld wvolarea_auto(ld r) {
|
||||
else return area_auto(r);
|
||||
}
|
||||
|
||||
EX ld asin_clamp(ld x) { return x>1 ? M_PI/2 : x<-1 ? -M_PI/2 : std::isnan(x) ? 0 : asin(x); }
|
||||
EX ld asin_clamp(ld x) { return x>1 ? 90._deg : x<-1 ? -90._deg : std::isnan(x) ? 0 : asin(x); }
|
||||
|
||||
EX ld acos_clamp(ld x) { return x>1 ? 0 : x<-1 ? M_PI : std::isnan(x) ? 0 : acos(x); }
|
||||
|
||||
@ -589,18 +592,42 @@ EX transmatrix cspin(int a, int b, ld alpha) {
|
||||
return T;
|
||||
}
|
||||
|
||||
/** rotate by 90 degrees in the coordinates a, b */
|
||||
EX transmatrix cspin90(int a, int b) {
|
||||
transmatrix T = Id;
|
||||
T[a][a] = 0; T[a][b] = 1;
|
||||
T[b][a] = -1; T[b][b] = 0;
|
||||
return T;
|
||||
}
|
||||
|
||||
/** rotate by 180 degrees in the coordinates a, b */
|
||||
EX transmatrix cspin180(int a, int b) {
|
||||
transmatrix T = Id;
|
||||
T[a][a] = T[b][b] = -1;
|
||||
return T;
|
||||
}
|
||||
|
||||
/** rotate by alpha degrees in the XY plane */
|
||||
EX transmatrix spin(ld alpha) { return cspin(0, 1, alpha); }
|
||||
|
||||
/** rotate by 90 degrees in the XY plane */
|
||||
EX transmatrix spin90() { return cspin90(0, 1); }
|
||||
|
||||
/** rotate by 180 degrees in the XY plane */
|
||||
EX transmatrix spin180() { return cspin180(0, 1); }
|
||||
|
||||
/** rotate by 270 degrees in the XY plane */
|
||||
EX transmatrix spin270() { return cspin90(1, 0); }
|
||||
|
||||
EX transmatrix random_spin3() {
|
||||
ld alpha2 = asin(randd() * 2 - 1);
|
||||
ld alpha = randd() * 2 * M_PI;
|
||||
ld alpha3 = randd() * 2 * M_PI;
|
||||
ld alpha = randd() * TAU;
|
||||
ld alpha3 = randd() * TAU;
|
||||
return cspin(0, 1, alpha) * cspin(0, 2, alpha2) * cspin(1, 2, alpha3);
|
||||
}
|
||||
|
||||
EX transmatrix random_spin() {
|
||||
if(WDIM == 2) return spin(randd() * 2 * M_PI);
|
||||
if(WDIM == 2) return spin(randd() * TAU);
|
||||
else return random_spin3();
|
||||
}
|
||||
|
||||
@ -1181,13 +1208,13 @@ EX ld hdist0(const shiftpoint& mh) {
|
||||
EX ld circlelength(ld r) {
|
||||
switch(cgclass) {
|
||||
case gcEuclid:
|
||||
return 2 * M_PI * r;
|
||||
return TAU * r;
|
||||
case gcHyperbolic:
|
||||
return 2 * M_PI * sinh(r);
|
||||
return TAU * sinh(r);
|
||||
case gcSphere:
|
||||
return 2 * M_PI * sin(r);
|
||||
return TAU * sin(r);
|
||||
default:
|
||||
return 2 * M_PI * r;
|
||||
return TAU * r;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1378,12 +1405,12 @@ EX transmatrix spin_towards(const transmatrix Position, transmatrix& ori, const
|
||||
}
|
||||
T = rspintox(U);
|
||||
}
|
||||
if(back < 0) T = T * spin(M_PI), alpha = -alpha;
|
||||
if(back < 0) T = T * spin180(), alpha = -alpha;
|
||||
if(prod) {
|
||||
if(dir == 0) ori = cspin(2, 0, alpha);
|
||||
if(dir == 2) ori = cspin(2, 0, alpha - M_PI/2), dir = 0;
|
||||
if(dir == 2) ori = cspin(2, 0, alpha - 90._deg), dir = 0;
|
||||
}
|
||||
if(dir) T = T * cspin(dir, 0, -M_PI/2);
|
||||
if(dir) T = T * cspin(dir, 0, -90._deg);
|
||||
T = Position * T;
|
||||
return T;
|
||||
}
|
||||
@ -1536,7 +1563,7 @@ EX ld geo_dist(const shiftpoint h1, const shiftpoint h2, flagtype prec IS(pNORMA
|
||||
|
||||
EX ld geo_dist_q(const hyperpoint h1, const hyperpoint h2, flagtype prec IS(pNORMAL)) {
|
||||
auto d = geo_dist(h1, h2, prec);
|
||||
if(elliptic && d > M_PI/2) return M_PI - d;
|
||||
if(elliptic && d > 90._deg) return M_PI - d;
|
||||
return d;
|
||||
}
|
||||
|
||||
@ -1551,15 +1578,15 @@ EX hyperpoint lp_apply(const hyperpoint h) {
|
||||
EX hyperpoint smalltangent() { return xtangent(.1); }
|
||||
|
||||
EX void cyclefix(ld& a, ld b) {
|
||||
while(a > b + M_PI) a -= 2 * M_PI;
|
||||
while(a < b - M_PI) a += 2 * M_PI;
|
||||
while(a > b + M_PI) a -= TAU;
|
||||
while(a < b - M_PI) a += TAU;
|
||||
}
|
||||
|
||||
EX ld raddif(ld a, ld b) {
|
||||
ld d = a-b;
|
||||
if(d < 0) d = -d;
|
||||
if(d > 2*M_PI) d -= 2*M_PI;
|
||||
if(d > M_PI) d = 2 * M_PI-d;
|
||||
if(d > TAU) d -= TAU;
|
||||
if(d > M_PI) d = TAU-d;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
95
hypgraph.cpp
95
hypgraph.cpp
@ -105,13 +105,13 @@ EX shiftmatrix minimize_point_value(shiftmatrix T, function<ld(const shiftmatrix
|
||||
ld dist = value(T1);
|
||||
if(dist < best) best = dist, T = T1;
|
||||
if(mdBandAny()) {
|
||||
T1.shift += 2 * M_PI;
|
||||
T1.shift += TAU;
|
||||
dist = value(T1);
|
||||
if(dist < best) best = dist, T = T1;
|
||||
T1.shift -= 4 * M_PI;
|
||||
T1.shift -= 720._deg;
|
||||
dist = value(T1);
|
||||
if(dist < best) best = dist, T = T1;
|
||||
T1.shift += 2 * M_PI;
|
||||
T1.shift += TAU;
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,14 +306,14 @@ void make_twopoint(ld& x, ld& y) {
|
||||
if(sphere) {
|
||||
int tss = twopoint_sphere_flips;
|
||||
if(tss&1) { tss--;
|
||||
dleft = 2*M_PI - 2*p - dleft;
|
||||
dright = 2*M_PI - 2*p - dright;
|
||||
dleft = TAU - 2*p - dleft;
|
||||
dright = TAU - 2*p - dright;
|
||||
swap(dleft, dright);
|
||||
y = -y;
|
||||
}
|
||||
while(tss) { tss -= 2;
|
||||
dleft = 2*M_PI - 4*p + dleft;
|
||||
dright = 2*M_PI - 4*p + dright;
|
||||
dleft = TAU - 4*p + dleft;
|
||||
dright = TAU - 4*p + dright;
|
||||
}
|
||||
}
|
||||
x = (dright*dright-dleft*dleft) / 4 / p;
|
||||
@ -453,7 +453,7 @@ EX void threepoint_projection(const hyperpoint& H, hyperpoint& ret) {
|
||||
|
||||
ld dist[3];
|
||||
for(int i=0; i<3; i++) {
|
||||
hyperpoint h1 = xspinpush0(2*M_PI*i/3, p);
|
||||
hyperpoint h1 = xspinpush0(TAU*i/3, p);
|
||||
dist[i] = geo_dist(h1, H1);
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ EX void threepoint_projection(const hyperpoint& H, hyperpoint& ret) {
|
||||
transmatrix T = Id;
|
||||
hyperpoint v = C0;
|
||||
for(int i=0; i<3; i++) {
|
||||
hyperpoint pp = xspinpush0(2*M_PI*i/3, p);
|
||||
hyperpoint pp = xspinpush0(TAU*i/3, p);
|
||||
v[i] = dist[i]*dist[i] - p*p;
|
||||
T[i][0] = -2 * pp[0];
|
||||
T[i][1] = -2 * pp[1];
|
||||
@ -1105,8 +1105,8 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
ret[2] = 0;
|
||||
|
||||
ret[0] -= pow(0.5, 1-mt);
|
||||
ret[0] /= -(1-mt) * M_PI / 2;
|
||||
ret[1] /= (1-mt) * M_PI / 2;
|
||||
ret[0] /= -(1-mt) * 90._deg;
|
||||
ret[1] /= (1-mt) * 90._deg;
|
||||
|
||||
models::apply_orientation(ret[1], ret[0]);
|
||||
}
|
||||
@ -1153,17 +1153,17 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
ld theta =
|
||||
hyperbolic ? min(y / 2 + 0.572365, y * 0.78509) :
|
||||
euclid ? y :
|
||||
y > 0 ? max(y * 0.012/0.015, M_PI/2 - (M_PI/2-y) * 0.066262/0.015708) :
|
||||
min(y * 0.012/0.015, -M_PI/2 + (M_PI/2+y) * 0.066262/0.015708);
|
||||
y > 0 ? max(y * 0.012/0.015, 90._deg - (90._deg-y) * 0.066262/0.015708) :
|
||||
min(y * 0.012/0.015, -90._deg + (90._deg+y) * 0.066262/0.015708);
|
||||
|
||||
if(sphere && abs(theta) >= M_PI/2 - 1e-6) ;
|
||||
if(sphere && abs(theta) >= 90._deg - 1e-6) ;
|
||||
else {
|
||||
for(int it=0; it<4; it++) {
|
||||
auto a = (sin_auto(2*theta) +2*theta - M_PI * sin_auto(y));
|
||||
auto b = (2 + 2 * cos_auto(2*theta));
|
||||
theta = theta - a / b;
|
||||
} }
|
||||
y = M_PI * sin_auto(theta) / 2;
|
||||
y = 90._deg * sin_auto(theta);
|
||||
x = x * cos_auto(theta);
|
||||
});
|
||||
break;
|
||||
@ -1192,7 +1192,7 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
ld d0 = hypot(x0, z0);
|
||||
|
||||
if(md == mdAitoff || md == mdWinkelTripel) ;
|
||||
else if(sphere) d = sqrt(2*(1 - cos(d))) * M_PI / 2;
|
||||
else if(sphere) d = sqrt(2*(1 - cos(d))) * 90._deg;
|
||||
else d = sqrt(2*(cosh(d) - 1)) / 1.5;
|
||||
|
||||
x = x0 * d / d0 / pconf.aitoff_parameter, y = z0 * d / d0;
|
||||
@ -1270,13 +1270,10 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
ld df, zf;
|
||||
hypot_zlev(zlev, d, df, zf);
|
||||
|
||||
// 4 pi / 2pi = M_PI
|
||||
|
||||
if(md == mdEquivolume)
|
||||
d = pow(volume_auto(d), 1/3.) * pow(M_PI / 2, 1/3.);
|
||||
d = pow(volume_auto(d), 1/3.) * pow(90._deg, 1/3.);
|
||||
else if(md == mdEquiarea && sphere) {
|
||||
d = sqrt(2*(1 - cos(d))) * M_PI / 2;
|
||||
//d = sin((d+90*degree)/2);
|
||||
d = sqrt(2*(1 - cos(d))) * 90._deg;
|
||||
}
|
||||
else if(pmodel == mdEquiarea && hyperbolic)
|
||||
d = sqrt(2*(cosh(d) - 1)) / 1.5;
|
||||
@ -1572,7 +1569,7 @@ EX transmatrix actualV(const heptspin& hs, const transmatrix& V) {
|
||||
if(WDIM == 3) return V;
|
||||
#if CAP_IRR
|
||||
if(IRREGULAR)
|
||||
return V * spin(M_PI + 2 * M_PI / S7 * (hs.spin + irr::periodmap[hs.at].base.spin));
|
||||
return V * spin(M_PI + TAU / S7 * (hs.spin + irr::periodmap[hs.at].base.spin));
|
||||
#endif
|
||||
#if CAP_ARCM
|
||||
if(arcm::in()) return V * spin(-arcm::current.triangles[arcm::id_of(hs.at)][hs.spin].first);
|
||||
@ -1581,7 +1578,7 @@ EX transmatrix actualV(const heptspin& hs, const transmatrix& V) {
|
||||
if(bt::in()) return V;
|
||||
#endif
|
||||
if(kite::in()) return V;
|
||||
return (hs.spin || !BITRUNCATED) ? V * spin(hs.spin*2*M_PI/hs.at->type + master_to_c7_angle()) : V;
|
||||
return (hs.spin || !BITRUNCATED) ? V * spin(hs.spin*TAU/hs.at->type + master_to_c7_angle()) : V;
|
||||
}
|
||||
|
||||
EX shiftmatrix actualV(const heptspin& hs, const shiftmatrix& V) {
|
||||
@ -1800,14 +1797,14 @@ void hrmap::draw_all() {
|
||||
int qty = ceil(1. / pconf.sphere_spiral_multiplier);
|
||||
if(qty > 100) qty = 100;
|
||||
for(int i=-qty; i < qty; i++)
|
||||
draw_at(centerover, cview(2 * M_PI * i));
|
||||
draw_at(centerover, cview(TAU * i));
|
||||
}
|
||||
else {
|
||||
draw_at(centerover, cview());
|
||||
if(vid.use_smart_range) for(int i=1;; i++) {
|
||||
int drawn = cells_drawn;
|
||||
draw_at(centerover, cview(2 * M_PI * i));
|
||||
draw_at(centerover, cview(-2 * M_PI * i));
|
||||
draw_at(centerover, cview(TAU * i));
|
||||
draw_at(centerover, cview(-TAU * i));
|
||||
if(drawn == cells_drawn) break;
|
||||
}
|
||||
}
|
||||
@ -1879,7 +1876,7 @@ void hrmap_standard::draw_at(cell *at, const shiftmatrix& where) {
|
||||
shiftmatrix Vd;
|
||||
if(inforder::mixed()) {
|
||||
int d1 = gmod(hs.spin+d, c->type);
|
||||
Vd = V * spin(-2*M_PI*d/c->type) * xpush(spacedist(c, d1)) * spin(M_PI);
|
||||
Vd = V * spin(-TAU*d/c->type) * xpush(spacedist(c, d1)) * spin180();
|
||||
}
|
||||
else
|
||||
Vd = V * cgi.heptmove[d];
|
||||
@ -1925,7 +1922,7 @@ EX void spinEdge(ld aspd) {
|
||||
|
||||
int dir = down_is_forward ? 0 : 1;
|
||||
|
||||
V = cspin(2, dir, 90 * degree) * V;
|
||||
V = cspin90(2, dir) * V;
|
||||
|
||||
if(1) {
|
||||
dynamicval<eGeometry> g(geometry, gSphere);
|
||||
@ -1942,7 +1939,7 @@ EX void spinEdge(ld aspd) {
|
||||
|
||||
vrhr::be_33(V);
|
||||
|
||||
V = cspin(dir, 2, 90 * degree) * V;
|
||||
V = cspin90(dir, 2) * V;
|
||||
V = inverse(T) * V;
|
||||
if(!prod) V = V * gpushxto0(h);
|
||||
get_view_orientation() = V;
|
||||
@ -2038,7 +2035,7 @@ EX void centerpc(ld aspd) {
|
||||
else
|
||||
View = iso_inverse(T);
|
||||
if(prod) NLP = ortho_inverse(pc->ori);
|
||||
if(WDIM == 2) rotate_view( cspin(0, 1, M_PI) * cspin(2, 1, M_PI/2 + shmup::playerturny[id]) * spin(-M_PI/2) );
|
||||
if(WDIM == 2) rotate_view( cspin180(0, 1) * cspin(2, 1, 90._deg + shmup::playerturny[id]) * spin270() );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -2160,7 +2157,7 @@ void addball(ld a, ld b, ld c) {
|
||||
void ballgeometry() {
|
||||
queuereset(mdPixel, PPR::CIRCLE);
|
||||
for(int i=0; i<60; i++)
|
||||
addball(i * M_PI/30, 10, 0);
|
||||
addball(TAU * i / 60, 10, 0);
|
||||
for(double d=10; d>=-10; d-=.2)
|
||||
addball(0, d, 0);
|
||||
for(double d=-10; d<=10; d+=.2)
|
||||
@ -2198,15 +2195,15 @@ EX void resetview() {
|
||||
}
|
||||
|
||||
if(GDIM == 2) View = spin(M_PI + vid.fixed_facing_dir * degree) * View;
|
||||
if(GDIM == 3 && !prod) View = cspin(0, 2, M_PI/2) * View;
|
||||
if(prod) NLP = cspin(0, 2, M_PI/2);
|
||||
if(GDIM == 3 && !prod) View = cspin90(0, 2) * View;
|
||||
if(prod) NLP = cspin90(0, 2);
|
||||
if(cheater && eqmatrix(View, lView) && !centering) {
|
||||
View = Id;
|
||||
static ld cyc = 0;
|
||||
cyc += 90 * degree;
|
||||
cyc += 90._deg;
|
||||
View = spin(cyc) * View;
|
||||
if(GDIM == 2) View = spin(M_PI + vid.fixed_facing_dir * degree) * View;
|
||||
if(GDIM == 3 && !prod) View = cspin(0, 2, M_PI/2) * View;
|
||||
if(GDIM == 3 && !prod) View = cspin90(0, 2) * View;
|
||||
}
|
||||
}
|
||||
else if(currentmap) {
|
||||
@ -2435,7 +2432,7 @@ EX void draw_model_elements() {
|
||||
case mdThreePoint: {
|
||||
vid.linewidth *= 5;
|
||||
for(int i=0; i<=3; i++) {
|
||||
hyperpoint h = xspinpush0(2*M_PI*i/3, pconf.twopoint_param);
|
||||
hyperpoint h = xspinpush0(120._deg*i, pconf.twopoint_param);
|
||||
models::apply_orientation(h[1], h[0]);
|
||||
models::apply_orientation_yz(h[2], h[1]);
|
||||
curvepoint(h);
|
||||
@ -2519,11 +2516,11 @@ void queuestraight(hyperpoint X, int style, color_t lc, color_t fc, PPR p) {
|
||||
ld mul1 = hypot(vid.xres, vid.yres) / hypot_d(2, H1);
|
||||
|
||||
queuereset(mdPixel, p);
|
||||
curvepoint(H0 + spin(M_PI/2) * H0 * mul0);
|
||||
curvepoint(H0 - spin(M_PI/2) * H0 * mul0);
|
||||
curvepoint(H1 + spin(M_PI/2) * H1 * mul1);
|
||||
curvepoint(H1 - spin(M_PI/2) * H1 * mul1);
|
||||
curvepoint(H0 + spin(M_PI/2) * H0 * mul0);
|
||||
curvepoint(H0 + spin90() * H0 * mul0);
|
||||
curvepoint(H0 - spin90() * H0 * mul0);
|
||||
curvepoint(H1 + spin90() * H1 * mul1);
|
||||
curvepoint(H1 - spin90() * H1 * mul1);
|
||||
curvepoint(H0 + spin90() * H0 * mul0);
|
||||
|
||||
queuecurve(shiftless(Id), lc, fc, p).flags |= POLY_ALWAYS_IN | POLY_FORCEWIDE;
|
||||
queuereset(pmodel, p);
|
||||
@ -2562,7 +2559,7 @@ EX void draw_boundary(int w) {
|
||||
#endif
|
||||
|
||||
if(elliptic && !among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdMollweide, mdCollignon))
|
||||
circle_around_center(M_PI/2, periodcolor, 0, PPR::CIRCLE);
|
||||
circle_around_center(90._deg, periodcolor, 0, PPR::CIRCLE);
|
||||
|
||||
int broken_coord = models::get_broken_coord(pmodel);
|
||||
if(broken_coord) {
|
||||
@ -2617,7 +2614,7 @@ EX void draw_boundary(int w) {
|
||||
if(pmodel == mdBand && pconf.model_transition != 1) return;
|
||||
bool bndband = (among(pmodel, mdBand, mdMiller, mdGallStereographic, mdCentralCyl) ? hyperbolic : sphere);
|
||||
transmatrix T = spin(-pconf.model_orientation * degree);
|
||||
ld right = M_PI/2 - 1e-5;
|
||||
ld right = 90._deg - 1e-5;
|
||||
if(bndband)
|
||||
queuestraight(T * ypush0(hyperbolic ? 10 : right), 2, lc, fc, p);
|
||||
ld xperiod = elliptic ? fakeinf/2 : fakeinf;
|
||||
@ -2640,7 +2637,7 @@ EX void draw_boundary(int w) {
|
||||
|
||||
case mdHalfplane:
|
||||
if(hyperbolic && GDIM == 2) {
|
||||
queuestraight(xspinpush0(-pconf.model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
|
||||
queuestraight(xspinpush0(-pconf.model_orientation * degree - 90._deg, fakeinf), 1, lc, fc, p);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -2708,13 +2705,13 @@ EX void draw_boundary(int w) {
|
||||
ld alpha = M_PI - atan2(a[0], -a[1]);
|
||||
|
||||
for(ld t=-1; t<=1; t += step)
|
||||
curvepoint(xspinpush0(-M_PI/2 - t * alpha, mz));
|
||||
curvepoint(xspinpush0(-90._deg - t * alpha, mz));
|
||||
}
|
||||
else {
|
||||
ld alpha = - atan2(a[0], -a[1]);
|
||||
|
||||
for(ld t=-1; t<=1; t += step)
|
||||
curvepoint(xspinpush0(+M_PI/2 - t * alpha, mz));
|
||||
curvepoint(xspinpush0(+90._deg - t * alpha, mz));
|
||||
}
|
||||
|
||||
queuecurve(shiftless(Id), lc, fc, p);
|
||||
@ -3100,7 +3097,7 @@ EX hyperpoint lie_exp(hyperpoint h) {
|
||||
EX hyperpoint rel_log(shiftpoint h) {
|
||||
if(sl2) {
|
||||
optimize_shift(h);
|
||||
ld cycles = floor(h.shift / (2*M_PI) + .5);
|
||||
ld cycles = floor(h.shift / TAU + .5);
|
||||
hyperpoint h1 = unshift(h);
|
||||
ld choice = h1[2] * h1[2] - h1[0] * h1[0] - h1[1] * h1[1];
|
||||
ld r, z;
|
||||
@ -3108,7 +3105,7 @@ EX hyperpoint rel_log(shiftpoint h) {
|
||||
ld r = sqrt(choice);
|
||||
ld z = asin_clamp(r);
|
||||
if(h1[3] < 0) z = M_PI - z;
|
||||
z += cycles * 2 * M_PI;
|
||||
z += cycles * TAU;
|
||||
}
|
||||
else if(cycles || h1[3] < -1 || choice == 0) {
|
||||
/* impossible, or light-like */
|
||||
@ -3238,7 +3235,7 @@ EX void shift_view_towards(shiftpoint H, ld l) {
|
||||
EX void set_view(hyperpoint camera, hyperpoint forward, hyperpoint upward) {
|
||||
if(GDIM == 2) {
|
||||
View = gpushxto0(camera);
|
||||
View = spin(90*degree) * spintox(View * upward) * View;
|
||||
View = spin90() * spintox(View * upward) * View;
|
||||
return;
|
||||
}
|
||||
|
||||
|
16
intra.cpp
16
intra.cpp
@ -187,8 +187,8 @@ EX portal_data make_portal(cellwalker cw, int spin) {
|
||||
for(auto p: fac) id.v0 += p;
|
||||
id.v0 = normalize_flat(id.v0);
|
||||
hyperpoint h = normalize_flat(fac[0]);
|
||||
id.T = cspin(0, 1, -90*degree) * spintox(gpushxto0(id.v0) * h) * gpushxto0(id.v0);
|
||||
if((id.T * C0)[0] > 0) id.T = cspin(0, 1, 180*degree) * id.T;
|
||||
id.T = cspin90(1, 0) * spintox(gpushxto0(id.v0) * h) * gpushxto0(id.v0);
|
||||
if((id.T * C0)[0] > 0) id.T = spin180() * id.T;
|
||||
for(int i=0; i<3; i++) id.T[3][i] = id.T[i][3] = i==3;
|
||||
if(debug_portal & 128)
|
||||
for(int a=0; a<4; a++) {
|
||||
@ -233,13 +233,13 @@ EX portal_data make_portal(cellwalker cw, int spin) {
|
||||
id.T = gpushxto0(id.v0);
|
||||
for(auto p: fac1) {
|
||||
if(abs((id.T * p)[2]) > 1e-3 && abs((id.T * p)[0]) < 1e-3)
|
||||
id.T = cspin(2, 0, 90*degree) * id.T;
|
||||
id.T = cspin90(2, 0) * id.T;
|
||||
if(abs((id.T * p)[2]) > 1e-3 && abs((id.T * p)[1]) < 1e-3)
|
||||
id.T = cspin(2, 1, 90*degree) * id.T;
|
||||
id.T = cspin90(2, 1) * id.T;
|
||||
}
|
||||
if((id.T * C03)[2] > 0) id.T = cspin(2, 0, 180*degree) * id.T;
|
||||
if(abs((id.T * removed)[0]) > 1e-2) id.T = cspin(0, 1, 90*degree) * id.T;
|
||||
if((id.T * removed)[1] < -1e-2) id.T = cspin(0, 1, 180*degree) * id.T;
|
||||
if((id.T * C03)[2] > 0) id.T = cspin180(2, 0) * id.T;
|
||||
if(abs((id.T * removed)[0]) > 1e-2) id.T = cspin90(0, 1) * id.T;
|
||||
if((id.T * removed)[1] < -1e-2) id.T = cspin180(0, 1) * id.T;
|
||||
vector<hyperpoint> v;
|
||||
geometry = gg;
|
||||
for(auto f: fac) v.push_back(id.to_poco(f));
|
||||
@ -254,7 +254,7 @@ EX portal_data make_portal(cellwalker cw, int spin) {
|
||||
else {
|
||||
id.kind = 0;
|
||||
id.v0 = project_on_triangle(fac[0], fac[1], fac[2]);
|
||||
id.T = cpush(2, -hdist0(id.v0)) * cspin(2, 0, 90*degree) * spintox(id.v0);
|
||||
id.T = cpush(2, -hdist0(id.v0)) * cspin90(2, 0) * spintox(id.v0);
|
||||
hyperpoint ctr = Hypc;
|
||||
for(auto p: fac) ctr += id.T*p;
|
||||
ctr = normalize(ctr);
|
||||
|
@ -460,7 +460,7 @@ bool step(int delta) {
|
||||
ld dist = cgi.hcrossf / 2;
|
||||
ld dists[8];
|
||||
for(int i=0; i<S7; i++) {
|
||||
dists[i] = hdist(s.p, xspinpush0(cgi.hexshift - i * 2 * M_PI / S7, -cgi.hcrossf));
|
||||
dists[i] = hdist(s.p, xspinpush0(cgi.hexshift - i * TAU / S7, -cgi.hcrossf));
|
||||
if(dists[i] < dist)
|
||||
d = i, dist = dists[i];
|
||||
}
|
||||
|
16
kite.cpp
16
kite.cpp
@ -53,8 +53,8 @@ hyperpoint mhpxy(ld x, ld y) {
|
||||
const ld phi = golden_phi;
|
||||
const ld rphi = 1 / phi;
|
||||
|
||||
const ld down = 1 / tan(36 * degree);
|
||||
const ld up = 1 / tan(72 * degree);
|
||||
const ld down = 1 / tan(36._deg);
|
||||
const ld up = 1 / tan(72._deg);
|
||||
|
||||
const ld dart_center = (down + 2 * up) / 3;
|
||||
const ld kite_center = up;
|
||||
@ -82,8 +82,8 @@ EX pair<vector<vector<hyperpoint>>, vector<vector<ld>>> make_walls() {
|
||||
hyperpoint dtop = meupush( 0, shf+t*up) * meuscale(rphi) * C0;
|
||||
hyperpoint dbottom = meupush( 0, shf-down) * meuscale(rphi) * C0;
|
||||
|
||||
hyperpoint dleftmid = (!kite) ? meupush(0, shf-down) * meuscale(rphi) * meupush(-1, down) * C0 : meupush(0, shf-down) * meuscale(rphi) * mspin(-36 * degree) * meupush(0, down - up) * C0;
|
||||
hyperpoint drightmid = (!kite) ? meupush(0, shf-down) * meuscale(rphi) * meupush(1, down) * C0 : meupush(0, shf-down) * meuscale(rphi) * mspin(36 * degree) * meupush(0, down - up) * C0;
|
||||
hyperpoint dleftmid = (!kite) ? meupush(0, shf-down) * meuscale(rphi) * meupush(-1, down) * C0 : meupush(0, shf-down) * meuscale(rphi) * mspin(-36._deg) * meupush(0, down - up) * C0;
|
||||
hyperpoint drightmid = (!kite) ? meupush(0, shf-down) * meuscale(rphi) * meupush(1, down) * C0 : meupush(0, shf-down) * meuscale(rphi) * mspin(36._deg) * meupush(0, down - up) * C0;
|
||||
|
||||
hyperpoint dcenter = meupush( 0, shf-up) * meuscale(rphi) * C0;
|
||||
|
||||
@ -247,12 +247,12 @@ struct hrmap_kite : hrmap {
|
||||
}
|
||||
|
||||
void make_graphrules() {
|
||||
pKite1 = meupush(-1, kite_center + 0) * mspin(108 * degree) * meuscale(rphi) * meupush(0, down - kite_center);
|
||||
pKite2 = meupush(1, kite_center + 0) * mspin(-108 * degree) * meuscale(rphi) * meupush(0, down - kite_center);
|
||||
pKite3 = meupush(0, kite_center - down) * mspin(36 * degree) * meuscale(rphi) * meupush(0, down - dart_center);
|
||||
pKite1 = meupush(-1, kite_center + 0) * mspin(108._deg) * meuscale(rphi) * meupush(0, down - kite_center);
|
||||
pKite2 = meupush(1, kite_center + 0) * mspin(-108._deg) * meuscale(rphi) * meupush(0, down - kite_center);
|
||||
pKite3 = meupush(0, kite_center - down) * mspin(36._deg) * meuscale(rphi) * meupush(0, down - dart_center);
|
||||
|
||||
pDart1 = meupush(0, dart_center-down) * meuscale(rphi) * meupush(0, down - kite_center);
|
||||
pDart2 = meupush(-1, dart_center+0) * mspin((54 + 90) * degree) * meuscale(rphi) * meupush(0, down - dart_center);
|
||||
pDart2 = meupush(-1, dart_center+0) * mspin(144._deg) * meuscale(rphi) * meupush(0, down - dart_center);
|
||||
|
||||
ipKite1 = inverse(pKite1);
|
||||
ipKite2 = inverse(pKite2);
|
||||
|
@ -89,7 +89,7 @@ EX namespace mapeditor {
|
||||
int ll = ceil(360 * len);
|
||||
shiftmatrix W = V * rgpushxto0(s);
|
||||
for(int i=0; i<=ll; i++)
|
||||
curvepoint(xspinpush0(360*degree*i/ll, radius));
|
||||
curvepoint(xspinpush0(TAU*i/ll, radius));
|
||||
queuecurve(W, col, fill, PPR::LINE);
|
||||
}
|
||||
|
||||
@ -1979,18 +1979,18 @@ EX namespace mapeditor {
|
||||
}
|
||||
transmatrix T;
|
||||
if(front_config == eFront::equidistants) T = Id;
|
||||
else if(front_config == eFront::const_x) T = cspin(2, 0, M_PI/2);
|
||||
else if(front_config == eFront::const_y) T = cspin(2, 1, M_PI/2);
|
||||
else if(front_config == eFront::const_x) T = cspin90(2, 0);
|
||||
else if(front_config == eFront::const_y) T = cspin90(2, 1);
|
||||
else return;
|
||||
for(int i=0; i<4; i+=2) {
|
||||
for(int u=2; u<=20; u++) {
|
||||
PRING(d) {
|
||||
curvepoint(T * xspinpush(M_PI*d/cgi.S42, u/20.) * zpush0(front_edit));
|
||||
curvepoint(T * xspinpush(d*cgi.S_step, u/20.) * zpush0(front_edit));
|
||||
}
|
||||
queuecurve(d2, cols[i + (u%5 != 0)], 0, i < 2 ? PPR::LINE : PPR::SUPERLINE);
|
||||
}
|
||||
for(int d=0; d<cgi.S84; d++) {
|
||||
for(int u=0; u<=20; u++) curvepoint(T * xspinpush(M_PI*d/cgi.S42, u/20.) * zpush(front_edit) * C0);
|
||||
for(int u=0; u<=20; u++) curvepoint(T * xspinpush(d*cgi.S_step, u/20.) * zpush(front_edit) * C0);
|
||||
queuecurve(d2, cols[i + (d % (cgi.S84/drawcell->type) != 0)], 0, i < 2 ? PPR::LINE : PPR::SUPERLINE);
|
||||
}
|
||||
}
|
||||
@ -1999,11 +1999,11 @@ EX namespace mapeditor {
|
||||
|
||||
for(int d=0; d<cgi.S84; d++) {
|
||||
unsigned col = (d % (cgi.S84/drawcell->type) == 0) ? gridcolor : lightgrid;
|
||||
queueline(d2 * C0, d2 * xspinpush0(M_PI*d/cgi.S42, 1), col, 4 + vid.linequality);
|
||||
queueline(d2 * C0, d2 * xspinpush0(d*cgi.S_step, 1), col, 4 + vid.linequality);
|
||||
}
|
||||
for(int u=2; u<=20; u++) {
|
||||
PRING(d) {
|
||||
curvepoint(xspinpush0(M_PI*d/cgi.S42, u/20.));
|
||||
curvepoint(xspinpush0(d*cgi.S_step, u/20.));
|
||||
}
|
||||
queuecurve(d2, (u%5==0) ? gridcolor : lightgrid, 0, PPR::LINE);
|
||||
}
|
||||
@ -2057,8 +2057,7 @@ EX namespace mapeditor {
|
||||
// total: rh2 - rh1
|
||||
// ld z = degree;
|
||||
ld x = b2 - b1 + M_PI;
|
||||
while(x > M_PI) x -= 2 * M_PI;
|
||||
while(x < -M_PI) x += 2 * M_PI;
|
||||
cyclefix(x, 0);
|
||||
area += x;
|
||||
}
|
||||
}
|
||||
@ -2440,7 +2439,7 @@ EX namespace mapeditor {
|
||||
}
|
||||
|
||||
if(uni == 'a' && haveshape) {
|
||||
mh = spin(2*M_PI*-ew.rotid/dsCur->rots) * mh;
|
||||
mh = spin(TAU*-ew.rotid/dsCur->rots) * mh;
|
||||
if(ew.symid) mh = Mirror * mh;
|
||||
|
||||
if(ew.pointid < 0 || ew.pointid >= isize(dsCur->list))
|
||||
@ -2462,7 +2461,7 @@ EX namespace mapeditor {
|
||||
|
||||
if(i < 0 || i >= isize(dsCur->list)) return;
|
||||
|
||||
mh = spin(2*M_PI*-ew.rotid/dsCur->rots) * mh;
|
||||
mh = spin(TAU*-ew.rotid/dsCur->rots) * mh;
|
||||
if(ew.symid) mh = Mirror * mh;
|
||||
|
||||
if(uni == 'm' || uni == 'M')
|
||||
@ -2839,7 +2838,7 @@ EX namespace mapeditor {
|
||||
shiftmatrix T = rgpushxto0(lstart);
|
||||
texture::where = lstartcell;
|
||||
for(int i=0; i<circp; i++)
|
||||
texture::drawPixel(T * xspinpush0(2 * M_PI * i / circp, rad), tcolor);
|
||||
texture::drawPixel(T * xspinpush0(TAU * i / circp, rad), tcolor);
|
||||
lstartcell = NULL;
|
||||
}
|
||||
#endif
|
||||
@ -2936,13 +2935,13 @@ EX namespace mapeditor {
|
||||
for(int r=0; r<us->d[l].rots; r++) {
|
||||
for(int i=0; i<isize(us->d[l].list); i++) {
|
||||
hyperpoint h = us->d[l].list[i];
|
||||
h = spin(360 * degree * r / us->d[l].rots) * h;
|
||||
h = spin(TAU * r / us->d[l].rots) * h;
|
||||
for(int d=0; d<GDIM; d++) print(hlog, fts(h[d]), ", ");
|
||||
}
|
||||
if(us->d[l].sym) for(int i=isize(us->d[l].list)-1; i>=0; i--) {
|
||||
hyperpoint h = us->d[l].list[i];
|
||||
h[1] = -h[1];
|
||||
h = spin(360 * degree * r / us->d[l].rots) * h;
|
||||
h = spin(TAU * r / us->d[l].rots) * h;
|
||||
for(int d=0; d<GDIM; d++) print(hlog, fts(h[d]), ", ");
|
||||
}
|
||||
}
|
||||
@ -3022,7 +3021,7 @@ EX namespace mapeditor {
|
||||
if(radius > .1) circp *= 2;
|
||||
|
||||
for(int j=0; j<circp; j++)
|
||||
pts.push_back(xspinpush0(M_PI*j*2/circp, radius));
|
||||
pts.push_back(xspinpush0(TAU * j / circp, radius));
|
||||
for(int j=0; j<circp; j++) curvepoint(pts[j]);
|
||||
curvepoint(pts[0]);
|
||||
queuecurve(Ctr, dtcolor, 0, PPR::LINE);
|
||||
@ -3057,7 +3056,7 @@ EX namespace mapeditor {
|
||||
|
||||
for(int j=0; j<=texture::texturesym; j++)
|
||||
for(int i=0; i<c->type; i += sih.symmetries) {
|
||||
shiftmatrix M2 = V * applyPatterndir(c, sih) * spin(2*M_PI*i/c->type);
|
||||
shiftmatrix M2 = V * applyPatterndir(c, sih) * spin(TAU * i / c->type);
|
||||
if(j) M2 = M2 * Mirror;
|
||||
switch(holdmouse ? mousekey : 'd') {
|
||||
case 'c':
|
||||
@ -3141,14 +3140,14 @@ EX namespace mapeditor {
|
||||
|
||||
if(mouseout()) break;
|
||||
|
||||
shiftpoint P2 = V * spin(2*M_PI*a/ds.rots) * (b?Mirror*mh:mh);
|
||||
shiftpoint P2 = V * spin(TAU * a / ds.rots) * (b?Mirror*mh:mh);
|
||||
|
||||
queuestr(P2, 10, "x", 0xFF00FF);
|
||||
}
|
||||
|
||||
if(isize(ds.list) == 0) return us;
|
||||
|
||||
shiftpoint Plast = V * spin(-2*M_PI/ds.rots) * (ds.sym?Mirror*ds.list[0]:ds.list[isize(ds.list)-1]);
|
||||
shiftpoint Plast = V * spin(-TAU / ds.rots) * (ds.sym?Mirror*ds.list[0]:ds.list[isize(ds.list)-1]);
|
||||
int state = 0;
|
||||
int gstate = 0;
|
||||
double dist2 = 0;
|
||||
@ -3157,14 +3156,14 @@ EX namespace mapeditor {
|
||||
for(int a=0; a<ds.rots; a++)
|
||||
for(int b=0; b<(ds.sym?2:1); b++) {
|
||||
|
||||
hyperpoint mh2 = spin(2*M_PI*-ew.rotid/ds.rots) * mh;
|
||||
hyperpoint mh2 = spin(TAU * -ew.rotid/ds.rots) * mh;
|
||||
if(ew.symid) mh2 = Mirror * mh2;
|
||||
shiftpoint pseudomouse = V * spin(2*M_PI*a/ds.rots) * mirrorif(mh2, b);
|
||||
shiftpoint pseudomouse = V * spin(TAU * a / ds.rots) * mirrorif(mh2, b);
|
||||
|
||||
for(int t=0; t<isize(ds.list); t++) {
|
||||
int ti = b ? isize(ds.list)-1-t : t;
|
||||
|
||||
shiftpoint P2 = V * spin(2*M_PI*a/ds.rots) * mirrorif(ds.list[ti], b);
|
||||
shiftpoint P2 = V * spin(TAU * a / ds.rots) * mirrorif(ds.list[ti], b);
|
||||
|
||||
if(!mouseout()) {
|
||||
double d = hdist(moh, P2);
|
||||
|
11
menus.cpp
11
menus.cpp
@ -884,17 +884,6 @@ EX void showStartMenu() {
|
||||
|
||||
timerstart = time(NULL);
|
||||
|
||||
/*
|
||||
initquickqueue();
|
||||
int siz = min(vid.xres, vid.yres) / 8;
|
||||
drawMonsterType(moPrincess, NULL, atscreenpos(siz,siz,siz) * spin(-M_PI/4), 0, 0);
|
||||
drawMonsterType(moKnight, NULL, atscreenpos(vid.xres-siz,siz,siz) * spin(-3*M_PI/4), 0, 0);
|
||||
drawItemType(itOrbYendor, NULL, atscreenpos(siz,vid.yres-siz,siz) * spin(M_PI/4), iinf[itOrbYendor].color, 0, false);
|
||||
drawItemType(itKey, NULL, atscreenpos(siz,vid.yres-siz,siz) * spin(M_PI/4), iinf[itKey].color, 0, false);
|
||||
drawItemType(itHyperstone, NULL, atscreenpos(vid.xres-siz,vid.yres-siz,siz) * spin(3*M_PI/4), iinf[itHyperstone].color, 0, false);
|
||||
quickqueue();
|
||||
*/
|
||||
|
||||
keyhandler = [] (int sym, int uni) {
|
||||
dialog::handleNavigation(sym, uni);
|
||||
if(uni == 'o') uni = 'i';
|
||||
|
12
models.cpp
12
models.cpp
@ -176,7 +176,7 @@ EX namespace models {
|
||||
euclidean_spin = pispin * iso_inverse(cview().T * currentmap->master_relative(centerover, true));
|
||||
euclidean_spin = gpushxto0(euclidean_spin * C0) * euclidean_spin;
|
||||
hyperpoint h = inverse(euclidean_spin) * (C0 + (euc::eumove(gp::loc{1,0})*C0 - C0) * vpconf.spiral_x + (euc::eumove(gp::loc{0,1})*C0 - C0) * vpconf.spiral_y);
|
||||
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
|
||||
spiral_multiplier = cld(0, TAU) / cld(h[0], h[1]);
|
||||
}
|
||||
|
||||
if(centerover && !history::on)
|
||||
@ -323,11 +323,11 @@ EX namespace models {
|
||||
initquickqueue();
|
||||
queuereset(mdPixel, PPR::LINE);
|
||||
for(int a=-1; a<=1; a++) {
|
||||
curvepoint(point2(-M_PI/2 * current_display->radius, a*current_display->radius));
|
||||
curvepoint(point2(+M_PI/2 * current_display->radius, a*current_display->radius));
|
||||
curvepoint(point2(-90._deg * current_display->radius, a*current_display->radius));
|
||||
curvepoint(point2(+90._deg * current_display->radius, a*current_display->radius));
|
||||
queuecurve(shiftless(Id), forecolor, 0, PPR::LINE);
|
||||
curvepoint(point2(a*current_display->radius, -M_PI/2*current_display->radius));
|
||||
curvepoint(point2(a*current_display->radius, +M_PI/2*current_display->radius));
|
||||
curvepoint(point2(a*current_display->radius, -90._deg * current_display->radius));
|
||||
curvepoint(point2(a*current_display->radius, +90._deg * current_display->radius));
|
||||
queuecurve(shiftless(Id), forecolor, 0, PPR::LINE);
|
||||
}
|
||||
queuereset(vpconf.model, PPR::LINE);
|
||||
@ -1035,7 +1035,7 @@ EX namespace models {
|
||||
"Here you can change this parameter.", 'b');
|
||||
param_f(p.miller_parameter, sp+"miller");
|
||||
param_f(p.loximuthal_parameter, sp+"loximuthal")
|
||||
-> editable(-M_PI/2, M_PI/2, .1, "loximuthal parameter",
|
||||
-> editable(-90._deg, 90._deg, .1, "loximuthal parameter",
|
||||
"Loximuthal is similar to azimuthal equidistant, but based on loxodromes (lines of constant geographic direction) rather than geodesics. "
|
||||
"The loximuthal projection maps (the shortest) loxodromes to straight lines of the same length, going through the starting point. "
|
||||
"This setting changes the latitude of the starting point.\n\n"
|
||||
|
14
netgen.cpp
14
netgen.cpp
@ -366,8 +366,8 @@ EX namespace netgen {
|
||||
printf("faza %d cell %d\n", faza, i);
|
||||
|
||||
for(int e=0; e<t; e++) {
|
||||
vec v1 = center[i] * nscale + raylen[i] * ang(rot[i] + 2*M_PI*e/t);
|
||||
vec v2 = center[i] * nscale + raylen[i] * ang(rot[i] + 2*M_PI*(e+1)/t);
|
||||
vec v1 = center[i] * nscale + raylen[i] * ang(rot[i] + TAU * e/t);
|
||||
vec v2 = center[i] * nscale + raylen[i] * ang(rot[i] + TAU * (e+1)/t);
|
||||
vec v3 = (v1+v2)/2;
|
||||
|
||||
if(faza == 1) blackline(v1, v2);
|
||||
@ -486,10 +486,10 @@ EX namespace netgen {
|
||||
for(int e=0; e<it; e++) if(nei[i][e] == j) ie = e;
|
||||
for(int e=0; e<jt; e++) if(nei[j][e] == i) je = e;
|
||||
|
||||
rot[i] = rot[j] + 2*M_PI*(je+.5)/jt - 2*M_PI*(ie+.5)/it + M_PI;
|
||||
rot[i] = rot[j] + TAU*(je+.5)/jt - TAU*(ie+.5)/it + M_PI;
|
||||
center[i] =
|
||||
center[j] +
|
||||
(edgist[i]+edgist[j]) * ang(rot[j] + 2*M_PI*(je+.5)/jt);
|
||||
(edgist[i]+edgist[j]) * ang(rot[j] + TAU*(je+.5)/jt);
|
||||
}
|
||||
|
||||
shiftpoint vec_to_p(vec v) {
|
||||
@ -555,8 +555,8 @@ EX namespace netgen {
|
||||
applyGlue(i);
|
||||
|
||||
for(int e=0; e<t; e++) {
|
||||
vec v1 = center[i] + raylen[i] * ang(rot[i] + 2*M_PI*e/t);
|
||||
vec v2 = center[i] + raylen[i] * ang(rot[i] + 2*M_PI*(e+1)/t);
|
||||
vec v1 = center[i] + raylen[i] * ang(rot[i] + TAU*e/t);
|
||||
vec v2 = center[i] + raylen[i] * ang(rot[i] + TAU*(e+1)/t);
|
||||
vec v3 = (v1+v2)/2;
|
||||
|
||||
if(nei[i][e] >= 0 && !dragging) {
|
||||
@ -756,7 +756,7 @@ EX namespace netgen {
|
||||
}
|
||||
if(uni == 's') {
|
||||
View = Id;
|
||||
if(ctof(centerover)) View = spin(2 * M_PI * (rand() % 7) / 7) * View;
|
||||
if(ctof(centerover)) View = spin(TAU * (rand() % 7) / 7) * View;
|
||||
playermoved = false;
|
||||
}
|
||||
else if(uni == 'c') {
|
||||
|
@ -784,14 +784,14 @@ EX namespace nilv {
|
||||
|
||||
if(hypot_d(2, h) < 1e-6) return point3(h[0], h[1], h[2]);
|
||||
else if(side > 1e-6) {
|
||||
wmin = 0, wmax = 2 * M_PI;
|
||||
wmin = 0, wmax = TAU;
|
||||
}
|
||||
else if(side < -1e-6) {
|
||||
wmin = - 2 * M_PI, wmax = 0;
|
||||
wmin = - TAU, wmax = 0;
|
||||
}
|
||||
else return point3(h[0], h[1], 0);
|
||||
|
||||
ld alpha_total = h[0] ? atan(h[1] / h[0]) : M_PI/2;
|
||||
ld alpha_total = h[0] ? atan(h[1] / h[0]) : 90._deg;
|
||||
|
||||
ld b;
|
||||
if(abs(h[0]) > abs(h[1]))
|
||||
@ -1578,14 +1578,14 @@ EX namespace product {
|
||||
if(twisted && i == c->type-1 && where[c].second == hybrid::csteps-1) {
|
||||
auto b = spins[where[c].first].first;
|
||||
transmatrix T = mscale(Id, cgi.plevel);
|
||||
T = T * spin(2 * M_PI * b.spin / b.at->type);
|
||||
T = T * spin(TAU * b.spin / b.at->type);
|
||||
if(b.mirrored) T = T * Mirror;
|
||||
return T;
|
||||
}
|
||||
if(twisted && i == c->type-2 && where[c].second == 0) {
|
||||
auto b = spins[where[c].first].second;
|
||||
transmatrix T = mscale(Id, -cgi.plevel);
|
||||
T = T * spin(2 * M_PI * b.spin / b.at->type);
|
||||
T = T * spin(TAU * b.spin / b.at->type);
|
||||
if(b.mirrored) T = T * Mirror;
|
||||
return T;
|
||||
}
|
||||
@ -1799,7 +1799,7 @@ EX namespace slr {
|
||||
|
||||
ld z = cr * (K - 1/SV/SV);
|
||||
|
||||
ld k = M_PI/2;
|
||||
ld k = 90._deg;
|
||||
ld a = k / K;
|
||||
ld zw = xy * cr / sr;
|
||||
ld u = z * a;
|
||||
@ -2572,7 +2572,7 @@ EX namespace stretch {
|
||||
|
||||
res.push_back(point31(h[0] * a / d, h[1] * a / d, h[2] * a / d));
|
||||
|
||||
a = a - 2 * M_PI;
|
||||
a = a - TAU;
|
||||
|
||||
res.push_back(point31(h[0] * a / d, h[1] * a / d, h[2] * a / d));
|
||||
|
||||
@ -2583,7 +2583,7 @@ EX namespace stretch {
|
||||
ld a = atan2(h[2], h[3]);
|
||||
|
||||
for(int it=-generations; it<generations; it++) {
|
||||
res.push_back(point31(0, 0, (a + 2 * M_PI * it) * SV));
|
||||
res.push_back(point31(0, 0, (a + TAU * it) * SV));
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -2594,16 +2594,13 @@ EX namespace stretch {
|
||||
ld base_min_a = asin(xy);
|
||||
ld base_max_a = M_PI - base_min_a;
|
||||
|
||||
ld seek = M_PI/2-atan2(h[3], h[2]);
|
||||
ld seek = 90._deg - atan2(h[3], h[2]);
|
||||
|
||||
auto ang = [&] (ld a) {
|
||||
ld rp = xy / sin(a);
|
||||
ld co = abs(rp) >= 1 ? 0 : sqrt(1-rp*rp);
|
||||
|
||||
return atan2(co * sin(a), cos(a)) - co * (1 - 1/SV/SV) * a;
|
||||
|
||||
// while(a0 > M_PI) a0 -= 2 * M_PI;
|
||||
// while(a0 < -M_PI) a0 += 2 * M_PI;
|
||||
};
|
||||
|
||||
for(int shift=-generations; shift<generations; shift++) {
|
||||
@ -2637,10 +2634,10 @@ EX namespace stretch {
|
||||
|
||||
// println(hlog, "*** ", mi, t, " ** ", tie(min_a, ang_min), tie(extreme, ang_extreme), tie(max_a, ang_max), " -> ", vmin, " to ", vmax);
|
||||
|
||||
int cmin = ceil((vmin - seek) / 2 / M_PI);
|
||||
int cmax = floor((vmax - seek) / 2 / M_PI);
|
||||
int cmin = ceil((vmin - seek) / TAU);
|
||||
int cmax = floor((vmax - seek) / TAU);
|
||||
for(int c = cmin; c <= cmax; c++) {
|
||||
ld cseek = seek + c * 2 * M_PI;
|
||||
ld cseek = seek + c * TAU;
|
||||
|
||||
for(int it=0; it<40; it++) {
|
||||
|
||||
|
@ -304,7 +304,7 @@ EX ld calcAirdir(cell *c) {
|
||||
for(int i=0; i<c->type; i++) {
|
||||
cell *c2 = c->move(i);
|
||||
if(c2 && c2->monst == moAirElemental) {
|
||||
return c->c.spin(i) * 2 * M_PI / c2->type;
|
||||
return c->c.spin(i) * TAU / c2->type;
|
||||
}
|
||||
}
|
||||
for(int i=0; i<c->type; i++) {
|
||||
@ -315,7 +315,7 @@ EX ld calcAirdir(cell *c) {
|
||||
for(int i=0; i<c2->type; i++) {
|
||||
cell *c3 = c2->move(i);
|
||||
if(c3 && c3->monst == moAirElemental) {
|
||||
return c2->c.spin(i) * 2 * M_PI / c3->type;
|
||||
return c2->c.spin(i) * TAU / c3->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
pattern2.cpp
22
pattern2.cpp
@ -2717,7 +2717,7 @@ EX namespace linepatterns {
|
||||
ALLCELLS(
|
||||
if(is_master(c) && !euclid) for(int i=0; i<S7; i++)
|
||||
if(c->master->move(i) && c->master->move(i) < c->master) {
|
||||
gridlinef(V, C0, xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
||||
gridlinef(V, C0, xspinpush0(-TAU*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
||||
}
|
||||
)
|
||||
);
|
||||
@ -2726,7 +2726,7 @@ EX namespace linepatterns {
|
||||
ALLCELLS(
|
||||
if(is_master(c) && !euclid) for(int i=0; i<S7; i++)
|
||||
if(c->master->move(i) && way(c->master, i) && c->master->move(i)->dm4 == c->master->dm4)
|
||||
gridlinef(V, C0, xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
||||
gridlinef(V, C0, xspinpush0(-TAU*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
||||
)
|
||||
);
|
||||
|
||||
@ -2821,15 +2821,15 @@ EX namespace linepatterns {
|
||||
if(pseudohept(c) && (p/4 == 10 || p/4 == 8))
|
||||
for(int i=0; i<S7; i++) if(c->move(i) && emeraldval(c->move(i)) == p-4) {
|
||||
gridlinef(V, C0, tC0(cgi.heptmove[i]), col, 2 + vid.linequality);
|
||||
gridlinef(V, C0, xspinpush0(-i * 2 * M_PI / S7, -hdist/2), col, 2 + vid.linequality);
|
||||
gridlinef(V, C0, xspinpush0(-i * TAU / S7, -hdist/2), col, 2 + vid.linequality);
|
||||
}
|
||||
)
|
||||
);
|
||||
linepattern patPalacelike("firewall lines", 0xFF400000, stdhyp_only,
|
||||
ALLCELLS(
|
||||
if(pseudohept(c)) for(int i=0; i<7; i++)
|
||||
gridlinef(V, ddspin(c,i,M_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,M_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
col, 1 + vid.linequality);
|
||||
)
|
||||
);
|
||||
@ -2840,8 +2840,8 @@ EX namespace linepatterns {
|
||||
cell *c1 = createMov(c, (i+3) % 7);
|
||||
cell *c2 = createMov(c, (i+4) % 7);
|
||||
if(polarb50(c1) != a && polarb50(c2) != a)
|
||||
gridlinef(V, ddspin(c,i,M_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,M_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
col, 1 + vid.linequality);
|
||||
}
|
||||
)
|
||||
@ -2871,8 +2871,8 @@ EX namespace linepatterns {
|
||||
heptagon *h2 = c->master->modmove(i-1);
|
||||
if(!h1 || !h2) continue;
|
||||
if(emeraldval(h1->c7)/4 == 8 && emeraldval(h2->c7)/4 == 8)
|
||||
gridlinef(V, ddspin(c,i,M_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,M_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
||||
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
||||
col, 1 + vid.linequality);
|
||||
}
|
||||
)
|
||||
@ -2951,8 +2951,8 @@ EX namespace linepatterns {
|
||||
)
|
||||
);
|
||||
EX ld parallel_count = 6;
|
||||
EX ld parallel_max = 90 * degree;
|
||||
EX ld parallel_length = 180 * degree;
|
||||
EX ld parallel_max = 90._deg;
|
||||
EX ld parallel_length = M_PI;
|
||||
linepattern patParallels("parallels", 0xFFFFFF00, always_available,
|
||||
ATCENTER(
|
||||
for(int i=-int(parallel_count); i<=parallel_count; i ++) {
|
||||
|
48
polygons.cpp
48
polygons.cpp
@ -18,8 +18,7 @@ static constexpr ld WOLF = (-15.5);
|
||||
void geometry_information::hpc_connect_ideal(hyperpoint a, hyperpoint b) {
|
||||
ld left = -atan2(a);
|
||||
ld right = -atan2(b);
|
||||
if(right > left + 180*degree) right -= 360*degree;
|
||||
if(right < left - 180*degree) right += 360*degree;
|
||||
cyclefix(right, left);
|
||||
/* call hpc.push_back directly to avoid adding points */
|
||||
ld qty = ceil(abs(right-left) / ideal_each);
|
||||
for(int i=0; i<=qty; i++) hpc.push_back(xspinpush0(lerp(left, right, i/qty), ideal_limit));
|
||||
@ -149,7 +148,7 @@ void geometry_information::extra_vertices() {
|
||||
#endif
|
||||
}
|
||||
|
||||
transmatrix geometry_information::ddi(int a, ld x) { return xspinpush(a * M_PI / S42, x); }
|
||||
transmatrix geometry_information::ddi(int a, ld x) { return xspinpush(a * S_step, x); }
|
||||
|
||||
void geometry_information::drawTentacle(hpcshape &h, ld rad, ld var, ld divby) {
|
||||
double tlength = max(crossf, hexhexdist);
|
||||
@ -319,7 +318,7 @@ void geometry_information::bshape(hpcshape& sh, PPR prio, double shzoom, int sha
|
||||
}
|
||||
}
|
||||
else shzoomx *= bscale7, shzoomy *= bscale7;
|
||||
double bonusf = /* sphere ? M_PI*4/35 : */ (rots-rots2+.0) / rots2;
|
||||
double bonusf = (rots-rots2+.0) / rots2;
|
||||
|
||||
auto ipoint = [&] (int i, int mul) {
|
||||
hyperpoint h = hpxy(polydata[whereis+2*i] * shzoomx, polydata[whereis+2*i+1] * shzoomy * mul);
|
||||
@ -330,10 +329,10 @@ void geometry_information::bshape(hpcshape& sh, PPR prio, double shzoom, int sha
|
||||
|
||||
for(int r=0; r<rots2; r++) {
|
||||
for(int i=0; i<qty; i++)
|
||||
hpcpush(spin(2*M_PI*r/rots2) * ipoint(i, 1));
|
||||
hpcpush(spin(TAU*r/rots2) * ipoint(i, 1));
|
||||
if(sym == 2)
|
||||
for(int i=qty-1; i>=0; i--)
|
||||
hpcpush(spin(2*M_PI*r/rots2) * ipoint(i, -1));
|
||||
hpcpush(spin(TAU*r/rots2) * ipoint(i, -1));
|
||||
}
|
||||
hpcpush(ipoint(0, 1));
|
||||
finishshape();
|
||||
@ -412,8 +411,8 @@ void geometry_information::make_sidewalls() {
|
||||
void geometry_information::procedural_shapes() {
|
||||
bshape(shMovestar, PPR::MOVESTAR);
|
||||
for(int i=0; i<=8; i++) {
|
||||
hpcpush(xspinpush0(M_PI * i/4, crossf));
|
||||
if(i != 8) hpcpush(xspinpush0(M_PI * i/4 + M_PI/8, crossf/4));
|
||||
hpcpush(xspinpush0(90._deg * i, crossf));
|
||||
if(i != 8) hpcpush(xspinpush0(90._deg * i + 45._deg, crossf/4));
|
||||
}
|
||||
|
||||
// procedural floors
|
||||
@ -525,7 +524,7 @@ void geometry_information::procedural_shapes() {
|
||||
|
||||
bshape(shCross, PPR::WALL);
|
||||
for(int i=0; i<=84; i+=7)
|
||||
hpcpush(xspinpush0(2*M_PI*i/84, zhexf * (i%3 ? 0.8 : 0.3)));
|
||||
hpcpush(xspinpush0(TAU*i/84, zhexf * (i%3 ? 0.8 : 0.3)));
|
||||
|
||||
// items
|
||||
|
||||
@ -634,8 +633,8 @@ void geometry_information::procedural_shapes() {
|
||||
|
||||
bshape(shEccentricDisk, PPR::ITEM);
|
||||
for(int i=0; i<=S84; i+=SD3) {
|
||||
hpcpush(hpxy(sin(i*2*M_PI/S84)*orbsize*.075,
|
||||
cos(i*2*M_PI/S84)*orbsize*.075 + .07));
|
||||
hpcpush(hpxy(sin(i*S_step)*orbsize*.075,
|
||||
cos(i*S_step)*orbsize*.075 + .07));
|
||||
}
|
||||
|
||||
bshape(shDiskSq, PPR::ITEM);
|
||||
@ -645,11 +644,11 @@ void geometry_information::procedural_shapes() {
|
||||
|
||||
bshape(shEgg, PPR::ITEM);
|
||||
RING(i)
|
||||
hpcpush(hpxy(sin(i*2*M_PI/S84)*0.242 * orbsize, cos(i*2*M_PI/S84)*0.177*orbsize));
|
||||
hpcpush(hpxy(sin(i*S_step)*0.242 * orbsize, cos(i*S_step)*0.177*orbsize));
|
||||
|
||||
bshape(shSmallEgg, PPR::ITEM);
|
||||
RING(i)
|
||||
hpcpush(hpxy(sin(i*2*M_PI/S84)*0.242 * orbsize/2, cos(i*2*M_PI/S84)*0.177*orbsize/2));
|
||||
hpcpush(hpxy(sin(i*S_step)*0.242 * orbsize/2, cos(i*S_step)*0.177*orbsize/2));
|
||||
|
||||
auto make_ring = [this] (hpcshape& sh, reaction_t f) {
|
||||
bshape(sh, PPR::ITEM);
|
||||
@ -812,11 +811,11 @@ void geometry_information::procedural_shapes() {
|
||||
|
||||
bshape(shSlime, PPR::MONSTER_BODY);
|
||||
PRING(i)
|
||||
hpcpush(ddi(i, scalefactor * hcrossf7 * (0.7 + .2 * sin(i * M_PI * 2 / S84 * 9))) * C0);
|
||||
hpcpush(ddi(i, scalefactor * hcrossf7 * (0.7 + .2 * sin(i * S_step * 9))) * C0);
|
||||
|
||||
bshape(shJelly, PPR::MONSTER_BODY);
|
||||
PRING(i)
|
||||
hpcpush(ddi(i, scalefactor * hcrossf7 * (0.4 + .03 * sin(i * M_PI * 2 / S84 * 7))) * C0);
|
||||
hpcpush(ddi(i, scalefactor * hcrossf7 * (0.4 + .03 * sin(i * S_step * 7))) * C0);
|
||||
|
||||
bshape(shHeptaMarker, PPR::HEPTAMARK);
|
||||
for(int t=0; t<=SD7; t++) hpcpush(ddi(t*S12, zhexf*.2) * C0);
|
||||
@ -826,25 +825,25 @@ void geometry_information::procedural_shapes() {
|
||||
|
||||
bshape(shRose, PPR::ITEM);
|
||||
PRING(t)
|
||||
hpcpush(xspinpush0(M_PI * t / (S42+.0), scalefactor * hcrossf7 * (0.2 + .15 * sin(M_PI * t / (S42+.0) * 3))));
|
||||
hpcpush(xspinpush0(S_step * t, scalefactor * hcrossf7 * (0.2 + .15 * sin(S_step * t * 3))));
|
||||
finishshape();
|
||||
|
||||
shRoseItem = shRose;
|
||||
|
||||
bshape(shSmallRose, PPR::ITEM);
|
||||
PRING(t)
|
||||
hpcpush(xspinpush0(M_PI * t / (S42+.0), scalefactor/2 * hcrossf7 * (0.2 + .15 * sin(M_PI * t / (S42+.0) * 3))));
|
||||
hpcpush(xspinpush0(S_step * t, scalefactor/2 * hcrossf7 * (0.2 + .15 * sin(S_step * t * 3))));
|
||||
finishshape();
|
||||
|
||||
bshape(shThorns, PPR::THORNS);
|
||||
for(int t=0; t<=60; t++)
|
||||
hpcpush(xspinpush0(M_PI * t / 30.0, scalefactor * hcrossf7 * ((t&1) ? 0.3 : 0.6)));
|
||||
hpcpush(xspinpush0(TAU * t / 60, scalefactor * hcrossf7 * ((t&1) ? 0.3 : 0.6)));
|
||||
|
||||
for(int i=0; i<16; i++) {
|
||||
bshape(shParticle[i], PPR::PARTICLE);
|
||||
for(int t=0; t<6; t++)
|
||||
// hpcpush(xspinpush0(M_PI * t * 2 / 6 + M_PI * 2/6 * hrand(100) / 150., (0.03 + hrand(100) * 0.0003) * scalefactor));
|
||||
hpcpush(xspinpush0(M_PI * t * 2 / 6 + M_PI * 2/6 * randd() / 1.5, (0.03 + randd() * 0.03) * scalefactor));
|
||||
hpcpush(xspinpush0(TAU * t / 6 + 60._deg * randd() / 1.5, (0.03 + randd() * 0.03) * scalefactor));
|
||||
hpc.push_back(hpc[last->s]);
|
||||
}
|
||||
|
||||
@ -853,7 +852,7 @@ void geometry_information::procedural_shapes() {
|
||||
if(GDIM == 3) asteroid_size[i] *= 7;
|
||||
bshape(shAsteroid[i], PPR::PARTICLE);
|
||||
for(int t=0; t<12; t++)
|
||||
hpcpush(xspinpush0(M_PI * t / 6, asteroid_size[i] * (1 - randd() * .2)));
|
||||
hpcpush(xspinpush0(TAU * t / 12, asteroid_size[i] * (1 - randd() * .2)));
|
||||
hpc.push_back(hpc[last->s]);
|
||||
}
|
||||
|
||||
@ -1100,7 +1099,7 @@ void geometry_information::configure_floorshapes() {
|
||||
if(!BITRUNCATED) {
|
||||
ld hedge = hdist(xspinpush0(M_PI/S7, rhexf), xspinpush0(-M_PI/S7, rhexf));
|
||||
|
||||
trihepta1 = hdist0(xpush(tessf) * xspinpush0(2*M_PI*2/S7, tessf)) / 2 * .98;
|
||||
trihepta1 = hdist0(xpush(tessf) * xspinpush0(TAU*2/S7, tessf)) / 2 * .98;
|
||||
trihepta0 = hdist0(xpush(-tessf) * xspinpush0(M_PI/S7, rhexf+hedge/2)) * .98;
|
||||
}
|
||||
|
||||
@ -1150,6 +1149,7 @@ void geometry_information::prepare_shapes() {
|
||||
S28 = SD7 * 4;
|
||||
S36 = SD6 * 6;
|
||||
S84 = S42 * 2;
|
||||
S_step = A_PI / S42;
|
||||
|
||||
// printf("crossf = %f euclid = %d sphere = %d\n", float(crossf), euclid, sphere);
|
||||
hpc.clear(); ext.clear();
|
||||
@ -1179,11 +1179,11 @@ void geometry_information::prepare_shapes() {
|
||||
dynamicval<int> d(vid.texture_step, max(vid.texture_step, 4));
|
||||
ld len6 = hdist0(mid(xpush0(hexvdist), spin(M_PI/S3) * xpush0(hexvdist)));
|
||||
|
||||
ld len7 = hdist0(mid(xpush0(hexf), spin(M_PI*2/S7) * xpush0(hexf)));
|
||||
ld hlen7 = hdist0(mid(xpush0(hcrossf), spin(M_PI*2/S7) * xpush0(hcrossf)));
|
||||
ld len7 = hdist0(mid(xpush0(hexf), spin(TAU/S7) * xpush0(hexf)));
|
||||
ld hlen7 = hdist0(mid(xpush0(hcrossf), spin(TAU/S7) * xpush0(hcrossf)));
|
||||
|
||||
ld lenx = hdist(xpush0(hexvdist), spin(M_PI/S3) * xpush0(hexvdist));
|
||||
ld hlenx = hdist(xpush0(hcrossf), spin(2*M_PI/S7) * xpush0(hcrossf));
|
||||
ld hlenx = hdist(xpush0(hcrossf), spin(TAU/S7) * xpush0(hcrossf));
|
||||
|
||||
bshape(shHalfMirror[2], PPR::WALL);
|
||||
hpcpush(C0); hpcpush(xpush0(-len6*scalefactor)); chasmifyPoly(FLOOR, WALL, 0);
|
||||
|
12
racing.cpp
12
racing.cpp
@ -54,10 +54,10 @@ EX int race_start_tick, race_finish_tick[MAXPLAYER];
|
||||
typedef unsigned char uchar;
|
||||
|
||||
uchar frac_to_uchar(ld x) { return uchar(x * 256); }
|
||||
uchar angle_to_uchar(ld x) { return frac_to_uchar(x / 2 / M_PI); }
|
||||
uchar angle_to_uchar(ld x) { return frac_to_uchar(x / TAU); }
|
||||
|
||||
ld uchar_to_frac(uchar x) { return x / 256.; }
|
||||
transmatrix spin_uchar(uchar x) { return spin(uchar_to_frac(x) * 2 * M_PI); }
|
||||
transmatrix spin_uchar(uchar x) { return spin(uchar_to_frac(x) * TAU); }
|
||||
|
||||
static const ld distance_multiplier = 4;
|
||||
|
||||
@ -763,7 +763,7 @@ EX bool set_view() {
|
||||
}
|
||||
at /= multi::players;
|
||||
at = normalize(at);
|
||||
atm = rgpushxto0(at) * spin(-90*degree) * rspintox(gpushxto0(at) * first);
|
||||
atm = rgpushxto0(at) * spin270() * rspintox(gpushxto0(at) * first);
|
||||
}
|
||||
|
||||
if(racing::player_relative || quotient || (kite::in() && GDIM == 3)) {
|
||||
@ -788,11 +788,11 @@ EX bool set_view() {
|
||||
|
||||
View = xpush(-x) * T * iT1 * ypush(vid.yshift) * View;
|
||||
|
||||
if(GDIM == 3) View = cspin(2, 0, M_PI/2) * View;
|
||||
if(GDIM == 3) View = cspin(2, 0, 90._deg) * View;
|
||||
fixmatrix(View);
|
||||
}
|
||||
if(GDIM == 3 && WDIM == 2)
|
||||
View = cspin(0, 1, M_PI) * cspin(2, 1, M_PI/2 + shmup::playerturny[multi::cpid]) * spin(-M_PI/2) * View;
|
||||
View = spin180() * cspin(2, 1, 90._deg + shmup::playerturny[multi::cpid]) * spin270() * View;
|
||||
else if(GDIM == 2) View = spin(race_angle * degree) * View;
|
||||
return true;
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ void draw_ghost(ghost& ghost) {
|
||||
|
||||
shiftmatrix racerel(ld rel) {
|
||||
int bsize = vid.fsize * 2;
|
||||
return shiftless(atscreenpos(bsize, vid.yres - bsize - rel * (vid.yres - bsize*2) / 100, bsize) * spin(M_PI/2));
|
||||
return shiftless(atscreenpos(bsize, vid.yres - bsize - rel * (vid.yres - bsize*2) / 100, bsize) * spin90());
|
||||
}
|
||||
|
||||
EX int get_percentage(cell *c) {
|
||||
|
@ -110,7 +110,7 @@ EX void draw_radar(bool cornermode) {
|
||||
curvepoint(atscreenpos(cx-cos(i * degree)*rad, cy-sin(i*degree)*rad, 1) * C0);
|
||||
queuecurve(sId, 0xFFFFFFFF, 0x000000FF, PPR::ZERO);
|
||||
|
||||
ld alpha = 15 * degree;
|
||||
ld alpha = 15._deg;
|
||||
ld co = cos(alpha);
|
||||
ld si = sin(alpha);
|
||||
|
||||
|
@ -2634,9 +2634,9 @@ EX void cast() {
|
||||
glUniformMatrix4fv(o->uStraighten, 1, 0, glhr::tmtogl_transpose(asonov::straighten).as_array());
|
||||
}
|
||||
if(o->uReflectX != -1) {
|
||||
auto h = glhr::pointtogl(tangent_length(spin(90*degree) * asonov::ty, 2));
|
||||
auto h = glhr::pointtogl(tangent_length(spin90() * asonov::ty, 2));
|
||||
glUniform4fv(o->uReflectX, 1, &h[0]);
|
||||
h = glhr::pointtogl(tangent_length(spin(90*degree) * asonov::tx, 2));
|
||||
h = glhr::pointtogl(tangent_length(spin90() * asonov::tx, 2));
|
||||
glUniform4fv(o->uReflectY, 1, &h[0]);
|
||||
}
|
||||
#endif
|
||||
|
54
reg3.cpp
54
reg3.cpp
@ -216,14 +216,14 @@ EX namespace reg3 {
|
||||
|
||||
if(1) {
|
||||
dynamicval<eGeometry> dg(geometry, gSphere);
|
||||
angle_between_faces = edge_of_triangle_with_angles(2*M_PI/mid, M_PI/face, M_PI/face);
|
||||
angle_between_faces = edge_of_triangle_with_angles(TAU/mid, M_PI/face, M_PI/face);
|
||||
|
||||
h0 = xtangent(1);
|
||||
h1 = cspin(0, 1, angle_between_faces) * h0;
|
||||
h2 = cspin(1, 2, 2*M_PI/face) * h1;
|
||||
h3 = cspin(1, 2, -2*M_PI/face) * h1;
|
||||
h2 = cspin(1, 2, TAU/face) * h1;
|
||||
h3 = cspin(1, 2, -TAU/face) * h1;
|
||||
|
||||
hcrossf = edge_of_triangle_with_angles(M_PI/2, M_PI/mid, M_PI/face);
|
||||
hcrossf = edge_of_triangle_with_angles(90._deg, M_PI/mid, M_PI/face);
|
||||
|
||||
h012 = cspin(1, 2, M_PI/face) * cspin(0, 1, hcrossf) * h0;
|
||||
h013 = cspin(1, 2, -M_PI/face) * cspin(0, 1, hcrossf) * h0;
|
||||
@ -245,7 +245,7 @@ EX namespace reg3 {
|
||||
u = normalize(u);
|
||||
|
||||
hyperpoint h = C0 * face;
|
||||
for(int i=0; i<face; i++) h += d * (cspin(1, 2, M_PI*2*i/face) * h012);
|
||||
for(int i=0; i<face; i++) h += d * (cspin(1, 2, TAU*i/face) * h012);
|
||||
h = normalize(h);
|
||||
|
||||
hyperpoint h2 = rspintox(h) * xpush0(2 * hdist0(h));
|
||||
@ -276,25 +276,25 @@ EX namespace reg3 {
|
||||
hyperpoint v2 = C0 + klein_scale * h012;
|
||||
|
||||
hyperpoint midface = Hypc;
|
||||
for(int i=0; i<face; i++) midface += cspin(1, 2, 2*i*M_PI/face) * v2;
|
||||
for(int i=0; i<face; i++) midface += cspin(1, 2, TAU * i/face) * v2;
|
||||
midface = normalize(midface);
|
||||
ld between_centers = 2 * hdist0(midface);
|
||||
DEBB(DF_GEOM, ("between_centers = ", between_centers));
|
||||
|
||||
if(S7 == 20) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
spins[2] = spins[1] * cspin(1, 2, -2 * M_PI/face) * spins[1];
|
||||
spins[3] = spins[1] * cspin(1, 2, +2 * M_PI/face) * spins[1];
|
||||
for(int a=4; a<10; a++) spins[a] = cspin(1, 2, 2*M_PI/face) * spins[a-3];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin(0, 1, M_PI);
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
spins[2] = spins[1] * cspin(1, 2, -TAU/face) * spins[1];
|
||||
spins[3] = spins[1] * cspin(1, 2, +TAU/face) * spins[1];
|
||||
for(int a=4; a<10; a++) spins[a] = cspin(1, 2, TAU/face) * spins[a-3];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * spin180();
|
||||
}
|
||||
|
||||
if(S7 == 12 || S7 == 8) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, 2*M_PI*(a-1)/face) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = cspin(0, 1, M_PI) * spins[a-S7/2];
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, TAU*(a-1)/face) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = cspin180(0, 1) * spins[a-S7/2];
|
||||
if(S7 == 8) swap(spins[6], spins[7]);
|
||||
if(S7 == 12) swap(spins[8], spins[11]);
|
||||
if(S7 == 12) swap(spins[9], spins[10]);
|
||||
@ -302,25 +302,25 @@ EX namespace reg3 {
|
||||
|
||||
if(S7 == 6) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
spins[2] = cspin(1, 2, M_PI/2) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin(0, 1, M_PI);
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
spins[2] = cspin90(1, 2) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin180(0, 1);
|
||||
}
|
||||
|
||||
if(S7 == 4) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, 2*M_PI*(a-1)/face) * spins[1];
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, TAU*(a-1)/face) * spins[1];
|
||||
}
|
||||
|
||||
cellshape.clear();
|
||||
cellshape.resize(S7);
|
||||
for(int a=0; a<S7; a++) {
|
||||
for(int b=0; b<face; b++)
|
||||
cellshape[a].push_back(spins[a] * cspin(1, 2, 2*M_PI*b/face) * v2);
|
||||
cellshape[a].push_back(spins[a] * cspin(1, 2, TAU*b/face) * v2);
|
||||
}
|
||||
|
||||
cgi.adjmoves[0] = cpush(0, between_centers) * cspin(0, 2, M_PI);
|
||||
cgi.adjmoves[0] = cpush(0, between_centers) * cspin180(0, 2);
|
||||
for(int i=1; i<S7; i++) cgi.adjmoves[i] = spins[i] * cgi.adjmoves[0];
|
||||
|
||||
for(int a=0; a<S7; a++)
|
||||
@ -334,7 +334,7 @@ EX namespace reg3 {
|
||||
else cgi.strafedist = hdist(cgi.adjmoves[0] * C0, cgi.adjmoves[1] * C0);
|
||||
|
||||
if(stretch::applicable()) {
|
||||
transmatrix T = cspin(0, 2, 90 * degree);
|
||||
transmatrix T = cspin90(0, 2);
|
||||
transmatrix iT = inverse(T);
|
||||
for(auto& v: cgi.adjmoves) v = T * v * iT;
|
||||
for(auto& vv: cellshape) for(auto& v: vv) v = T * v;
|
||||
@ -1294,7 +1294,7 @@ EX namespace reg3 {
|
||||
allh[a]->c.connect(b, allh[a1], flip(b), false);
|
||||
transmatrix T = cgi.adjmoves[b];
|
||||
hyperpoint p = tC0(T);
|
||||
tmatrices[a][b] = rspintox(p) * xpush(hdist0(p)) * cspin(2, 1, 108 * degree) * spintox(p);
|
||||
tmatrices[a][b] = rspintox(p) * xpush(hdist0(p)) * cspin(2, 1, 108._deg) * spintox(p);
|
||||
}
|
||||
}
|
||||
make_subconnections();
|
||||
@ -1310,7 +1310,7 @@ EX namespace reg3 {
|
||||
hrmap_quotient3 *gen_quotient_map(bool minimized, fieldpattern::fpattern &fp) {
|
||||
#if CAP_FIELD
|
||||
if(geometry == gSpace535 && minimized) {
|
||||
return new seifert_weber::hrmap_singlecell(108*degree);
|
||||
return new seifert_weber::hrmap_singlecell(108._deg);
|
||||
}
|
||||
else if(geometry == gSpace535)
|
||||
return new seifert_weber::hrmap_seifert_cover;
|
||||
@ -2527,8 +2527,8 @@ EX const vector<int>& rule_get_childpos() {
|
||||
|
||||
EX hrmap* new_map() {
|
||||
if(geometry == gSeifertCover) return new seifert_weber::hrmap_seifert_cover;
|
||||
if(geometry == gSeifertWeber) return new seifert_weber::hrmap_singlecell(108*degree);
|
||||
if(geometry == gHomologySphere) return new seifert_weber::hrmap_singlecell(36*degree);
|
||||
if(geometry == gSeifertWeber) return new seifert_weber::hrmap_singlecell(108._deg);
|
||||
if(geometry == gHomologySphere) return new seifert_weber::hrmap_singlecell(36._deg);
|
||||
if(quotient && !sphere) return new hrmap_field3(&currfp);
|
||||
if(variation_rule_available()) return new hrmap_h3_subrule;
|
||||
if(pure_rule_available()) return new hrmap_h3_rule;
|
||||
@ -2633,7 +2633,7 @@ EX bool pseudohept(cell *c) {
|
||||
auto m = currentmap;
|
||||
hyperpoint h = tC0(m->relative_matrix(c->master, m->getOrigin(), C0));
|
||||
if(S7 == 12) {
|
||||
hyperpoint h1 = cspin(0, 1, atan2(16, 69) + M_PI/4) * h;
|
||||
hyperpoint h1 = cspin(0, 1, atan2(16, 69) + 45._deg) * h;
|
||||
for(int i=0; i<4; i++) if(abs(abs(h1[i]) - .5) > .01) return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)));
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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++)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
22
rug.cpp
22
rug.cpp
@ -191,16 +191,14 @@ EX rugpoint *addRugpoint(shiftpoint h, double dist) {
|
||||
ld d = h1[0] * h[1] - h1[1] * h[0];
|
||||
ld a = h[0] * h1[0] + h[1] * h1[1];
|
||||
|
||||
// m->flat = modelscale * hpxyz(d * 2 * M_PI, sin(a * 2 * M_PI), cos(a * 2 * M_PI));
|
||||
|
||||
USING_NATIVE_GEOMETRY;
|
||||
hyperpoint hpoint = ypush(modelscale) * xpush0(modelscale * d * 2 * M_PI);
|
||||
hyperpoint hpoint = ypush(modelscale) * xpush0(modelscale * d * TAU);
|
||||
ld hpdist = hdist0(hpoint);
|
||||
ld z = hypot_d(2, hpoint);
|
||||
if(z==0) z = 1;
|
||||
hpoint = hpoint * hpdist / z;
|
||||
|
||||
m->native = point31(hpoint[0], hpoint[1] * sin(a*2*M_PI), hpoint[1]*cos(a*2*M_PI));
|
||||
m->native = point31(hpoint[0], hpoint[1] * sin(a*TAU), hpoint[1]*cos(a*TAU));
|
||||
}
|
||||
else if(sphere) {
|
||||
m->valid = good_shape = true;
|
||||
@ -216,7 +214,7 @@ EX rugpoint *addRugpoint(shiftpoint h, double dist) {
|
||||
else if(sphere) {
|
||||
if(modelscale >= 1)
|
||||
// do as good as we can...
|
||||
scale = M_PI / 2 - 1e-3, good_shape = false, m->valid = false;
|
||||
scale = 90._deg - 1e-3, good_shape = false, m->valid = false;
|
||||
else scale = asin(modelscale);
|
||||
}
|
||||
else
|
||||
@ -374,15 +372,15 @@ struct clifford_torus {
|
||||
}
|
||||
clifford_torus();
|
||||
ld get_modelscale() {
|
||||
return hypot_d(2, xh) * xfactor * 2 * M_PI;
|
||||
return hypot_d(2, xh) * xfactor * TAU;
|
||||
}
|
||||
ld compute_mx();
|
||||
};
|
||||
#endif
|
||||
|
||||
struct hyperpoint clifford_torus::torus_to_s4(hyperpoint t) {
|
||||
double alpha = -t[0] * 2 * M_PI;
|
||||
double beta = t[1] * 2 * M_PI;
|
||||
double alpha = -t[0] * TAU;
|
||||
double beta = t[1] * TAU;
|
||||
|
||||
ld ax = alpha + 1.124651, bx = beta + 1.214893;
|
||||
return hyperpoint(
|
||||
@ -1085,7 +1083,7 @@ EX void prepareTexture() {
|
||||
shiftmatrix V = rgpushxto0(finger_center->h);
|
||||
queuestr(V, 0.5, "X", 0xFFFFFFFF, 2);
|
||||
for(int i=0; i<72; i++)
|
||||
queueline(V * xspinpush0(i*M_PI/32, finger_range), V * xspinpush0((i+1)*M_PI/32, finger_range), 0xFFFFFFFF, vid.linequality);
|
||||
queueline(V * xspinpush0(i*A_PI/32, finger_range), V * xspinpush0((i+1)*A_PI/32, finger_range), 0xFFFFFFFF, vid.linequality);
|
||||
}
|
||||
drawqueue();
|
||||
calcparam();
|
||||
@ -1286,7 +1284,7 @@ EX bool handlekeys(int sym, int uni) {
|
||||
crystal::switch_z_coordinate();
|
||||
else
|
||||
#endif
|
||||
rotate_view(cspin(0, 2, M_PI));
|
||||
rotate_view(cspin180(0, 2));
|
||||
return true;
|
||||
}
|
||||
else if(NUMBERKEY == '4') {
|
||||
@ -1295,7 +1293,7 @@ EX bool handlekeys(int sym, int uni) {
|
||||
crystal::flip_z();
|
||||
else
|
||||
#endif
|
||||
rotate_view(cspin(0, 2, M_PI/2));
|
||||
rotate_view(cspin90(0, 2));
|
||||
return true;
|
||||
}
|
||||
#if CAP_CRYSTAL
|
||||
@ -1573,7 +1571,7 @@ EX void show() {
|
||||
if(rug::rugged)
|
||||
dialog::addSelItem(XLAT("model iterations"), its(queueiter), 0);
|
||||
dialog::addItem(XLAT("stereo vision config"), 'f');
|
||||
// dialog::addSelItem(XLAT("protractor"), fts(protractor * 180 / M_PI) + "°", 'f');
|
||||
// dialog::addSelItem(XLAT("protractor"), fts(protractor / degree) + "°", 'f');
|
||||
if(!good_shape) {
|
||||
dialog::addSelItem(XLAT("maximum error"), fts(err_zero), 'e');
|
||||
if(rug::rugged)
|
||||
|
@ -1125,7 +1125,7 @@ EX ld shift_angle, movement_angle, movement_angle_2;
|
||||
EX ld normal_angle = 90;
|
||||
EX ld period = 10000;
|
||||
EX int noframes = 30;
|
||||
EX ld cycle_length = 2 * M_PI;
|
||||
EX ld cycle_length = TAU;
|
||||
EX ld parabolic_length = 1;
|
||||
EX ld skiprope_rotation;
|
||||
|
||||
@ -1282,7 +1282,7 @@ EX void apply() {
|
||||
rotate_view(cspin(1, 2, normal_angle * degree));
|
||||
rotate_view(spin(-movement_angle_2 * degree));
|
||||
}
|
||||
rotate_view(spin(2 * M_PI * t / period));
|
||||
rotate_view(spin(TAU * t / period));
|
||||
if(GDIM == 3) {
|
||||
rotate_view(spin(movement_angle_2 * degree));
|
||||
rotate_view(cspin(2, 1, normal_angle * degree));
|
||||
@ -1297,7 +1297,7 @@ EX void apply() {
|
||||
cspin(0, GDIM-1, movement_angle * degree) * spin(shift_angle * degree) * xtangent(cycle_length * t / period)
|
||||
);
|
||||
moved();
|
||||
rotate_view(cspin(0, GDIM-1, 2 * M_PI * t / period));
|
||||
rotate_view(cspin(0, GDIM-1, TAU * t / period));
|
||||
if(clearup) {
|
||||
centerover->wall = waNone;
|
||||
}
|
||||
@ -1317,7 +1317,7 @@ EX void apply() {
|
||||
#endif
|
||||
case maCircle: {
|
||||
centerover = rotation_center;
|
||||
ld alpha = circle_spins * 2 * M_PI * ticks / period;
|
||||
ld alpha = circle_spins * TAU * ticks / period;
|
||||
View = spin(-cos_auto(circle_radius)*alpha) * xpush(circle_radius) * spin(alpha) * rotation_center_View;
|
||||
moved();
|
||||
break;
|
||||
@ -1341,17 +1341,17 @@ EX void apply() {
|
||||
if(rug::rugged) {
|
||||
if(rug_rotation1) {
|
||||
rug::using_rugview rv;
|
||||
rotate_view(cspin(1, 2, -rug_angle * degree) * cspin(0, 2, rug_rotation1 * 2 * M_PI * t / period) * cspin(1, 2, rug_angle * degree));
|
||||
rotate_view(cspin(1, 2, -rug_angle * degree) * cspin(0, 2, rug_rotation1 * TAU * t / period) * cspin(1, 2, rug_angle * degree));
|
||||
}
|
||||
if(rug_rotation2) {
|
||||
rug::using_rugview rv;
|
||||
View = View * cspin(0, 1, rug_rotation2 * 2 * M_PI * t / period);
|
||||
View = View * cspin(0, 1, rug_rotation2 * TAU * t / period);
|
||||
}
|
||||
if(rug_forward)
|
||||
animate_rug_movement(rug_forward * t / period);
|
||||
}
|
||||
#endif
|
||||
pconf.skiprope += skiprope_rotation * t * 2 * M_PI / period;
|
||||
pconf.skiprope += skiprope_rotation * t * TAU / period;
|
||||
|
||||
if(ballangle_rotation) {
|
||||
if(models::has_orientation(vpconf.model))
|
||||
@ -1485,12 +1485,12 @@ void display_animation() {
|
||||
if(ma == maCircle && (circle_display_color & 0xFF)) {
|
||||
for(int s=0; s<10; s++) {
|
||||
if(s == 0) curvepoint(xpush0(circle_radius - .1));
|
||||
for(int z=0; z<100; z++) curvepoint(xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
||||
for(int z=0; z<100; z++) curvepoint(xspinpush0((z+s*100) * 2 * A_PI / 1000., circle_radius));
|
||||
queuecurve(ggmatrix(rotation_center), circle_display_color, 0, PPR::LINE);
|
||||
}
|
||||
if(sphere) for(int s=0; s<10; s++) {
|
||||
if(s == 0) curvepoint(xpush0(circle_radius - .1));
|
||||
for(int z=0; z<100; z++) curvepoint(xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
||||
for(int z=0; z<100; z++) curvepoint(xspinpush0((z+s*100) * 2 * A_PI / 1000., circle_radius));
|
||||
queuecurve(ggmatrix(rotation_center) * centralsym, circle_display_color, 0, PPR::LINE);
|
||||
}
|
||||
}
|
||||
@ -1534,7 +1534,7 @@ EX void show() {
|
||||
cmode = sm::SIDE; needs_highqual = false;
|
||||
animation_lcm = 1;
|
||||
gamescreen();
|
||||
animation_period = 2 * M_PI * animation_lcm / animation_factor;
|
||||
animation_period = TAU * animation_lcm / animation_factor;
|
||||
dialog::init(XLAT("animations"), iinf[itPalace].color, 150, 100);
|
||||
dialog::addSelItem(XLAT("period"), fts(period)+ " ms", 'p');
|
||||
dialog::add_action([] () { dialog::editNumber(period, 0, 10000, 1000, 200, XLAT("period"),
|
||||
@ -1547,7 +1547,7 @@ EX void show() {
|
||||
dialog::editNumber(animation_period, 0, 10000, 1000, 1000, XLAT("game animation period"),
|
||||
XLAT("Least common multiple of the animation periods of all the game objects on screen, such as rotating items.")
|
||||
);
|
||||
dialog::reaction = [] () { animation_factor = 2 * M_PI * animation_lcm / animation_period; };
|
||||
dialog::reaction = [] () { animation_factor = TAU * animation_lcm / animation_period; };
|
||||
dialog::extra_options = [] () {
|
||||
dialog::addItem("default", 'D');
|
||||
dialog::add_action([] () {
|
||||
@ -1614,10 +1614,10 @@ EX void show() {
|
||||
else if(ma == maTranslation) {
|
||||
dialog::addSelItem(XLAT("cycle length"), fts(cycle_length), 'c');
|
||||
dialog::add_action([] () {
|
||||
dialog::editNumber(cycle_length, 0, 10, 0.1, 2*M_PI, "shift", "");
|
||||
dialog::editNumber(cycle_length, 0, 10, 0.1, TAU, "shift", "");
|
||||
dialog::extra_options = [] () {
|
||||
dialog::addSelItem(XLAT("full circle"), fts(2 * M_PI), 'A');
|
||||
dialog::add_action([] () { cycle_length = 2 * M_PI; });
|
||||
dialog::addSelItem(XLAT("full circle"), fts(TAU), 'A');
|
||||
dialog::add_action([] () { cycle_length = TAU; });
|
||||
dialog::addSelItem(XLAT("Zebra period"), fts(2.898149445355172), 'B');
|
||||
dialog::add_action([] () { cycle_length = 2.898149445355172; });
|
||||
dialog::addSelItem(XLAT("Bolza period"), fts(2 * 1.528571), 'C');
|
||||
@ -1690,7 +1690,7 @@ EX void show() {
|
||||
dialog::extra_options = [] () {
|
||||
if(among(rug::gwhere, gSphere, gElliptic)) {
|
||||
dialog::addItem(XLAT("synchronize"), 'S');
|
||||
dialog::add_action([] () { rug_forward = 2 * M_PI; popScreen(); });
|
||||
dialog::add_action([] () { rug_forward = TAU; popScreen(); });
|
||||
}
|
||||
rug_angle_options();
|
||||
};
|
||||
@ -1967,7 +1967,7 @@ startanim rug { "Hypersian Rug", [] {
|
||||
startanim spin_around { "spinning around", no_init, [] {
|
||||
dynamicval<ld> da(pconf.alpha, 999);
|
||||
dynamicval<ld> ds(pconf.scale, 500);
|
||||
ld alpha = 2 * M_PI * ticks / 10000.;
|
||||
ld alpha = TAU * ticks / 10000.;
|
||||
ld circle_radius = acosh(2.);
|
||||
dynamicval<transmatrix> dv(View, spin(-cos_auto(circle_radius)*alpha) * xpush(circle_radius) * spin(alpha) * View);
|
||||
gamescreen();
|
||||
@ -1996,7 +1996,7 @@ startanim row_of_ghosts { "row of ghosts", no_init, [] {
|
||||
for(int x=-25; x<=25; x++)
|
||||
for(int y=-25; y<=25; y++) {
|
||||
ld ay = (y + mod)/5.;
|
||||
draw_ghost(xpush(x/5.) * spin(M_PI/2) * xpush(ay), int(y-t));
|
||||
draw_ghost(xpush(x/5.) * spin90() * xpush(ay), int(y-t));
|
||||
}
|
||||
});
|
||||
dynamicval<bool> rd(mapeditor::drawplayer, false);
|
||||
@ -2011,15 +2011,15 @@ startanim army_of_ghosts { "army of ghosts", no_init, [] {
|
||||
ld mod = (tt-t*400)/400.;
|
||||
for(int x=-12; x<=12; x++) {
|
||||
ld ax = x/4.;
|
||||
transmatrix T = spin(-M_PI/2) * xpush(ax) * spin(M_PI/2);
|
||||
transmatrix T = spin270() * xpush(ax) * spin90();
|
||||
for(int y=0;; y++) {
|
||||
ld ay = (mod - y)/4.;
|
||||
transmatrix U = spin(M_PI/2) * xpush(ay / cosh(ax)) * T;
|
||||
transmatrix U = spin90() * xpush(ay / cosh(ax)) * T;
|
||||
if(!in_smart_range(shiftless(U))) break;
|
||||
draw_ghost(U, (-y - t));
|
||||
if(y) {
|
||||
ay = (mod + y)/4.;
|
||||
transmatrix U = spin(M_PI/2) * xpush(ay / cosh(ax)) * T;
|
||||
transmatrix U = spin90() * xpush(ay / cosh(ax)) * T;
|
||||
draw_ghost(U, (y - t));
|
||||
}
|
||||
}
|
||||
@ -2032,7 +2032,7 @@ startanim ghost_spiral { "ghost spiral", no_init, [] {
|
||||
dynamicval<reaction_t> r(add_to_frame, [] {
|
||||
ld t = (ticks - ticks_start - 2000) / 150000.;
|
||||
for(ld i=3; i<=40; i++) {
|
||||
draw_ghost(spin(t * i * 2 * M_PI) * xpush(asinh(15. / i)) * spin(M_PI/2), 1);
|
||||
draw_ghost(spin(t * i * TAU) * xpush(asinh(15. / i)) * spin90(), 1);
|
||||
}
|
||||
});
|
||||
gamescreen();
|
||||
@ -2043,12 +2043,12 @@ startanim fib_ghosts { "Fibonacci ghosts", no_init, [] {
|
||||
dynamicval<reaction_t> r(add_to_frame, [] {
|
||||
ld phase = (ticks - ticks_start - 2000) / 1000.;
|
||||
for(int i=0; i<=500; i++) {
|
||||
ld step = M_PI * (3 - sqrt(5));
|
||||
ld step = A_PI * (3 - sqrt(5));
|
||||
ld density = 0.01;
|
||||
ld area = 1 + (i+.5) * density;
|
||||
ld r = acosh(area);
|
||||
ld length = sinh(r);
|
||||
transmatrix T = spin(i * step + phase / length) * xpush(r) * spin(M_PI/2);
|
||||
transmatrix T = spin(i * step + phase / length) * xpush(r) * spin90();
|
||||
draw_ghost(T, i);
|
||||
}
|
||||
});
|
||||
|
@ -798,7 +798,7 @@ void display_data::set_projection(int ed, ld shift) {
|
||||
glhr::projection_multiply(model_orientation_gl());
|
||||
|
||||
if(selected->shader_flags & SF_BAND)
|
||||
glhr::projection_multiply(glhr::scale(2 / M_PI, 2 / M_PI, GDIM == 3 ? 2/M_PI : 1));
|
||||
glhr::projection_multiply(glhr::scale(1 / 90._deg, 1 / 90._deg, GDIM == 3 ? 1/90._deg : 1));
|
||||
|
||||
if(selected->shader_flags & SF_BAND) {
|
||||
glhr::projection_multiply(glhr::translate(shift, 0, 0));
|
||||
|
31
shmup.cpp
31
shmup.cpp
@ -440,7 +440,7 @@ void shootBullet(monster *m) {
|
||||
for(int i=1; i<8; i++) if(markOrb(orbdir[i])) {
|
||||
monster* bullet = new monster;
|
||||
bullet->base = m->base;
|
||||
bullet->at = m->at * cspin(0, WDIM-1, M_PI/4*i);
|
||||
bullet->at = m->at * cspin(0, WDIM-1, TAU * i/8);
|
||||
if(prod) bullet->ori = m->ori;
|
||||
if(WDIM == 3) bullet->at = bullet->at * cpush(2, 0.15 * SCALE);
|
||||
bullet->type = moBullet;
|
||||
@ -448,7 +448,7 @@ void shootBullet(monster *m) {
|
||||
bullet->pid = m->pid;
|
||||
bullet->hitpoints = 0;
|
||||
bullet->fragoff = ticks + bullet_time;
|
||||
bullet->inertia = cspin(0, WDIM-1, -M_PI/4 * i) * m->inertia;
|
||||
bullet->inertia = cspin(0, WDIM-1, -TAU * i/8) * m->inertia;
|
||||
bullet->inertia[frontdir()] += bullet_velocity(m->type) * SCALE;
|
||||
additional.push_back(bullet);
|
||||
}
|
||||
@ -635,10 +635,10 @@ shiftpoint hornpos(int id) {
|
||||
#define IGO 9
|
||||
|
||||
double igospan[IGO+1] = { 0,
|
||||
M_PI/6, -M_PI/6,
|
||||
M_PI/4, -M_PI/4,
|
||||
M_PI/3, -M_PI/3,
|
||||
M_PI/2.1, -M_PI/2.1,
|
||||
A_PI/6, -A_PI/6,
|
||||
A_PI/4, -A_PI/4,
|
||||
A_PI/3, -A_PI/3,
|
||||
A_PI/2.1, -A_PI/2.1,
|
||||
0
|
||||
};
|
||||
|
||||
@ -1527,7 +1527,7 @@ void destroyMimics() {
|
||||
EX void teleported() {
|
||||
monster *m = pc[cpid];
|
||||
m->base = cwt.at;
|
||||
m->at = rgpushxto0(inverse_shift(gmatrix[cwt.at], mouseh)) * spin(rand() % 1000 * M_PI / 2000);
|
||||
m->at = rgpushxto0(inverse_shift(gmatrix[cwt.at], mouseh)) * random_spin();
|
||||
m->findpat();
|
||||
destroyMimics();
|
||||
}
|
||||
@ -2161,9 +2161,9 @@ void moveMonster(monster *m, int delta) {
|
||||
if(m->type == moHedge) {
|
||||
hyperpoint h = inverse_shift(m->pat, tC0(goal));
|
||||
if(h[1] < 0)
|
||||
nat = nat * spin(M_PI * delta / 3000 / speedfactor());
|
||||
nat = nat * spin(A_PI * delta / 3000 / speedfactor());
|
||||
else
|
||||
nat = nat * spin(M_PI * -delta / 3000 / speedfactor());
|
||||
nat = nat * spin(A_PI * -delta / 3000 / speedfactor());
|
||||
m->rebasePat(nat, m->base);
|
||||
// at most 45 degrees
|
||||
if(h[0] < fabsl(h[1])) return;
|
||||
@ -2832,7 +2832,7 @@ EX void recall() {
|
||||
if(players == 1)
|
||||
pc[i]->at = Id;
|
||||
else
|
||||
pc[i]->at = spin(2*M_PI*i/players) * xpush(firstland == laMotion ? .5 : .3) * Id;
|
||||
pc[i]->at = spin(TAU*i/players) * xpush(firstland == laMotion ? .5 : .3) * Id;
|
||||
/* ggmatrix(cwt.at);
|
||||
display(gmatrix[cwt.at]);
|
||||
pc[i]->findpat(); */
|
||||
@ -2851,7 +2851,7 @@ EX void init() {
|
||||
if(players == 1)
|
||||
pc[i]->at = Id;
|
||||
else
|
||||
pc[i]->at = spin(2*M_PI*i/players) * xpush(firstland == laMotion ? .5 : .3) * Id;
|
||||
pc[i]->at = spin(TAU*i/players) * xpush(firstland == laMotion ? .5 : .3) * Id;
|
||||
pc[i]->pat = shiftless(pc[i]->at);
|
||||
pc[i]->base = cwt.at;
|
||||
pc[i]->vel = 0;
|
||||
@ -3013,7 +3013,7 @@ bool celldrawer::draw_shmup_monster() {
|
||||
if(m->inBoat) {
|
||||
view = m->pat;
|
||||
if(WDIM == 2) Vboat = view;
|
||||
if(WDIM == 3) Vboat = view * spin(-M_PI/2);
|
||||
if(WDIM == 3) Vboat = view * spin270();
|
||||
|
||||
bool magic = m->type == moPlayer && items[itOrbWater];
|
||||
color_t outcolor = magic ? watercolor(0) : 0xC06000FF;
|
||||
@ -3056,7 +3056,7 @@ bool celldrawer::draw_shmup_monster() {
|
||||
view = view * spin(-atan2(h[1], h[0]));
|
||||
}
|
||||
else {
|
||||
view = view * spin(-M_PI/2) * cspin(0, 2, -M_PI/2);
|
||||
view = view * spin270() * cspin90(2, 0);
|
||||
}
|
||||
}
|
||||
if(m->inBoat) m->footphase = 0;
|
||||
@ -3167,11 +3167,6 @@ bool celldrawer::draw_shmup_monster() {
|
||||
if(hasHitpoints(m->type))
|
||||
c->hitpoints = m->hitpoints;
|
||||
if(m->type == moTortoise) tortoise::emap[c] = getBits(m->torigin) & ((1<<tortoise::numbits)-1);
|
||||
/* if(m->type == moMimic && GDIM == 3)
|
||||
drawMonsterType(m->type, c, view * spin(-M_PI/2), col, m->footphase); */
|
||||
/* else if(GDIM == 3)
|
||||
drawMonsterType(m->type, c, view * cspin(0, 2, M_PI/2), col, m->footphase); */
|
||||
/* else */
|
||||
drawMonsterType(m->type, c, view, col, m->footphase, col);
|
||||
if(m->type == moTortoise) tortoise::emap.erase(c);
|
||||
break;
|
||||
|
30
surface.cpp
30
surface.cpp
@ -72,7 +72,7 @@ hyperpoint coord(hyperpoint h) {
|
||||
}
|
||||
|
||||
case dsDini: {
|
||||
ld t = h[0]; // atan(h[0])/2 + M_PI * 3/ 4;
|
||||
ld t = h[0];
|
||||
ld v = h[1];
|
||||
|
||||
ld a = sqrt(1-dini_b*dini_b);
|
||||
@ -166,11 +166,11 @@ ld compute_curvature(hyperpoint at) {
|
||||
hyperpoint shape_origin() {
|
||||
switch(sh) {
|
||||
case dsDini:
|
||||
return point31(M_PI * .82, 0, 0);
|
||||
return point31(A_PI * .82, 0, 0);
|
||||
case dsTractricoid:
|
||||
return point31(1, 0, 0);
|
||||
case dsKuen:
|
||||
return point31(M_PI * .500001, M_PI * 1, 0);
|
||||
return point31(90._deg * 1.000001, M_PI, 0);
|
||||
case dsHyperlike:
|
||||
return point31(0,0,0);
|
||||
default:
|
||||
@ -206,13 +206,13 @@ int surface_branch(hyperpoint p) {
|
||||
bool inbound(ld& x, ld& y) {
|
||||
switch(sh) {
|
||||
case dsDini:
|
||||
return flag_clamp(x, M_PI/2, M_PI);
|
||||
return flag_clamp(x, 90._deg, M_PI);
|
||||
|
||||
case dsTractricoid:
|
||||
return flag_clamp_min(x, 0) & flag_clamp_sym(y, M_PI);
|
||||
|
||||
case dsKuen:
|
||||
return flag_clamp(x, 0, M_PI) & flag_clamp(y, 0, 2*M_PI);
|
||||
return flag_clamp(x, 0, M_PI) & flag_clamp(y, 0, TAU);
|
||||
|
||||
case dsHyperlike:
|
||||
return flag_clamp_sym(x, M_PI) & flag_clamp_sym(y, hyperlike_bound());
|
||||
@ -351,7 +351,7 @@ ld kuen_hypot(ld v, ld u) {
|
||||
}
|
||||
|
||||
int kuen_branch(ld v, ld u) {
|
||||
if(v > M_PI/2)
|
||||
if(v > 90._deg)
|
||||
return kuen_cross(v, u)[2] > 0 ? 1 : 2;
|
||||
else
|
||||
return kuen_cross(v, u)[2] < 0 ? 1 : 2;
|
||||
@ -380,7 +380,7 @@ void draw_kuen_map() {
|
||||
for(int r=0; r<512; r++)
|
||||
for(int h=0; h<512; h++) {
|
||||
ld v = M_PI * (r+.5) / 512;
|
||||
ld u = 2 * M_PI * (h+.5) / 512;
|
||||
ld u = TAU * (h+.5) / 512;
|
||||
auto du = coord_derivative(point3(v,u,0), 0);
|
||||
auto dv = coord_derivative(point3(v,u,0), 1);
|
||||
auto n = hypot_d(3, du^dv);
|
||||
@ -401,7 +401,7 @@ void draw_kuen_map() {
|
||||
for(auto p: rug::points) {
|
||||
auto hp = p->surface_point.params;
|
||||
int x = int(512 * hp[0] / M_PI);
|
||||
int y = int(512 * hp[1] / 2 / M_PI);
|
||||
int y = int(512 * hp[1] / TAU);
|
||||
qpixel(kuen_map, x, y) = 0xFF000000 | dexp_colors[p->dexp_id];
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ void run_hyperlike() {
|
||||
int lim = (int) sqrt(rug::vertex_limit);
|
||||
for(int r=0; r<lim; r++)
|
||||
for(int h=0; h<lim; h++)
|
||||
rug::addRugpoint(shiftless(xpush(2 * M_PI * hyper_b * (2*r-lim) / lim) * ypush(hyperlike_bound() * (2*h-lim) / lim) * C0), -1);
|
||||
rug::addRugpoint(shiftless(xpush(TAU * hyper_b * (2*r-lim) / lim) * ypush(hyperlike_bound() * (2*h-lim) / lim) * C0), -1);
|
||||
for(int r=0; r<lim-1; r++)
|
||||
for(int h=0; h<lim-1; h++) {
|
||||
addTriangle(rug::points[lim*r+h], rug::points[lim*r+h+1], rug::points[lim*r+h+lim]);
|
||||
@ -464,13 +464,13 @@ void run_hyperlike() {
|
||||
void run_kuen() {
|
||||
full_mesh();
|
||||
|
||||
auto H = Id; // spin(-M_PI / 4) * xpush(2);
|
||||
auto H = Id;
|
||||
auto Hi = inverse(H);
|
||||
|
||||
auto frontal_map = at_zero(hpxyz(M_PI * .500001, M_PI * 1, 0), Id);
|
||||
auto back0 = at_zero(hpxyz(M_PI * .500001, .67, 0), H);
|
||||
auto back1 = at_other(back0, Hi * spin(-M_PI/2) * hpxy(0.511, -0.5323));
|
||||
auto back2 = at_other(back0, Hi * spin(-M_PI/2) * hpxy(0.511, 0.5323));
|
||||
auto frontal_map = at_zero(hpxyz(90._deg * 1.000001, M_PI * 1, 0), Id);
|
||||
auto back0 = at_zero(hpxyz(90._deg * 1.000001, .67, 0), H);
|
||||
auto back1 = at_other(back0, Hi * spin(-90._deg) * hpxy(0.511, -0.5323));
|
||||
auto back2 = at_other(back0, Hi * spin(-90._deg) * hpxy(0.511, 0.5323));
|
||||
|
||||
frontal_map.H = frontal_map.H * ypush(2.6);
|
||||
back0.H = back0.H * ypush(.4);
|
||||
@ -566,7 +566,7 @@ template<class T> void run_function(T f) {
|
||||
|
||||
void run_other() {
|
||||
full_mesh();
|
||||
auto dp = at_zero(shape_origin(), spin(M_PI/2));
|
||||
auto dp = at_zero(shape_origin(), spin(90._deg));
|
||||
|
||||
int it = 0;
|
||||
for(auto p: rug::points) {
|
||||
|
@ -756,7 +756,7 @@ struct magic_param {
|
||||
void shuffle() {
|
||||
do_spin = hrand(2);
|
||||
spinangle = hrandf() - hrandf();
|
||||
moveangle = hrandf() * 2 * M_PI;
|
||||
moveangle = hrandf() * TAU;
|
||||
shift = hrandf() - hrandf();
|
||||
scale = hrandf() - hrandf();
|
||||
proj = hrandf() - hrandf();
|
||||
@ -1565,7 +1565,7 @@ void splitseg(const shiftmatrix& A, const array<ld, 2>& angles, const array<shif
|
||||
void fillcircle(shiftpoint h, color_t col) {
|
||||
shiftmatrix A = rgpushxto0(h);
|
||||
|
||||
ld step = M_PI * 2/3;
|
||||
ld step = 120._deg;
|
||||
|
||||
array<shiftpoint, 3> mh = make_array(A * xpush0(mapeditor::dtwidth), A * xspinpush0(step, mapeditor::dtwidth), A * xspinpush0(-step, mapeditor::dtwidth));
|
||||
auto mp = ptc(mh);
|
||||
@ -1588,9 +1588,9 @@ void actDrawPixel(cell *c, shiftpoint h, color_t col) {
|
||||
hyperpoint h1 = inverse_shift(M * applyPatterndir(c, si), h);
|
||||
auto& tinf = config.texture_map[si.id];
|
||||
for(auto& M2: tinf.matrices) for(int i = 0; i<c->type; i += si.symmetries) {
|
||||
fillcircle(M2 * spin(2 * M_PI * i / c->type) * h1, col);
|
||||
fillcircle(M2 * spin(TAU * i / c->type) * h1, col);
|
||||
if(texturesym)
|
||||
fillcircle(M2 * spin(2 * M_PI * i / c->type) * Mirror * h1, col);
|
||||
fillcircle(M2 * spin(TAU * i / c->type) * Mirror * h1, col);
|
||||
}
|
||||
}
|
||||
catch(out_of_range&) {}
|
||||
|
@ -45,13 +45,13 @@ void geometry_information::pushShape(usershapelayer& ds) {
|
||||
|
||||
for(int r=0; r<ds.rots; r++) {
|
||||
for(int i=0; i<isize(ds.list)/z*z; i++)
|
||||
hpcpush(T * spin(2*M_PI*r/ds.rots) * ds.list[i]);
|
||||
hpcpush(T * spin(TAU*r/ds.rots) * ds.list[i]);
|
||||
|
||||
if(ds.sym) {
|
||||
|
||||
transmatrix mirrortrans = Id; mirrortrans[1][1] = -1;
|
||||
for(int i=isize(ds.list)-1; i>=0; i--)
|
||||
hpcpush(T * spin(2*M_PI*r/ds.rots) * mirrortrans * ds.list[i]);
|
||||
hpcpush(T * spin(TAU*r/ds.rots) * mirrortrans * ds.list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
7
util.cpp
7
util.cpp
@ -230,7 +230,7 @@ cld exp_parser::parse(int prio) {
|
||||
force_eat(",");
|
||||
ld b = rparse(0);
|
||||
force_eat(")");
|
||||
res = edge_of_triangle_with_angles(2*M_PI/a, M_PI/b, M_PI/b);
|
||||
res = edge_of_triangle_with_angles(TAU/a, M_PI/b, M_PI/b);
|
||||
}
|
||||
else if(eat("edge_angles(")) {
|
||||
cld a = rparse(0);
|
||||
@ -253,7 +253,7 @@ cld exp_parser::parse(int prio) {
|
||||
force_eat(",");
|
||||
ld b = rparse(0);
|
||||
force_eat(")");
|
||||
res = edge_of_triangle_with_angles(M_PI/2, M_PI/a, M_PI/b);
|
||||
res = edge_of_triangle_with_angles(90._deg, M_PI/a, M_PI/b);
|
||||
}
|
||||
#if CAP_ARCM
|
||||
else if(eat("arcmedge(")) {
|
||||
@ -307,8 +307,7 @@ cld exp_parser::parse(int prio) {
|
||||
hyperpoint h = xpush(c) * spin(M_PI - 2*alpha) * xpush0(c);
|
||||
ld result = 2 * atan2(h);
|
||||
if(result < 0) result = -result;
|
||||
while(result > 2 * M_PI) result -= 2 * M_PI;
|
||||
if(result > M_PI) result = 2 * M_PI - result;
|
||||
cyclefix(result, 0);
|
||||
res = result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user