Skip to content

v1.1.0

Choose a tag to compare

@thewizardplusplus thewizardplusplus released this 28 Jul 02:02
· 34 commits to master since this release

Add the Matrix3x3 class.

Change Log

  • Add the Matrix3x3 class
  • Perform refactoring:
    • Support multiplication by the Matrix3x3 in the Vector2D class

Features

  • Classes:
    • Vector2D:
      • Constants:
        • ZERO — (0, 0)
        • BASIS_X — (1, 0)
        • BASIS_Y — (0, 1)
      • Operations:
        • equals(other) — check exact equality
        • almost_equals(other, [epsilon]) — check approximate equality within a given epsilon
        • length_squared() — compute the squared length
        • length() — compute the length
        • normalized() — return the normalized vector
        • add(other) — add another vector
        • sub(other) — subtract another vector
        • mul(value) — multiply by a scalar, matrix, or perform component-wise multiplication with another vector
        • neg() — unary minus
        • dot(other) — compute the dot product
        • div(value) — divide by a scalar or perform component-wise division by another vector
      • Operators (via metamethods):
        • == — check exact equality (__eq())
        • #vector — compute the length (__len()); supported only since Lua 5.2
        • + — add two vectors (__add())
        • - — subtract two vectors (__sub())
        • * — multiply by a scalar (vector * scalar or scalar * vector), matrix (vector * matrix or matrix * vector), or perform component-wise multiplication (vector * vector) (__mul())
        • -vector — unary minus (__unm())
        • / — divide by a scalar (vector / scalar) or perform component-wise division (vector / vector) (__div())
    • Matrix3x3:
      • Constants:
        • ZERO — zero matrix
        • IDENTITY — identity matrix
      • Operations:
        • equals(other) — check exact equality
        • almost_equals(other, [epsilon]) — check approximate equality within a given epsilon
        • add(other) — add another matrix
        • sub(other) — subtract another matrix
        • mul(value) — multiply by a scalar, vector, or another matrix
        • div(value) — divide by a scalar
      • Operators (via metamethods):
        • == — check exact equality (__eq())
        • + — add two matrices (__add())
        • - — subtract two matrices (__sub())
        • * — multiply by a scalar (matrix * scalar or scalar * matrix), vector (matrix * vector or vector * matrix), or another matrix (matrix * matrix) (__mul())
        • / — divide by a scalar (matrix / scalar) (__div())
      • Transformation matrix factories:
        • translate(delta_x, delta_y) — translation
        • rotate(angle) — rotation
        • scale(scale_x, scale_y) — scaling
        • shear(shear_x, shear_y) — shear