1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #16096 from bungeman/fix_trig_functions

Correct PostScript trigonometric operators
This commit is contained in:
calixteman 2023-03-11 14:32:23 +01:00 committed by GitHub
commit b2a86350fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 11 deletions

View file

@ -628,8 +628,13 @@ class PostScriptEvaluator {
}
break;
case "atan":
b = stack.pop();
a = stack.pop();
stack.push(Math.atan(a));
a = (Math.atan2(a, b) / Math.PI) * 180;
if (a < 0) {
a += 360;
}
stack.push(a);
break;
case "bitshift":
b = stack.pop();
@ -650,7 +655,7 @@ class PostScriptEvaluator {
break;
case "cos":
a = stack.pop();
stack.push(Math.cos(a));
stack.push(Math.cos(((a % 360) / 180) * Math.PI));
break;
case "cvi":
a = stack.pop() | 0;
@ -774,7 +779,7 @@ class PostScriptEvaluator {
break;
case "sin":
a = stack.pop();
stack.push(Math.sin(a));
stack.push(Math.sin(((a % 360) / 180) * Math.PI));
break;
case "sqrt":
a = stack.pop();