| Function Summary | |
angle(number x1, number y1, number x2, number y2) ⇒ numberComputes the angle between two points (x1,y1) and (x2,y2). Angle zero points in the +X direction, 90 degrees points in the +Y direction (down) and from there we grow clockwise towards 360 degrees. | |
angleDifference(number startAngle, number endAngle) ⇒ numberComputes the difference between startAngle and endAngle (angles in degrees). | |
angleDx(number degrees, number radius) ⇒ numberFor a given angle and radius, finds the X portion of the offset. | |
angleDy(number degrees, number radius) ⇒ numberFor a given angle and radius, finds the Y portion of the offset. | |
average((number|undefined) var_args) ⇒ numberReturns the arithmetic mean of the arguments. | |
clamp(number value, number min, number max) ⇒ numberTakes a number and clamps it to within the provided bounds. | |
isFiniteNumber(number num) ⇒ booleanReturns whether the supplied number is finite and not NaN. | |
isInt(number num) ⇒ booleanReturns whether the supplied number represents an integer, i.e. that is has no fractional component. No range-checking is performed on the number. | |
lerp(number a, number b, number x) ⇒ numberPerforms linear interpolation between values a and b. Returns the value between a and b proportional to x (when x is between 0 and 1. When x is outside this range, the return value is a linear extrapolation). | |
longestCommonSubsequence(?Array array1, ?Array array2, ?Function= opt_compareFn, ?Function= opt_collectorFn) ⇒ ?ArrayJavaScript implementation of Longest Common Subsequence problem. http://en.wikipedia.org/wiki/Longest_common_subsequence Returns the longest possible array that is subarray of both of given arrays. | |
modulo(number a, number b) ⇒ numberThe % operator in JavaScript returns the remainder of a / b, but differs from some other languages in that the result will have the same sign as the dividend. For example, -1 % 8 == -1, whereas in some other languages (such as Python) the result would be 7. This function emulates the more correct modulo behavior, which is useful for certain applications such as calculating an offset index in a circular list. | |
nearlyEquals(number a, number b, number= opt_tolerance) ⇒ booleanTests whether the two values are equal to each other, within a certain tolerance to adjust for floating pount errors. | |
randomInt(number a) ⇒ numberReturns a random integer greater than or equal to 0 and less than {@code a}. | |
sign(number x) ⇒ numberReturns the sign of a number as per the "sign" or "signum" function. | |
standardAngle(number angle) ⇒ numberStandardizes an angle to be in range [0-360). Negative angles become positive, and values greater than 360 are returned modulo 360. | |
standardDeviation((number|undefined) var_args) ⇒ numberReturns the sample standard deviation of the arguments. For a definition of sample standard deviation, see e.g. http://en.wikipedia.org/wiki/Standard_deviation | |
sum((number|undefined) var_args) ⇒ numberReturns the sum of the arguments. | |
toDegrees(number angleRadians) ⇒ numberConverts radians to degrees. | |
toRadians(number angleDegrees) ⇒ numberConverts degrees to radians. | |
uniformRandom(number a, number b) ⇒ numberReturns a random number greater than or equal to {@code a} and less than {@code b}. | |