Reverse this equation/function (2d to isometric)
I have a function that transforms x and y points on a 2d grid to the equivalent x and y on an isometric grid. Are you able to reverse the equation so that when given isometric x,y we end up with 2d coordinates?
Here's the function in psuedo code
var tileWidth = 128 var tileHeight = 128 var isoWidth = tileWidth / 2 var isoHeight = tileHeight / 2 var isoXOffset = isoWidth / 2 var isoYOffset = 0 2dtoIso(x, y){ var origin2dX = x * tileWidth var origin2dY = y * tileHeight var originIsoX = origin2dX / 2 + y * -1 * isoHeight + isoXOffset var originIsoY = origin2dY / 4 + (x / 2) * isoHeight + isoYOffset return (originIsoX,originIsoY) }Thanks for trying. I'm stumped :)
Answer
Answers can only be viewed under the following conditions:
- The questioner was satisfied with and accepted the answer, or
- The answer was evaluated as being 100% correct by the judge.
-
You are awesome :)
The answer is accepted.
Join Matchmaticians Affiliate Marketing
Program to earn up to a 50% commission on every question that your affiliated users ask or answer.
- answered
- 906 views
- $9.84
Related Questions
- Prove that language L = {a^p ; p is prime} isn't regular using Myhill-Nerode theorem.
- Linear Algebra - Matrices (Multiple Choice Question) (1st Year College)
- Tensor Product II
- Find $x$, if $\sqrt{x} + 2y^2 = 15$ and $\sqrt{4x} − 4y^2 = 6$.
- Calculating Speed and Velocity
- Differentiate $f(x)=\int_{\sqrt{x}}^{\arcsin x} \ln\theta d \theta$
- College Algebra Help
- Find the null space of the matrix $\begin{pmatrix} 1 & 2 & -1 \\ 3 & -3 & 1 \end{pmatrix}$
Some crucial information seems to be missing. What the number 128 represent? what are the variables you have defined represent?
Also given that this is a non-standard question, it may take a while for someone to figure it out. So I would say the offered bounty is low.
It's used to draw isometric tiles on a screen so the 128 is pixels which is the width of a tile. Thanks for the comments. Out of interest why would it take a while to figure out? I personally don't know how to re-arrange something like this but I assumed it would be easy for somebody who knows the rules of algebra
I noticed isoWidth is unused. I assume you meant to use it instead of isoHeight on the 3rd line in the function definition.