UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

392 lines (391 loc) 12.2 kB
/* eslint-disable @typescript-eslint/no-namespace */ // tslint:disable-next-line: no-namespace export var Math; (function (Math) { let mathTwoNrOperatorEnum; (function (mathTwoNrOperatorEnum) { mathTwoNrOperatorEnum["add"] = "add"; mathTwoNrOperatorEnum["subtract"] = "subtract"; mathTwoNrOperatorEnum["multiply"] = "multiply"; mathTwoNrOperatorEnum["divide"] = "divide"; mathTwoNrOperatorEnum["power"] = "power"; mathTwoNrOperatorEnum["modulus"] = "modulus"; })(mathTwoNrOperatorEnum = Math.mathTwoNrOperatorEnum || (Math.mathTwoNrOperatorEnum = {})); let mathOneNrOperatorEnum; (function (mathOneNrOperatorEnum) { mathOneNrOperatorEnum["absolute"] = "absolute"; mathOneNrOperatorEnum["negate"] = "negate"; mathOneNrOperatorEnum["ln"] = "ln"; mathOneNrOperatorEnum["log10"] = "log10"; mathOneNrOperatorEnum["tenPow"] = "tenPow"; mathOneNrOperatorEnum["round"] = "round"; mathOneNrOperatorEnum["floor"] = "floor"; mathOneNrOperatorEnum["ceil"] = "ceil"; mathOneNrOperatorEnum["sqrt"] = "sqrt"; mathOneNrOperatorEnum["sin"] = "sin"; mathOneNrOperatorEnum["cos"] = "cos"; mathOneNrOperatorEnum["tan"] = "tan"; mathOneNrOperatorEnum["asin"] = "asin"; mathOneNrOperatorEnum["acos"] = "acos"; mathOneNrOperatorEnum["atan"] = "atan"; mathOneNrOperatorEnum["log"] = "log"; mathOneNrOperatorEnum["exp"] = "exp"; mathOneNrOperatorEnum["radToDeg"] = "radToDeg"; mathOneNrOperatorEnum["degToRad"] = "degToRad"; })(mathOneNrOperatorEnum = Math.mathOneNrOperatorEnum || (Math.mathOneNrOperatorEnum = {})); let easeEnum; (function (easeEnum) { easeEnum["easeInSine"] = "easeInSine"; easeEnum["easeOutSine"] = "easeOutSine"; easeEnum["easeInOutSine"] = "easeInOutSine"; easeEnum["easeInQuad"] = "easeInQuad"; easeEnum["easeOutQuad"] = "easeOutQuad"; easeEnum["easeInOutQuad"] = "easeInOutQuad"; easeEnum["easeInCubic"] = "easeInCubic"; easeEnum["easeOutCubic"] = "easeOutCubic"; easeEnum["easeInOutCubic"] = "easeInOutCubic"; easeEnum["easeInQuart"] = "easeInQuart"; easeEnum["easeOutQuart"] = "easeOutQuart"; easeEnum["easeInOutQuart"] = "easeInOutQuart"; easeEnum["easeInQuint"] = "easeInQuint"; easeEnum["easeOutQuint"] = "easeOutQuint"; easeEnum["easeInOutQuint"] = "easeInOutQuint"; easeEnum["easeInExpo"] = "easeInExpo"; easeEnum["easeOutExpo"] = "easeOutExpo"; easeEnum["easeInOutExpo"] = "easeInOutExpo"; easeEnum["easeInCirc"] = "easeInCirc"; easeEnum["easeOutCirc"] = "easeOutCirc"; easeEnum["easeInOutCirc"] = "easeInOutCirc"; easeEnum["easeInElastic"] = "easeInElastic"; easeEnum["easeOutElastic"] = "easeOutElastic"; easeEnum["easeInOutElastic"] = "easeInOutElastic"; easeEnum["easeInBack"] = "easeInBack"; easeEnum["easeOutBack"] = "easeOutBack"; easeEnum["easeInOutBack"] = "easeInOutBack"; easeEnum["easeInBounce"] = "easeInBounce"; easeEnum["easeOutBounce"] = "easeOutBounce"; easeEnum["easeInOutBounce"] = "easeInOutBounce"; })(easeEnum = Math.easeEnum || (Math.easeEnum = {})); class ModulusDto { constructor(number, modulus) { /** * Number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.number = 1; /** * Modulus * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.modulus = 2; if (number !== undefined) { this.number = number; } if (modulus !== undefined) { this.modulus = modulus; } } } Math.ModulusDto = ModulusDto; class NumberDto { constructor(number) { /** * Number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.number = 1; if (number !== undefined) { this.number = number; } } } Math.NumberDto = NumberDto; class EaseDto { constructor(x) { /** * X value param between 0-1 * @default 0.5 * @minimum 0 * @maximum 1 * @step 0.1 */ this.x = 0.5; /** * Minimum value * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.min = 0; /** * Maximum value * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.max = 1; if (x !== undefined) { this.x = x; } } } Math.EaseDto = EaseDto; class RoundToDecimalsDto { constructor(number, decimalPlaces) { /** * Number to round * @default 1.123456 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.number = 1.123456; /** * Number of decimal places * @default 2 * @minimum -Infinity * @maximum Infinity * @step 1 */ this.decimalPlaces = 2; if (number !== undefined) { this.number = number; } if (decimalPlaces !== undefined) { this.decimalPlaces = decimalPlaces; } } } Math.RoundToDecimalsDto = RoundToDecimalsDto; class ActionOnTwoNumbersDto { constructor(first, second, operation) { /** * First number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.first = 1; /** * Second number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.second = 1; if (first !== undefined) { this.first = first; } if (second !== undefined) { this.second = second; } if (operation !== undefined) { this.operation = operation; } } } Math.ActionOnTwoNumbersDto = ActionOnTwoNumbersDto; class TwoNumbersDto { constructor(first, second) { /** * First number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.first = 1; /** * Second number * @default 2 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.second = 2; if (first !== undefined) { this.first = first; } if (second !== undefined) { this.second = second; } } } Math.TwoNumbersDto = TwoNumbersDto; class ActionOnOneNumberDto { constructor(number, operation) { /** * First number * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.number = 1; if (number !== undefined) { this.number = number; } if (operation !== undefined) { this.operation = operation; } } } Math.ActionOnOneNumberDto = ActionOnOneNumberDto; class RemapNumberDto { constructor(number, fromLow, fromHigh, toLow, toHigh) { /** * Number to remap * @default 0.5 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.number = 0.5; /** * First number range min * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.fromLow = 0; /** * Map to range min * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.fromHigh = 1; /** * First number range max * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.toLow = 1; /** * Map to range max * @default 2 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.toHigh = 2; if (number !== undefined) { this.number = number; } if (fromLow !== undefined) { this.fromLow = fromLow; } if (fromHigh !== undefined) { this.fromHigh = fromHigh; } if (toLow !== undefined) { this.toLow = toLow; } if (toHigh !== undefined) { this.toHigh = toHigh; } } } Math.RemapNumberDto = RemapNumberDto; class RandomNumberDto { constructor(low, high) { /** * Low range of random value * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.low = 0; /** * High range of random value * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.high = 1; if (low !== undefined) { this.low = low; } if (high !== undefined) { this.high = high; } } } Math.RandomNumberDto = RandomNumberDto; class RandomNumbersDto { constructor(low, high, count) { /** * Low range of random value * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.low = 0; /** * High range of random value * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.high = 1; /** * Number of produced random values * @default 10 * @minimum -Infinity * @maximum Infinity * @step 1 */ this.count = 10; if (low !== undefined) { this.low = low; } if (high !== undefined) { this.high = high; } if (count !== undefined) { this.count = count; } } } Math.RandomNumbersDto = RandomNumbersDto; class ToFixedDto { constructor(number, decimalPlaces) { /** * Number of decimal places * @default 2 * @minimum -Infinity * @maximum Infinity * @step 1 */ this.decimalPlaces = 2; if (number !== undefined) { this.number = number; } if (decimalPlaces !== undefined) { this.decimalPlaces = decimalPlaces; } } } Math.ToFixedDto = ToFixedDto; })(Math || (Math = {}));