Raised when an error occurs (usually a division by zero)
Module OgamlMath.Vector2i
Operations on immutable vectors of 2 integersThis module defines the vector2i type and various operations on it.
Vector operations
Type of immutable vectors of 2 integers
Record fields
Fast way to create a vector
Zero vector
Unit x vector
Unit y vector
Adds two vectors together
sub u v
computes the vector u - v
Multiplies a vector by a scalar
Divides a vector by a scalar. Raises Vector2i_exception if the scalar is zero.
Computes the pointwise product of two vectors.
Computes the pointwise division of two vectors.
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
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
raster p1 p2
applies the Bresenham's line algorithm between the pointsp1
and p2
and returns the list of points constituting the lineNote : should not be used for precise raytracing as it may miss points
Returns a pretty-printed string (not for serialization)