diff --git a/HISTORY.md b/HISTORY.md index a02790a2..830683c6 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ * raycasting: new "ray length" option in the "relation TO object" primitive * hyperdyadic MIN and MAX primitives reachable via "relabel" * hyperdyadic less / great than or equals primitives reachable via "relabel" + * hyperdyadic ATAN2 primitive reachable via "relabel" * new SIGN function in arithmetic dropdown * **Notable Changes:** * searching for blocks and keyboard entry now includes the contents of dropdown menus @@ -23,6 +24,7 @@ ### 2020-12-09 * Tamil translation update, thanks, Barthdry! +* threads, objects: added hyperdyadic ATAN2 primitive reachable via "relabel" ### 2020-12-07 * GUI: improved SVG loading, thanks, Joan! diff --git a/snap.html b/snap.html index adf915c6..8da4dddf 100755 --- a/snap.html +++ b/snap.html @@ -9,8 +9,8 @@ - - + + diff --git a/src/objects.js b/src/objects.js index 6f918fd4..6460b89d 100644 --- a/src/objects.js +++ b/src/objects.js @@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph, localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph, AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/ -modules.objects = '2020-December-07'; +modules.objects = '2020-December-09'; var SpriteMorph; var StageMorph; @@ -1106,6 +1106,11 @@ SpriteMorph.prototype.initBlocks = function () { category: 'operators', spec: '%n mod %n' }, + reportAtan2: { + type: 'reporter', + category: 'operators', + spec: 'atan2 %n รท %n' + }, reportMin: { type: 'reporter', category: 'operators', @@ -1649,21 +1654,28 @@ SpriteMorph.prototype.blockAlternatives = { // operators: reportSum: ['reportDifference', 'reportProduct', 'reportQuotient', - 'reportPower', 'reportModulus', 'reportMin', 'reportMax'], + 'reportPower', 'reportModulus', 'reportAtan2', 'reportMin', + 'reportMax'], reportDifference: ['reportSum', 'reportProduct', 'reportQuotient', - 'reportPower', 'reportModulus', 'reportMin', 'reportMax'], + 'reportPower', 'reportModulus', 'reportAtan2', 'reportMin', + 'reportMax'], reportProduct: ['reportDifference', 'reportSum', 'reportQuotient', - 'reportPower', 'reportModulus', 'reportMin', 'reportMax'], + 'reportPower', 'reportModulus', 'reportAtan2', 'reportMin', + 'reportMax'], reportQuotient: ['reportDifference', 'reportProduct', 'reportSum', - 'reportPower', 'reportModulus', 'reportMin', 'reportMax'], + 'reportPower', 'reportModulus', 'reportAtan2', 'reportMin', + 'reportMax'], reportPower: ['reportDifference', 'reportProduct', 'reportSum', - 'reportQuotient', 'reportModulus', 'reportMin', 'reportMax'], - reportModulus: ['reportDifference', 'reportProduct', 'reportSum', - 'reportQuotient', 'reportPower', 'reportMin', 'reportMax'], - reportMin: ['reportSum', 'reportDifference', 'reportProduct', - 'reportQuotient', 'reportPower', 'reportModulus', 'reportMax'], - reportMax: ['reportSum', 'reportDifference', 'reportProduct', - 'reportQuotient', 'reportPower', 'reportModulus', 'reportMin'], + 'reportQuotient', 'reportModulus', 'reportAtan2', 'reportMin', + 'reportMax'], + reportModulus: ['reportAtan2', 'reportDifference', 'reportProduct', + 'reportSum','reportQuotient', 'reportPower', 'reportMin', 'reportMax'], + reportAtan2: ['reportModulus', 'reportDifference', 'reportProduct', + 'reportSum','reportQuotient', 'reportPower', 'reportMin', 'reportMax'], + reportMin: ['reportMax', 'reportSum', 'reportDifference', 'reportProduct', + 'reportQuotient', 'reportPower', 'reportModulus', 'reportAtan2'], + reportMax: ['reportMin', 'reportSum', 'reportDifference', 'reportProduct', + 'reportQuotient', 'reportPower', 'reportModulus', 'reportAtan2'], reportLessThan: ['reportLessThanOrEquals', 'reportEquals', 'reportGreaterThan', 'reportGreaterThanOrEquals'], reportEquals: ['reportLessThan', 'reportLessThanOrEquals', diff --git a/src/threads.js b/src/threads.js index 122b57cd..2ee24774 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-December-07'; +modules.threads = '2020-December-09'; var ThreadManager; var Process; @@ -3721,6 +3721,14 @@ Process.prototype.reportBasicModulus = function (a, b) { return ((x % y) + y) % y; }; +Process.prototype.reportAtan2 = function (a, b) { + return this.hyperDyadic(this.reportBasicAtan2, a, b); +}; + +Process.prototype.reportBasicAtan2 = function (a, b) { + return degrees(Math.atan2(+a, +b)); +}; + Process.prototype.reportMin = function (a, b) { return this.hyperDyadic(this.reportBasicMin, a, b); };