[ x'] [ m00 m01 m02 ] [ x ] [ m00x + m01y + m02 ] [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ] [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]This class is optimized for speed and minimizes calculations based on its knowledge of the underlying matrix (as opposed to say simply performing matrix multiplication).
transform
method.
Computes 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.
|
code » | |||||
Computes the difference between startAngle and endAngle (angles in degrees).
Returns: number
The number of degrees that when added to
startAngle will result in endAngle. Positive numbers mean that the
direction is clockwise. Negative numbers indicate a counter-clockwise
direction.
The shortest route (clockwise vs counter-clockwise) between the angles
is used.
When the difference is 180 degrees, the function returns 180 (not -180)
angleDifference(30, 40) is 10, and angleDifference(40, 30) is -10.
angleDifference(350, 10) is 20, and angleDifference(10, 350) is -20.
|
code » | |||||
For a given angle and radius, finds the X portion of the offset.
|
code » | |||||
For a given angle and radius, finds the Y portion of the offset.
|
code » | |||||
Returns the arithmetic mean of the arguments.
Arguments:
Returns: number
The average of the arguments (
NaN if no arguments
were provided or any of the arguments is not a valid number).
|
code » | |||||
Takes a number and clamps it to within the provided bounds.
|
code » | |||||
Returns whether the supplied number is finite and not NaN.
|
code » | |||||
Returns whether the supplied number represents an integer, i.e. that is has
no fractional component. No range-checking is performed on the number.
|
code » | |||||
Performs 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).
|
code » | |||||
Returns the precise value of floor(log10(num)).
Simpler implementations didn't work because of floating point rounding
errors. For example
|
code » | |||||
![]()
JavaScript 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.
Arguments:
|
code » | |||||
The % 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.
|
code » | |||||
Tests whether the two values are equal to each other, within a certain
tolerance to adjust for floating point errors.
|
code » | |||||
Returns a random integer greater than or equal to 0 and less than
a .
|
code » | |||||
A tweaked variant of
Math.ceil . See goog.math.safeFloor for
details.
|
code » | |||||
A tweaked variant of
Math.floor which tolerates if the passed number
is infinitesimally smaller than the closest integer. It often happens with
the results of floating point calculations because of the finite precision
of the intermediate results. For example Math.floor(Math.log(1000) /
Math.LN10) == 2 , not 3 as one would expect.
|
code » | |||||
Returns the unbiased sample variance of the arguments. For a definition,
see e.g. http://en.wikipedia.org/wiki/Variance
Arguments:
Returns: number
The unbiased sample variance of the arguments (0 if fewer
than two samples were provided, or
NaN if any of the samples is
not a valid number).
|
code » | |||||
Returns the sign of a number as per the "sign" or "signum" function.
|
code » | |||||
Normalizes an angle to be in range [0-360). Angles outside this range will
be normalized to be the equivalent angle with that range.
|
code » | |||||
Normalizes an angle to be in range [0-2*PI). Angles outside this range will
be normalized to be the equivalent angle with that range.
|
code » | |||||
Returns the sample standard deviation of the arguments. For a definition of
sample standard deviation, see e.g.
http://en.wikipedia.org/wiki/Standard_deviation
Arguments:
Returns: number
The sample standard deviation of the arguments (0 if fewer
than two samples were provided, or
NaN if any of the samples is
not a valid number).
|
code » | |||||
Returns the sum of the arguments.
Arguments:
Returns: number
The sum of the arguments (0 if no arguments were provided,
NaN if any of the arguments is not a valid number).
|
code » | |||||
Converts radians to degrees.
|
code » | |||||
Converts degrees to radians.
|
code » | |||||
Returns a random number greater than or equal to
a and less than
b .
|
code » |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » |