Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my entire application I work with cartesian coordinates(2 dimensions ) and everything is just fine . But finaly I need to display some points on the screen and I think that I need to convert my points from cartesian to screen coordinates and I have no idee how to do that.

for exp in cartesina coordinates
X axis [-200,200]
Y axis [-200,200]
that meens that for the screen coordinates

X axis is in the interva [0,400]
Y axis is in the interval [0,400]

I need some help with this "conversion" because I really don`t know how to do it;
Thank you.
Posted

1 solution

Hi,

with a short description below the formula.

Xscr = Xc + (X-Pcx)*Scale
Yscr = Yc - (Y-Pcy)*Scale

Xscr = result from mapping cartestian to screen
Xc = half of screen size
X = X cartesian coordinate
Pcx = centre of the screen in caresian coordinates
S = Scale Factor

Regards
 
Share this answer
 
Comments
Radu_Socaciu 1-Mar-12 18:03pm    
How can I get the scale ? For my exp the scale with be 2??
Thank you for your fast replay.
El_Codero 1-Mar-12 18:14pm    
Don't exactly know what's your problem now but yes you set the scale.
Please scroll down to Scaling at "Cartesian formulas for the plane" in wikipedia, described well there, otherwise comment again ;)

http://en.wikipedia.org/wiki/Cartesian_coordinate_system[^]
El_Codero 2-Mar-12 6:47am    
Hm, why downvoted?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900