You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to draw pictures at a specific xy coordinate in the global coordinate system.
After two weeks and almost 40 hours I am no closer to understanding the co-ordinate system than I was when I started.
I tried working in global co-ordinate but even after getting the rotated points of my rectangle and translating back I could not get the results I wanted.
So I started playing with local co-ordinates and I still don't understand. I was under the assumption that I could just translate to the center of the item on the canvas, rotate the canvas, and draw the rectangle using the current point as the center of the rectangle but this does not work. I then tried translating to the x,y I wanted, then translating to the center of the item, rotating and then translating out the same amount I translated in from the original x,y but this doesn't work.
I have the following code, that works but I don't understand why, and I would really like to come up with a formula rather than have a long if/else chain. So can someone help me understand the following:
I don't understand why after the translation to the center of the image and rotating that to translate out again my y value is 0. If the rotation was -90 the x would be 0, and I have to move just the y. Here's the resulting image, with each position marked. Note in the final image it looks as if the rectangle was drawn from right to left , top to bottom.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to draw pictures at a specific xy coordinate in the global coordinate system.
After two weeks and almost 40 hours I am no closer to understanding the co-ordinate system than I was when I started.
I tried working in global co-ordinate but even after getting the rotated points of my rectangle and translating back I could not get the results I wanted.
So I started playing with local co-ordinates and I still don't understand. I was under the assumption that I could just translate to the center of the item on the canvas, rotate the canvas, and draw the rectangle using the current point as the center of the rectangle but this does not work. I then tried translating to the x,y I wanted, then translating to the center of the item, rotating and then translating out the same amount I translated in from the original x,y but this doesn't work.
I have the following code, that works but I don't understand why, and I would really like to come up with a formula rather than have a long if/else chain. So can someone help me understand the following:
I don't understand why after the translation to the center of the image and rotating that to translate out again my y value is 0. If the rotation was -90 the x would be 0, and I have to move just the y. Here's the resulting image, with each position marked. Note in the final image it looks as if the rectangle was drawn from right to left , top to bottom.
Beta Was this translation helpful? Give feedback.
All reactions