Does aspect2D change linearly as you move away from the center? I’m doing some math to place an image at a specific place on the screen and I’m getting some odd results. I know the x and y pixel locations of where I want to place the center of the image, but when I convert them to a2d’s coordinate space, it doesn’t seem like the coordinates are spaced linearly. As a result, I can’t place the images exactly where I want them. Here’s what I’m doing:
diff = Settings.WIDTH - Settings.HEIGHT xOff = 0 yOff = 0 if(diff > 0): xOff = diff / 2 else: yOff = diff / 2 centerX = Settings.WIDTH / 2 centerY = Settings.HEIGHT / 2 newX = (x - centerX) / (centerX - xOff) newY = (centerY - y) / (centerY - yOff)
Here’s a picture to show what I’m doing:
I’m essentially computing the ratio of the pixel coordinates to the coordinates of a2d. I’m not quite sure why this math doesn’t work. any advice would be appreciated.
Looks like the math is fine, but my x & y parameters are not what I thought they were. I’ll leave the thread in case anyone is every looking for the math.