/math3d

A lua math lib for linear algebra (matrix and vector)

Primary LanguageC

Math3D

A fast C/Lua library for linear algebra topics.

Installation

git clone https://github.com/cloudwu/math3d.git
make

Basic Usage

local math3d = require "math3d"

-- Vectors
local vec = math3d.vector(1, 2, 3)      -- Create a 3D vector
local len = math3d.length(vec)          -- Get vector length
local norm = math3d.normalize(vec)       -- Normalize vector

-- Matrices and Transforms
local mat = math3d.matrix()             -- Create identity matrix
local transformed = math3d.transform(mat, vec)

Features

  • Vector/matrix/quaternion operations
  • Transform and projection matrices
  • Ray casting and intersection testing
  • Frustum culling and AABB calculations
  • Memory management with reference counting