Skip to content

Instantly share code, notes, and snippets.

View enghqii's full-sized avatar

Chanwoo enghqii

  • NEXON KOREA
  • South Korea
View GitHub Profile
@enghqii
enghqii / main.lua
Last active August 29, 2015 14:05
Isometric coord to Descartes coord (running on love2D engine)
-- https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
local matrix = require 'matrix'
-- Origin x,y (Screen coord)
Ix0, Iy0 = 93, 329; -- Isometric
Dx0, Dy0 = 450, 329; -- Descartes
-- invert y axis, move to Dx0, Dy0
descartesToScreenMatrix = (matrix{{1, 0, Dx0}, {0, 1, Dy0}, {0, 0, 1}} * matrix{{1, 0, 0}, {0, -1, 0}, {0, 0, 1}})
-- Basis Vector I is (sqrt(3)/2, -1/2), J is (0, 1)