Confused with the descriptions of transformPoint and inverseTransformPoint
Posted: Mon Oct 26, 2020 2:51 pm
I'm looking for definitions of global / local coordinates and screen-space in the love wiki.
These are the descriptions from the wiki.
Orientation-based_coordinates
So the transformPoint method is converting a point from local to world. Correct me if I'm wrong.
These are the descriptions from the wiki.
The problem is as I learnt the global coordinate also known as world coordinate is an initial untransformed coordinate, the local coordinate is a transformed coordinate. In a 2D world the global coordinate is usually the window coordinate, so the most top left position is 0, 0 in this coordinate.love.graphics.transformPoint
Converts the given 2D position from global coordinates into screen-space.
global->screen
love.graphics.inverseTransformPoint
Converts the given 2D position from screen-space into global coordinates.
screen->global
Transform:transformPoint
This effectively converts the given position from global coordinates into the local coordinate space of the Transform.
global->local
Transform:inverseTransformPoint
This effectively converts the given position from the local coordinate space of the Transform into global coordinates.
local->global
Orientation-based_coordinates
So the transformPoint method is converting a point from local to world. Correct me if I'm wrong.
Code: Select all
local t = love.math.newTransform(100, 100, 10)
local globalX, globalY = 0, 0
local localX, localY = t:transformPoint(globalX, globalY)
-- Result: 100, 100