diff options
Diffstat (limited to 'Build/source/utils/asymptote/runpair.cc')
-rw-r--r-- | Build/source/utils/asymptote/runpair.cc | 172 |
1 files changed, 85 insertions, 87 deletions
diff --git a/Build/source/utils/asymptote/runpair.cc b/Build/source/utils/asymptote/runpair.cc index b4e8637f371..e5c0b4e6a67 100644 --- a/Build/source/utils/asymptote/runpair.cc +++ b/Build/source/utils/asymptote/runpair.cc @@ -184,58 +184,56 @@ void gen_runpair8(stack *Stack) bool warn=vm::pop<bool>(Stack,true); pair z=vm::pop<pair>(Stack); #line 91 "runpair.in" - if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;} - {Stack->push<real>(z.angle()); return;} + {Stack->push<real>(z.angle(warn)); return;} } // Return the angle of z in degrees in the interval [0,360). -#line 97 "runpair.in" +#line 96 "runpair.in" // real degrees(pair z, bool warn=true); void gen_runpair9(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); pair z=vm::pop<pair>(Stack); -#line 98 "runpair.in" - if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;} - {Stack->push<real>(principalBranch(degrees(z.angle()))); return;} +#line 97 "runpair.in" + {Stack->push<real>(principalBranch(degrees(z.angle(warn)))); return;} } // Convert degrees to radians. -#line 104 "runpair.in" +#line 102 "runpair.in" // real radians(real degrees); void gen_runpair10(stack *Stack) { real degrees=vm::pop<real>(Stack); -#line 105 "runpair.in" +#line 103 "runpair.in" {Stack->push<real>(radians(degrees)); return;} } // Convert radians to degrees. -#line 110 "runpair.in" +#line 108 "runpair.in" // real degrees(real radians); void gen_runpair11(stack *Stack) { real radians=vm::pop<real>(Stack); -#line 111 "runpair.in" +#line 109 "runpair.in" {Stack->push<real>(degrees(radians)); return;} } // Convert radians to degrees in [0,360). -#line 116 "runpair.in" +#line 114 "runpair.in" // real Degrees(real radians); void gen_runpair12(stack *Stack) { real radians=vm::pop<real>(Stack); -#line 117 "runpair.in" +#line 115 "runpair.in" {Stack->push<real>(principalBranch(degrees(radians))); return;} } -#line 121 "runpair.in" +#line 119 "runpair.in" // real Sin(real deg); void gen_runpair13(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 122 "runpair.in" +#line 120 "runpair.in" int n=(int) (deg/90.0); if(deg == n*90.0) { int m=n % 4; @@ -247,12 +245,12 @@ void gen_runpair13(stack *Stack) {Stack->push<real>(sin(radians(deg))); return;} } -#line 134 "runpair.in" +#line 132 "runpair.in" // real Cos(real deg); void gen_runpair14(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 135 "runpair.in" +#line 133 "runpair.in" int n=(int) (deg/90.0); if(deg == n*90.0) { int m=n % 4; @@ -264,12 +262,12 @@ void gen_runpair14(stack *Stack) {Stack->push<real>(cos(radians(deg))); return;} } -#line 147 "runpair.in" +#line 145 "runpair.in" // real Tan(real deg); void gen_runpair15(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 148 "runpair.in" +#line 146 "runpair.in" int n=(int) (deg/90.0); if(deg == n*90.0) { int m=n % 4; @@ -281,157 +279,157 @@ void gen_runpair15(stack *Stack) {Stack->push<real>(tan(radians(deg))); return;} } -#line 160 "runpair.in" +#line 158 "runpair.in" // real aSin(real x); void gen_runpair16(stack *Stack) { real x=vm::pop<real>(Stack); -#line 161 "runpair.in" +#line 159 "runpair.in" {Stack->push<real>(degrees(asin(x))); return;} } -#line 165 "runpair.in" +#line 163 "runpair.in" // real aCos(real x); void gen_runpair17(stack *Stack) { real x=vm::pop<real>(Stack); -#line 166 "runpair.in" +#line 164 "runpair.in" {Stack->push<real>(degrees(acos(x))); return;} } -#line 170 "runpair.in" +#line 168 "runpair.in" // real aTan(real x); void gen_runpair18(stack *Stack) { real x=vm::pop<real>(Stack); -#line 171 "runpair.in" +#line 169 "runpair.in" {Stack->push<real>(degrees(atan(x))); return;} } -#line 175 "runpair.in" +#line 173 "runpair.in" // pair unit(pair z); void gen_runpair19(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 176 "runpair.in" +#line 174 "runpair.in" {Stack->push<pair>(unit(z)); return;} } -#line 180 "runpair.in" +#line 178 "runpair.in" // pair dir(real degrees); void gen_runpair20(stack *Stack) { real degrees=vm::pop<real>(Stack); -#line 181 "runpair.in" +#line 179 "runpair.in" {Stack->push<pair>(expi(radians(degrees))); return;} } -#line 185 "runpair.in" +#line 183 "runpair.in" // pair dir(explicit pair z); void gen_runpair21(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 186 "runpair.in" +#line 184 "runpair.in" {Stack->push<pair>(unit(z)); return;} } -#line 190 "runpair.in" +#line 188 "runpair.in" // pair expi(real angle); void gen_runpair22(stack *Stack) { real angle=vm::pop<real>(Stack); -#line 191 "runpair.in" +#line 189 "runpair.in" {Stack->push<pair>(expi(angle)); return;} } -#line 195 "runpair.in" +#line 193 "runpair.in" // pair exp(explicit pair z); void gen_runpair23(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 196 "runpair.in" +#line 194 "runpair.in" {Stack->push<pair>(exp(z)); return;} } -#line 200 "runpair.in" +#line 198 "runpair.in" // pair log(explicit pair z); void gen_runpair24(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 201 "runpair.in" +#line 199 "runpair.in" {Stack->push<pair>(pair(log(z.length()),z.angle())); return;} } -#line 205 "runpair.in" +#line 203 "runpair.in" // pair sin(explicit pair z); void gen_runpair25(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 206 "runpair.in" +#line 204 "runpair.in" {Stack->push<pair>(sin(z)); return;} } -#line 210 "runpair.in" +#line 208 "runpair.in" // pair cos(explicit pair z); void gen_runpair26(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 211 "runpair.in" +#line 209 "runpair.in" {Stack->push<pair>(pair(cos(z.getx())*cosh(z.gety()),-sin(z.getx())*sinh(z.gety()))); return;} } // Complex Gamma function -#line 216 "runpair.in" +#line 214 "runpair.in" // pair gamma(explicit pair z); void gen_runpair27(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 217 "runpair.in" +#line 215 "runpair.in" {Stack->push<pair>(gamma(z)); return;} } -#line 221 "runpair.in" +#line 219 "runpair.in" // pair conj(pair z); void gen_runpair28(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 222 "runpair.in" +#line 220 "runpair.in" {Stack->push<pair>(conj(z)); return;} } -#line 226 "runpair.in" +#line 224 "runpair.in" // pair realmult(pair z, pair w); void gen_runpair29(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 227 "runpair.in" +#line 225 "runpair.in" {Stack->push<pair>(pair(z.getx()*w.getx(),z.gety()*w.gety())); return;} } // To avoid confusion, a dot product requires explicit pair arguments. -#line 232 "runpair.in" +#line 230 "runpair.in" // real dot(explicit pair z, explicit pair w); void gen_runpair30(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 233 "runpair.in" +#line 231 "runpair.in" {Stack->push<real>(dot(z,w)); return;} } // Return the 2D scalar cross product z.x*w.y-z.y*w.x. -#line 238 "runpair.in" +#line 236 "runpair.in" // real cross(explicit pair z, explicit pair w); void gen_runpair31(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 239 "runpair.in" +#line 237 "runpair.in" {Stack->push<real>(cross(z,w)); return;} } -#line 243 "runpair.in" +#line 241 "runpair.in" // pair bezier(pair a, pair b, pair c, pair d, real t); void gen_runpair32(stack *Stack) { @@ -440,13 +438,13 @@ void gen_runpair32(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 244 "runpair.in" +#line 242 "runpair.in" real onemt=1-t; real onemt2=onemt*onemt; {Stack->push<pair>(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;} } -#line 250 "runpair.in" +#line 248 "runpair.in" // pair bezierP(pair a, pair b, pair c, pair d, real t); void gen_runpair33(stack *Stack) { @@ -455,11 +453,11 @@ void gen_runpair33(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 251 "runpair.in" +#line 249 "runpair.in" {Stack->push<pair>(3.0*(t*t*(d-a+3.0*(b-c))+t*(2.0*(a+c)-4.0*b)+b-a)); return;} } -#line 255 "runpair.in" +#line 253 "runpair.in" // pair bezierPP(pair a, pair b, pair c, pair d, real t); void gen_runpair34(stack *Stack) { @@ -468,11 +466,11 @@ void gen_runpair34(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 256 "runpair.in" - {Stack->push<pair>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;} +#line 254 "runpair.in" + {Stack->push<pair>(6.0*(t*(d-a+3.0*(b-c))+a+c)-12.0*b); return;} } -#line 260 "runpair.in" +#line 258 "runpair.in" // pair bezierPPP(pair a, pair b, pair c, pair d); void gen_runpair35(stack *Stack) { @@ -480,8 +478,8 @@ void gen_runpair35(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 261 "runpair.in" - {Stack->push<pair>(6.0*(d-a+3.0*(b-c))); return;} +#line 259 "runpair.in" + {Stack->push<pair>(6.0*(d-a)+18.0*(b-c)); return;} } } // namespace run @@ -508,59 +506,59 @@ void gen_runpair_venv(venv &ve) addFunc(ve, run::gen_runpair7, primPair(), SYM(sqrt), formal(primPair(), SYM(z), false, true)); #line 89 "runpair.in" addFunc(ve, run::gen_runpair8, primReal(), SYM(angle), formal(primPair(), SYM(z), false, false), formal(primBoolean(), SYM(warn), true, false)); -#line 96 "runpair.in" +#line 95 "runpair.in" addFunc(ve, run::gen_runpair9, primReal(), SYM(degrees), formal(primPair(), SYM(z), false, false), formal(primBoolean(), SYM(warn), true, false)); -#line 103 "runpair.in" +#line 101 "runpair.in" addFunc(ve, run::gen_runpair10, primReal(), SYM(radians), formal(primReal(), SYM(degrees), false, false)); -#line 109 "runpair.in" +#line 107 "runpair.in" addFunc(ve, run::gen_runpair11, primReal(), SYM(degrees), formal(primReal(), SYM(radians), false, false)); -#line 115 "runpair.in" +#line 113 "runpair.in" addFunc(ve, run::gen_runpair12, primReal(), SYM(Degrees), formal(primReal(), SYM(radians), false, false)); -#line 121 "runpair.in" +#line 119 "runpair.in" addFunc(ve, run::gen_runpair13, primReal(), SYM(Sin), formal(primReal(), SYM(deg), false, false)); -#line 134 "runpair.in" +#line 132 "runpair.in" addFunc(ve, run::gen_runpair14, primReal(), SYM(Cos), formal(primReal(), SYM(deg), false, false)); -#line 147 "runpair.in" +#line 145 "runpair.in" addFunc(ve, run::gen_runpair15, primReal(), SYM(Tan), formal(primReal(), SYM(deg), false, false)); -#line 160 "runpair.in" +#line 158 "runpair.in" addFunc(ve, run::gen_runpair16, primReal(), SYM(aSin), formal(primReal(), SYM(x), false, false)); -#line 165 "runpair.in" +#line 163 "runpair.in" addFunc(ve, run::gen_runpair17, primReal(), SYM(aCos), formal(primReal(), SYM(x), false, false)); -#line 170 "runpair.in" +#line 168 "runpair.in" addFunc(ve, run::gen_runpair18, primReal(), SYM(aTan), formal(primReal(), SYM(x), false, false)); -#line 175 "runpair.in" +#line 173 "runpair.in" addFunc(ve, run::gen_runpair19, primPair(), SYM(unit), formal(primPair(), SYM(z), false, false)); -#line 180 "runpair.in" +#line 178 "runpair.in" addFunc(ve, run::gen_runpair20, primPair(), SYM(dir), formal(primReal(), SYM(degrees), false, false)); -#line 185 "runpair.in" +#line 183 "runpair.in" addFunc(ve, run::gen_runpair21, primPair(), SYM(dir), formal(primPair(), SYM(z), false, true)); -#line 190 "runpair.in" +#line 188 "runpair.in" addFunc(ve, run::gen_runpair22, primPair(), SYM(expi), formal(primReal(), SYM(angle), false, false)); -#line 195 "runpair.in" +#line 193 "runpair.in" addFunc(ve, run::gen_runpair23, primPair(), SYM(exp), formal(primPair(), SYM(z), false, true)); -#line 200 "runpair.in" +#line 198 "runpair.in" addFunc(ve, run::gen_runpair24, primPair(), SYM(log), formal(primPair(), SYM(z), false, true)); -#line 205 "runpair.in" +#line 203 "runpair.in" addFunc(ve, run::gen_runpair25, primPair(), SYM(sin), formal(primPair(), SYM(z), false, true)); -#line 210 "runpair.in" +#line 208 "runpair.in" addFunc(ve, run::gen_runpair26, primPair(), SYM(cos), formal(primPair(), SYM(z), false, true)); -#line 215 "runpair.in" +#line 213 "runpair.in" addFunc(ve, run::gen_runpair27, primPair(), SYM(gamma), formal(primPair(), SYM(z), false, true)); -#line 221 "runpair.in" +#line 219 "runpair.in" addFunc(ve, run::gen_runpair28, primPair(), SYM(conj), formal(primPair(), SYM(z), false, false)); -#line 226 "runpair.in" +#line 224 "runpair.in" addFunc(ve, run::gen_runpair29, primPair(), SYM(realmult), formal(primPair(), SYM(z), false, false), formal(primPair(), SYM(w), false, false)); -#line 231 "runpair.in" +#line 229 "runpair.in" addFunc(ve, run::gen_runpair30, primReal(), SYM(dot), formal(primPair(), SYM(z), false, true), formal(primPair(), SYM(w), false, true)); -#line 237 "runpair.in" +#line 235 "runpair.in" addFunc(ve, run::gen_runpair31, primReal(), SYM(cross), formal(primPair(), SYM(z), false, true), formal(primPair(), SYM(w), false, true)); -#line 243 "runpair.in" +#line 241 "runpair.in" addFunc(ve, run::gen_runpair32, primPair(), SYM(bezier), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 250 "runpair.in" +#line 248 "runpair.in" addFunc(ve, run::gen_runpair33, primPair(), SYM(bezierP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 255 "runpair.in" +#line 253 "runpair.in" addFunc(ve, run::gen_runpair34, primPair(), SYM(bezierPP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 260 "runpair.in" +#line 258 "runpair.in" addFunc(ve, run::gen_runpair35, primPair(), SYM(bezierPPP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false)); } |