数学和游戏编程 [英] Mathematics and Game Programming

查看:122
本文介绍了数学和游戏编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要编程图形2D游戏比2D基本的东西,我已经知道了更复杂。我不想做3D节目。只是更复杂的2D的东西。我放弃了高中之前,我可以学到很多东西,所以我走了足够的代数知识来平衡我的支票簿,做一些轻2D笛卡尔编程。

I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian programming.

是否有良好的资源在那里与有限的注意力一个人(比如每人一个主题,我在非常感兴趣20分钟)学习,渐渐的,如何做与数学更有用编程?

Are there any good resources out there for a guy with a limited attention span (say 20 minutes apiece for a subject I'm keenly interested in) to learn, gradually, how to do something more useful with math in programming?

推荐答案

您需要能胜任三角:维基百科 Mathworld

You need to be competent in Trigonometry: Wikipedia and Mathworld

即使你不想做3D编程,2D游戏也可以使用向量和矩阵。 (线性代数)

Even though you don't wish to do 3D programming, 2D games also use vectors and matrices. (from Linear Algebra)

线性代数资源: Wikepedia 和的 Mathworld

有一点,将节省您大量的精力触发编程实现需要的 ATAN2()功能的,而不是所述的atan()函数。确定两个点之间的方向时,这是很重要的。

One point that will save you a lot of effort in Trig programming is realizing the need for the atan2() function, rather than the atan() function. This is important when determining the direction between two points.

如果能够协调不同系统之间移动是一大利好。这将配备经验。两种常见的事情,行程达人分别是:

Being able to move between various coordinate systems is a big plus. This will come with experience. Two common things that trip people up are:

一)大多数屏系统放置在左上角的原点(0,0),与正X轴延伸到右侧和向下延伸正y坐标。标准笛卡尔坐标假设象限1(其中,x和y为总是正值或零)在左下角的原点。这需要一个程序员翻转在y方向在某些阶段。

a) Most screen systems place the origin (0,0) in the upper left corner, with the positive x axis extending to the right and the positive y axis extending down. Standard Cartesian coordinates suppose the origin of Quadrant 1 (where x and y are always positive or zero) in the lower left. This requires a programmer to 'flip' the y orientation at some stage.

二)典型的地理场所0度为北和积极度扫顺时针。所有的三角函数把0度为东与积极度逆时针扫地。

b) Typical geography places 0 degrees as North and positive degrees sweep clockwise. All the Trig functions place 0 degrees as East with positive degrees sweeping counter-clockwise.

最后,虽然我们倾向于认为在度,真正的图书馆将使用弧度。 最好的做法是存储的角度为弧度(以'数学'的方向,而不是'地缘')和显示的调试信息时,转换的东西..

Finally, even though we tend to think in degrees, real libraries will use radians. A best practice is to store angles as radians (in 'math' orientation rather than 'geo') and convert things when displaying debug information..

这篇关于数学和游戏编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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