# Module OgamlMath.Vector2f

Operations on immutable vectors of 2 floats

This module defines the vector2f type and various operations on it.

Raised when an error occurs (usually a division by zero)

### Vector operations

Type of immutable vectors of 2 floats

#### Record fields

 `x : float` `y : float`
Fast way to create a vector
Zero vector
Unit x vector
Unit y vector
`sub u v` computes the vector `u - v`
Multiplies a vector by a scalar
Divides a vector by a scalar. Raises Vector2f_exception if the scalar is zero.
Computes the pointwise product of two vectors.
Computes the pointwise division of two vectors.
Truncates the floating-point coordinates of a vector
See : OgamlMath.Vector2i
Returns a float vector from an int vector
See : OgamlMath.Vector2i
Computes the dot product of two vectors
Computes the determinant of two vectors
Computes the angle (in radians) between two vectors
Computes the squared norm of a vector
Computes the norm of a vector
Computes the squared distance between two points
Computes the distance between two points
Normalizes a vector. Raises Vector2f_exception if the vector is zero.
`clamp v a b` returns the vector whose coordinates are the coordinates of `v` clamped between the coordinates of `a` and `b`
Maps each coordinate of a vector
Maps each pair of coordinates of two vectors
Returns the maximal coordinate of a vector
Returns the minimal coordinate of a vector
Returns a pretty-printed string (not for serialization)
`direction u v` returns the normalized direction vector from `u` to `v` . Raises Vector2f_exception if `u = v` .
`endpoint a v t` returns the point `a + tv`
`raytrace_points p1 p2` returns the list of integer-valued points (squares) on the line from `p1` to `p2`
Each point is a triplet of the form `(t, p, f)` such that :
`t` is the time at the intersection between the line and the point
`p` stores the (integer) coordinates of the point
`f` is a unit vector indicating which face of the square has been intersected
`raytrace p v t` applies `raytrace_points` between the points `p` and `p + tv` . The intersection times are comprised between 0 and t