# pwu::Vector2

Utility functions for two dimensional vectors, which are represented as a list of two real values.

Summary
 pwu::Vector2 Utility functions for two dimensional vectors, which are represented as a list of two real values. Static Actions zero Return the 2 dimensional zero vector set Return a vector with the given x and y components index Return the value of the vector at the given index x Return the x component of the vector y Return the y component of the vector equal Check if two vectors are equal notEqual Check if two vectors are not equal add Add two vectors together and return the result subtract Subtract one vector from another and return the result negate Return the negation of a vector scale Scale a vector by a single scalar value divide Scale a vector by inverse of a single scalar value multiply Return a vector that is the components of two vectors multiplied together dot Calculate the dot product of two vectors normalize Return the normalization of a vector length Return the length of the vector minimum Return a vector that has the minimum components of two vectors maximum Return a vector that has the maximum components of two vectors

### zero

 pwu::Vector2 zero

Return the 2 dimensional zero vector

none

#### Returns

a vector with the given x and y

### set

 pwu::Vector2 set x y

Return a vector with the given x and y components

#### Parameters

 x the x component y the y component

#### Returns

a vector with the given x and y

### index

 pwu::Vector2 index vec i

Return the value of the vector at the given index

#### Parameters

 vec the vector i the index to get; [0, 1]

#### Returns

the value of the vector at the given index

### x

 pwu::Vector2 x vec

Return the x component of the vector

#### Parameters

 vec the vector

#### Returns

the x component of the vector

### y

 pwu::Vector2 y vec

Return the y component of the vector

#### Parameters

 vec the vector

#### Returns

the y component of the vector

### equal

 pwu::Vector2 equal ?-tolerance tol? vec1 vec2

Check if two vectors are equal

#### Parameters

 tol the tolerance to check equality, 0.0 is used if not given vec1 the first vector vec2 the second vector

#### Returns

true if the vectors are equal within tolerance

### notEqual

 pwu::Vector2 notEqual ?-tolerance tol? vec1 vec2

Check if two vectors are not equal

#### Parameters

 tol the tolerance to check equality, 0.0 is used if not given vec1 the first vector vec2 the second vector

#### Returns

true if the vectors are not equal within tolerance

Add two vectors together and return the result

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the sum of the two vectors

### subtract

 pwu::Vector2 subtract vec1 vec2

Subtract one vector from another and return the result

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the difference of the two vectors

### negate

 pwu::Vector2 negate vec

Return the negation of a vector

#### Parameters

 vec the vector

#### Returns

the negated vector

### scale

 pwu::Vector2 scale vec scalar

Scale a vector by a single scalar value

#### Parameters

 vec the vector scalar a scalar value

#### Returns

a vector scaled by the scalar

### divide

 pwu::Vector2 divide vec scalar

Scale a vector by inverse of a single scalar value

#### Parameters

 vec the vector scalar a scalar value

#### Returns

a vector divided by the scalar

### multiply

 pwu::Vector2 multiply vec1 vec2

Return a vector that is the components of two vectors multiplied together

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the component multiply of the two vectors

### dot

 pwu::Vector2 dot vec1 vec2

Calculate the dot product of two vectors

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the dot product of the two vectors

### normalize

 pwu::Vector2 normalize ?-length lenVar? vec

Return the normalization of a vector

#### Parameters

 vec the vector lenVar a variable name to set the length of the vector before being normalized

#### Returns

the normalized vector

### length

 pwu::Vector2 length vec

Return the length of the vector

#### Parameters

 vec the vector

#### Returns

the length of the vector

### minimum

 pwu::Vector2 minimum vec1 vec2

Return a vector that has the minimum components of two vectors

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the minimum vector

### maximum

 pwu::Vector2 maximum vec1 vec2

Return a vector that has the maximum components of two vectors

#### Parameters

 vec1 the first vector vec2 the second vector

#### Returns

the maximum vector

 pwu::Vector2 zero
Return the 2 dimensional zero vector
 pwu::Vector2 set x y
Return a vector with the given x and y components
 pwu::Vector2 index vec i
Return the value of the vector at the given index
 pwu::Vector2 x vec
Return the x component of the vector
 pwu::Vector2 y vec
Return the y component of the vector
 pwu::Vector2 equal ?-tolerance tol? vec1 vec2
Check if two vectors are equal
 pwu::Vector2 notEqual ?-tolerance tol? vec1 vec2
Check if two vectors are not equal
Add two vectors together and return the result
 pwu::Vector2 subtract vec1 vec2
Subtract one vector from another and return the result
 pwu::Vector2 negate vec
Return the negation of a vector
 pwu::Vector2 scale vec scalar
Scale a vector by a single scalar value
 pwu::Vector2 divide vec scalar
Scale a vector by inverse of a single scalar value
 pwu::Vector2 multiply vec1 vec2
Return a vector that is the components of two vectors multiplied together
 pwu::Vector2 dot vec1 vec2
Calculate the dot product of two vectors
 pwu::Vector2 normalize ?-length lenVar? vec
Return the normalization of a vector
 pwu::Vector2 length vec
Return the length of the vector
 pwu::Vector2 minimum vec1 vec2
Return a vector that has the minimum components of two vectors
 pwu::Vector2 maximum vec1 vec2
Return a vector that has the maximum components of two vectors