dotMath is aÂ 2D, 3D math library. It provides several classes with different purposes, such as positioning (Vector2, Vector3 and Quaternion), color/matrix manipulation and 3D transformations. The matrix classes have methods to calculate the determinant, reduce to identity and transpose, as well as structure to handle 3×3 and 4×4 sizes.
Regarding the vector classes, Â it’s possible to add/subtract them, scale, normalize and calculate its magnitude (length). There is also some methods in this package useful to perform common gamedev tasks, such as calculate the distance between a point and a line.
var v1:Vector2 = new Vector2( 1, 2 ); var v2:Vector2 = new Vector2( 1, 2 ); var v3:Vector2 = Vector2.subtract( v1, v2 ); v3.normalize();