将笛卡尔坐标转换为屏幕坐标 [英] transform Cartesian Coordinates to Screen Coordinates

查看:872
本文介绍了将笛卡尔坐标转换为屏幕坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的整个应用程序中,我使用笛卡尔坐标(2维),一切都很好.但是最后,我需要在屏幕上显示一些点,并且我认为我需要将我的点从笛卡尔坐标转换为屏幕坐标,而且我不知道该怎么做.

用于笛卡尔坐标系中的exp
X轴[-200,200]
Y轴[-200,200]
代表屏幕坐标

X轴位于干涉[0,400]
Y轴的间隔为[0,400]

我需要一些有关转换"的帮助,因为我真的不知道该怎么做;
谢谢.

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.

推荐答案



在公式下方有简短说明.

Xscr = Xc +(X-Pcx)*比例尺
Yscr = Yc-(Y-Pcy)*比例尺

Xscr =将cartestian映射到屏幕的结果
Xc =屏幕尺寸的一半
X = X笛卡尔坐标
Pcx =屏幕的中心在笛卡尔坐标中
S =比例因子

问候
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


这篇关于将笛卡尔坐标转换为屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆