vec2.js
No description.

File Location

/goog/math/vec2.js

Classes

goog.math.Vec2
Class for a two-dimensional vector object and assorted functions useful for manipulating points.

Public Protected Private

Global Functions

goog.math.Vec2.difference(ab) !goog.math.Vec2
Returns the difference between two vectors as a new Vec2.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: !goog.math.Vec2  The difference vector.
code »
goog.math.Vec2.distance(ab) number
Returns the distance between two vectors.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: number  The distance.
code »
goog.math.Vec2.dot(ab) number
Returns the dot-product of two vectors.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: number  The dot-product of the two vectors.
code »
goog.math.Vec2.equals(ab) boolean
Compares vectors for equality.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: boolean  Whether the vectors have the same x and y coordinates.
code »
goog.math.Vec2.fromCoordinate(a) !goog.math.Vec2
Returns a new Vec2 object from a given coordinate.
Arguments:
a : !goog.math.Coordinate
The coordinate.
Returns: !goog.math.Vec2  A new vector object.
code »
goog.math.Vec2.lerp(abx) !goog.math.Vec2
Returns a new Vec2 that is the linear interpolant between vectors a and b at scale-value x.
Arguments:
a : !goog.math.Coordinate
Vector a.
b : !goog.math.Coordinate
Vector b.
x : number
The proportion between a and b.
Returns: !goog.math.Vec2  The interpolated vector.
code »
goog.math.Vec2.random() !goog.math.Vec2
No description.
Returns: !goog.math.Vec2  A random vector inside the unit-disc.
code »
goog.math.Vec2.randomUnit() !goog.math.Vec2
No description.
Returns: !goog.math.Vec2  A random unit-length vector.
code »
goog.math.Vec2.rotateAroundPoint(vaxisPointangle) !goog.math.Vec2
Rotates a vector by a given angle, specified in radians, relative to a given axis rotation point. The returned vector is a newly created instance - no in-place changes are done.
Arguments:
v : !goog.math.Vec2
A vector.
axisPoint : !goog.math.Vec2
The rotation axis point.
angle : number
The angle, in radians.
Returns: !goog.math.Vec2  The rotated vector in a newly created instance.
code »
goog.math.Vec2.squaredDistance(ab) number
Returns the squared distance between two vectors.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: number  The squared distance.
code »
goog.math.Vec2.sum(ab) !goog.math.Vec2
Returns the sum of two vectors as a new Vec2.
Arguments:
a : !goog.math.Coordinate
The first vector.
b : !goog.math.Coordinate
The second vector.
Returns: !goog.math.Vec2  The sum vector.
code »

Directory math

File Reference