//* comment *// Copyright (C) 2015 Sam Parkinson This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . //* arg-globals *// var block = logo.blocks.blockList[blk]; var conns = block.connections; //* block-globals *// var simpleOneArgBlock = function (name, label) { if (label === undefined) { var label = name; } var block = new ProtoBlock(name); block.palette = palettes.dict['maths']; blocks.protoBlockDict[name] = block; block.staticLabels.push(label); block.adjustWidthToLabel(); block.oneArgMathBlock(); block.defaults.push(1); }; var staticBlock = function (name, label) { var block = new ProtoBlock(name); block.palette = palettes.dict['maths']; blocks.protoBlockDict[name] = block; block.staticLabels.push(label); block.adjustWidthToLabel(); block.parameterBlock(); }; //* block:power *// var block = new ProtoBlock('power'); block.palette = palettes.dict['maths']; blocks.protoBlockDict['power'] = block; block.staticLabels.push(_('power'), _('base'), _('exp')); block.twoArgMathBlock(); block.defaults.push(10, 2); //* arg:power *// var base = logo.parseArg(logo, turtle, conns[1]); var exp = logo.parseArg(logo, turtle, conns[2]); block.value = Math.pow(base, exp); //* block:sin *// simpleOneArgBlock('sin'); //* arg:sin *// block.value = Math.sin(logo.parseArg(logo, turtle, conns[1])); //* block:cos *// simpleOneArgBlock('cos'); //* arg:cos *// block.value = Math.cos(logo.parseArg(logo, turtle, conns[1])); //* block:tan *// simpleOneArgBlock('tan'); //* arg:sin *// block.value = Math.tan(logo.parseArg(logo, turtle, conns[1])); //* block:asin *// simpleOneArgBlock('asin'); //* arg:asin *// block.value = Math.asin(logo.parseArg(logo, turtle, conns[1])); //* block:acos *// simpleOneArgBlock('acos'); //* arg:acos *// block.value = Math.acos(logo.parseArg(logo, turtle, conns[1])); //* block:atan *// simpleOneArgBlock('atan'); //* arg:atan *// block.value = Math.atan(logo.parseArg(logo, turtle, conns[1])); //* block:floor *// simpleOneArgBlock(_('floor')); //* arg:floor *// block.value = Math.floor(logo.parseArg(logo, turtle, conns[1])); //* block:ceiling *// simpleOneArgBlock(_('ceiling')); //* arg:ceiling *// block.value = Math.ceil(logo.parseArg(logo, turtle, conns[1])); //* block:degrees *// simpleOneArgBlock(_('degrees'), _('to degrees')); //* arg:degrees *// block.value = logo.parseArg(logo, turtle, conns[1]) * (180/Math.PI); //* block:radians *// simpleOneArgBlock(_('radians'), _('to radians')); //* arg:radians *// block.value = logo.parseArg(logo, turtle, conns[1]) * (Math.PI/180); //* block:pi *// staticBlock('pi', 'π'); //* arg:pi *// block.value = Math.PI; //* block:e *// staticBlock('e', 'e'); //* arg:e *// block.value = Math.E; //* palette-icon:maths *// image/svg+xml //* palette-fill:maths *// #ff0066 //* palette-stroke:maths *// #ef003e //* palette-highlight:maths *// #ffb1b3 //* palette-stroke-highlight:maths *// #000000