Flip coordinate system

Hi how do I invert the coordinate such that (0,0) is at the top. My code treats (0,0) as the bottom. What do I flip in the code specifically? When I flip the Y-coordinate to negative, I get an error. Kinda confused. Can't post my whole code since file is too large.

1
2
3
4
5
6
7
void visits(Circle<T>& circle)
{
const std::pair<int,int> ul{ scalefac1 * (circle.Point<T>::x() - circle.radius()),_scalefac2 * (circle.Point<T>::y() + circle.radius()) };
const std::pair<int,int> lr{ scalefac1 * (circle.Point<T>::x() + circle.radius()),_scalefac2 * (circle.Point<T>::y() - circle.radius()) };
bitmap->drawEllipse(ul, lr);
}
Last edited on
top  0
.
.
.  y
.
0    bottom
.
. -y

Think of top - x
* It equals 0, when x==top
* It equals bottom, when x==0
Thanks. But still really unsure how to do. I tried to take point y and deduct the height and then add back the radius, but the circle just leaves the entire image. Really stuck on this. Still unsure of how to convert to the coordinate system you say.
Thinking of how do I "flip" the height... Is someone able to help?
Last edited on
Registered users can post here. Sign in or register to post.