Add atan2, which was conspicuously absent, to the VM

- DECORATE now has atan2(y,x) and VectorAngle(x,y) functions. They are
  identical except for the order of their parameters. The returned angle
  is in degrees (not radians).
This commit is contained in:
Randy Heit 2016-04-18 23:06:17 -05:00
commit e83bc53678
6 changed files with 135 additions and 0 deletions

View file

@ -1039,6 +1039,11 @@ begin:
reg.f[a] = reg.f[B] > konstf[C] ? reg.f[B] : konstf[C];
NEXTOP;
OP(ATAN2):
ASSERTF(a); ASSERTF(B); ASSERTF(C);
reg.f[a] = g_atan2(reg.f[B], reg.f[C]) * (180 / M_PI);
NEXTOP;
OP(FLOP):
ASSERTF(a); ASSERTF(B);
fb = reg.f[B];

View file

@ -174,6 +174,7 @@ xx(MINF_RR, min, RFRFRF), // fA = min(fB),fkC)
xx(MINF_RK, min, RFRFKF),
xx(MAXF_RR, max, RFRFRF), // fA = max(fB),fkC)
xx(MAXF_RK, max, RFRFKF),
xx(ATAN2, atan2, RFRFRF), // fA = atan2(fB,fC), result is in degrees
xx(FLOP, flop, RFRFI8), // fA = f(fB), where function is selected by C
xx(EQF_R, beq, CFRR), // if ((fB == fkC) != (A & 1)) then pc++
xx(EQF_K, beq, CFRK),