Module graphics::math
[−]
[src]
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. |
least_separation_4 |
Returns the least separation out of four.
Each seperation can be computed using |
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. |
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. |
Type Definitions
Matrix2d |
The type used for matrices. |
Scalar |
The type used for scalars. |
Vec2d |
The type used for 2D vectors. |
Vec3d |
The type used for 3D vectors. |