Module graphics::math

source ·
Expand description

Various methods for computing with vectors.

Functions

Transforms from normalized to absolute coordinates.
Adds two vectors.
Computes area of a simple polygon.
Computes the area and centroid of a simple polygon.
Converts to another vector type.
Computes centroid of a simple polygon.
Computes the cross product.
Computes the dot product.
Transforms from barycentric coordinates to cartesian.
Extract scale information from matrix.
Transform color with hue, saturation and value.
Create an identity matrix.
Returns true if point is inside triangle.
Computes the inverse of a 2x3 matrix.
Returns the least separation out of four. Each seperation can be computed using separation function. The separation returned can be used to solve collision of rectangles.
Returns a number that tells which side it is relative to a line.
Shrinks a rectangle by a factor on all sides.
Computes modular offset safely for numbers.
Multiplies two vectors component wise.
Multiplies the vector with a scalar.
Multiplies two matrices.
Orients x axis to look at point.
Computes overlap between two rectangles. The area of the overlapping rectangle is positive. A shared edge or corner is not considered overlap.
Creates a perpendicular vector.
Computes a relative rectangle using the rectangle as a tile.
Computes a relative source rectangle using the source rectangle as a tile.
Creates a rotation matrix.
Create a scale matrix.
Compute the shortest vector from point to ray. A ray stores starting point and directional vector.
Create a shear matrix.
Computes the square length of a vector.
Subtracts ‘b’ from ‘a’.
Transforms from cartesian coordinates to barycentric.
Transforms a 2D position through matrix.
Transforms a 2D vector through matrix.
Creates a translation matrix.
Returns true if triangle is clockwise.

Type Definitions

The type used for matrices.
The type used for scalars.
The type used for 2D vectors.
The type used for 3D vectors.