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

Summary

pwu:: | 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 |

Return the 2 dimensional zero vector

pwu::Vector2 zero

Return a vector with the given x and y components

pwu::Vector2 set x y

Return the value of the vector at the given index

pwu::Vector2 index vec i

Return the x component of the vector

pwu::Vector2 x vec

Return the y component of the vector

pwu::Vector2 y vec

Check if two vectors are equal

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

Check if two vectors are not equal

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

Add two vectors together and return the result

pwu::Vector2 add vec1 vec2

Subtract one vector from another and return the result

pwu::Vector2 subtract vec1 vec2

Return the negation of a vector

pwu::Vector2 negate vec

Scale a vector by a single scalar value

pwu::Vector2 scale vec scalar

Scale a vector by inverse of a single scalar value

pwu::Vector2 divide vec scalar

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

pwu::Vector2 multiply vec1 vec2

Calculate the dot product of two vectors

pwu::Vector2 dot vec1 vec2

Return the normalization of a vector

pwu::Vector2 normalize ?-length lenVar? vec

Return the length of the vector

pwu::Vector2 length vec

Return a vector that has the minimum components of two vectors

pwu::Vector2 minimum vec1 vec2

Return a vector that has the maximum components of two vectors

pwu::Vector2 maximum vec1 vec2