# vec2 library Null safety

## Constants

dist → const double Function( a, b)
`distance`
div → const List<double> Function( out, a, b)
`divide`
len → const double Function( a)
`length`
mul → const List<double> Function( out, a, b)
`multiply`
sqrDist → const List<double> Function(dynamic a, dynamic b)
`squaredDistance`
sqrLen → const List<double> Function(dynamic a)
`squaredLength`
sub → const List<double> Function( out, a, b)
`subtract`

## Properties

forEach List<double> Function( a, int? stride, int? offset, int? count, dynamic fn, dynamic arg)
Perform some operation over an array of vec2s.
final

## Functions

angle( a, b)
Get the angle between two 2D vectors @param {ReadonlyVec2} a The first operand @param {ReadonlyVec2} b The second operand @returns {Number} The angle in radians
boolequals(dynamic a, dynamic b) → dynamic
Returns whether or not the vectors have approximately the same elements in the same position.
ceil( out, a) List<double>
math.ceil the components of a vec2
clone(dynamic a) List<double>
Creates a new vec2 initialized with values from an existing vector
copy( out, a) List<double>
Copy the values from one vec2 to another
create() List<double>
Creates a new, empty vec2
cross(dynamic out, dynamic a, dynamic b) List<double>
Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector
distance( a, b)
Calculates the euclidian distance between two vec2's
divide( out, a, b) List<double>
Divides two vec2's
dot(dynamic a, dynamic b) List<double>
Calculates the dot product of two vec2's
exactEquals(dynamic a, dynamic b) bool
Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
floor( out, a) List<double>
math.floor the components of a vec2
fromValues(double x, ) List<double>
Creates a new vec2 initialized with the given values
inverse(dynamic out, dynamic a) List<double>
Returns the inverse of the components of a vec2
length( a)
Calculates the length of a vec2
lerp(dynamic out, dynamic a, dynamic b, dynamic t) List<double>
Performs a linear interpolation between two vec2's
max( out, a, b) List<double>
Returns the maximum of two vec2's
min( out, a, b) List<double>
Returns the minimum of two vec2's
multiply( out, a, b) List<double>
Multiplies two vec2's
negate(dynamic out, dynamic a) List<double>
Negates the components of a vec2
normalize(dynamic out, dynamic a) List<double>
Normalize a vec2
random( out, scale) List<double>
Generates a random vector with the given scale
rotate( out, a, b, double rad) List<double>
Rotate a 2D vector @param {vec2} out The receiving vec2 @param {ReadonlyVec2} a The vec2 point to rotate @param {ReadonlyVec2} b The origin of the rotation @param {Number} rad The angle of rotation in radians @returns {vec2} out
round( out, a) List<double>
math.round the components of a vec2
scale( out, a, ) List<double>
Scales a vec2 by a scalar number
scaleAndAdd( out, a, b, double scale) List<double>
Adds two vec2's after scaling the second operand by a scalar value
set( out, double x, ) List<double>
Set the components of a vec2 to the given values
squaredDistance(dynamic a, dynamic b) List<double>
Calculates the squared euclidian distance between two vec2's
squaredLength(dynamic a) List<double>
Calculates the squared length of a vec2
str(dynamic a)
Returns a string representation of a vector
subtract( out, a, b) List<double>
Subtracts vector b from vector a
transformMat2( out, a, m) List<double>
Transforms the vec2 with a mat2
transformMat2d( out, a, m) List<double>
Transforms the vec2 with a mat2d
transformMat3( out, a, m) List<double>
Transforms the vec2 with a mat3 3rd vector component is implicitly '1'
transformMat4( out, a, m) List<double>
Transforms the vec2 with a mat4 3rd vector component is implicitly '0' 4th vector component is implicitly '1'
zero(dynamic out) List<double>
Set the components of a vec2 to zero