Using love.graphics coordinates in other functions

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
dfgworm
Prole
Posts: 2
Joined: Tue Jan 30, 2018 9:27 am

Using love.graphics coordinates in other functions

Post by dfgworm »

So i have learned to use those coordinates translations in love.graphics (love.graphics.translate, love.graphics.rotate, etc.) and found them extremely useful, optimized and simple. But now i wonder if there's a simple way to bring those coordinates into my other functions (like for connecting it with physics or whatever), other than by making my own coordinate conjugating tools that could work the same way. Maybe i am blind, but i can't see anything similar on wiki. Actually i have already made representation of translate+rotate, but then realized that making the same for scale won't be as easy and i have no idea how shearing works mathematically.
So is this already in love or is there a fast library hidden somewhere deep in forums?
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Using love.graphics coordinates in other functions

Post by pgimeno »

It's not all that clear what you're asking. The result of a series of transforms (a multiplication of matrices) is another transform (another matrix). Up to 0.10.2, Löve doesn't provide any means to retrieve the current transformation matrix.

There is a workaround. You can track the theoretical value of the current matrix by hooking the transformation functions, so you can obtain the inverse matrix. There is an implementation in this post: viewtopic.php?p=201884#p201884

But again, I'm not sure if that's what you mean.
dfgworm
Prole
Posts: 2
Joined: Tue Jan 30, 2018 9:27 am

Re: Using love.graphics coordinates in other functions

Post by dfgworm »

Yeah, sorry for unclear question, but you got everything exactly right and even provided the answer i needed. Thanks!
What i want out of this is having 2 images (probably 2 different creatures) with different scaling, shearing and rotation being able to cooperate graphically. Like 1 heavily transformed guy having his heavily transfromed hand exactly on a shoulder of another heavily transformed guy.
May be i am a little bit too obsessed with perfection, but all those transformations don't seem like they affect performance, so i thought this is more than possible.
Edit: Wow, i honestly didnt expect more than just an "idk lul" or at max some shearing formula, but this is just perfect. I had no idea matrices are involved here, and would just use some retarded(yet working) self-made formulas of mine to modify plain coordinates. Cant imagine how much time i would waste to realize i need more than just X and Y stored for best performance.
You, man, are truly the Murderer-of-senseless-maths-wanderings.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests