Expand description
Various methods for computing with vectors.
Functions§
- abs_
transform - Transforms from normalized to absolute coordinates.
- add
- Adds two vectors.
- area
- Computes area of a simple polygon.
- area_
centroid - Computes the area and centroid of a simple polygon.
- cast
- Converts to another vector type.
- centroid
- Computes centroid of a simple polygon.
- cross
- Computes the cross product.
- dot
- Computes the dot product.
- from_
barycentric - Transforms from barycentric coordinates to cartesian.
- get_
scale - Extract scale information from matrix.
- hsv
- Transform color with hue, saturation and value.
- identity
- Create an identity matrix.
- inside_
triangle - Returns true if point is inside triangle.
- invert
- Computes the inverse of a 2x3 matrix.
- least_
separation_ 4 - 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. - line_
side - Returns a number that tells which side it is relative to a line.
- margin_
rectangle - Shrinks a rectangle by a factor on all sides.
- modular_
offset - Computes modular offset safely for numbers.
- mul
- Multiplies two vectors component wise.
- mul_
scalar - Multiplies the vector with a scalar.
- multiply
- Multiplies two matrices.
- orient
- Orients x axis to look at point.
- overlap_
rectangle - Computes overlap between two rectangles. The area of the overlapping rectangle is positive. A shared edge or corner is not considered overlap.
- perp
- Creates a perpendicular vector.
- relative_
rectangle - Computes a relative rectangle using the rectangle as a tile.
- relative_
source_ rectangle - Computes a relative source rectangle using the source rectangle as a tile.
- rotate_
radians - Creates a rotation matrix.
- scale
- Create a scale matrix.
- separation
- Compute the shortest vector from point to ray. A ray stores starting point and directional vector.
- shear
- Create a shear matrix.
- square_
len - Computes the square length of a vector.
- sub
- Subtracts ‘b’ from ‘a’.
- to_
barycentric - Transforms from cartesian coordinates to barycentric.
- transform_
pos - Transforms a 2D position through matrix.
- transform_
vec - Transforms a 2D vector through matrix.
- translate
- Creates a translation matrix.
- triangle_
face - Returns true if triangle is clockwise.