//Example code, will move the object speed units in the given direction (degrees)
d2r = pi / 180; //Conversion from degrees to radians
this.x += speed * cos (direction * d2r);
this.y += speed *-sin (direction * d2r);
它还用于其他用途,例如:
对 2d 精灵执行变换以创建旋转。
广泛用于投影 3D 视图。
由于正弦波的形状,它可用于在两个值之间创建平滑过渡。
创建正弦波以进行音频合成。
绘制圆形物体,例如圆和球体。
确定枢轴臂上的点的位置。
The most obvious use of trigonometry is to get an object to move in any given direction, without trigonometry this is impossible.
//Example code, will move the object speed units in the given direction (degrees)
d2r = pi / 180; //Conversion from degrees to radians
this.x += speed * cos (direction * d2r);
this.y += speed *-sin (direction * d2r);
It is also used for other things, such as:
Executing transformations on 2d sprites to create rotation.
Is used very extensively in projecting a 3d view.
Due to the shape of a sine wave it can be used to create smooth transitions between 2 values.
Creating sine waves for the purpose of audio synthesis.
Drawing circular objects such as circles and spheres.
Determining the location of a point which is on the arm of a pivot.
3D models are defined by vertices (numeric lists of coordinate pairs or triplets in 3D space), and lines that connect them. Those lines make surfaces that can be rendered, lit, textured, etc.
In order to, say, rotate an object, you have to be able to manipulate those vertices. If you want to rotate an object some number of degrees or radians, you'll have to use trig functions to figure out where it winds up.
Basic trig is fundamental to ANY 3D manipulation required for games, simulation etc. It's worth your time to investigate and become familiar with the real meaning of those functions, their limitations, and how they apply to and amplify the usefulness of geometry, signals processing, etc.
This is a great question; most just nod and act like it's obvious. Unless your first name is Blaise or Renee, it's probably not.
2D 或 3D 空间中的游戏需要图形几何。用于忠实地建模运动的物理引擎需要几何形状。三角函数是几何学的基础。
就拿弹跳这样简单的事情来说吧。弹丸撞击墙壁并反弹的物理原理将很快让您相信三角函数的实用性。
Games in 2D or 3D space require geometry for graphics. Physics engines for modeling motion faithfully require geometry. Trig is fundamental to geometry.
Take something as simple as bouncing. The physics of a projectile hitting and wall and bouncing back will quickly convince you of the utility of trig functions.
Trigonometry is crucial to produce almost all curves (as in from ellipses or circles) and therefore has PLENTY of use in game development. Additionally, the sine wave is useful for perlin noise and lots of other special effects.
您在执行此操作时遇到的问题应该可以为您提供问题的答案。如果您对 sin 和 cos 有基本的了解,您应该能够使用它们来使时钟绘制变得非常容易。
如果这没有给你答案,请尝试在没有 sin 和 cos 的情况下绘制它。
Write a program that draws and updates an analog clock.
The problems you encounter while doing so should give you the answer to your question. If you have a basic understanding of sin and cos you should be able to use them to make the clock drawing pretty easy.
If that doesn't give you your answer, try to draw it without sin and cos.
Well, an application that instantly comes to mind to me, is for special effects in game... say you have a weapon or spell or ability, or an effect of sorts, that makes a beam of light... you can play around with maths to "shape that beam"...
Same way, say you have a portal that you wish to play some neat animations upon activation or entrance, you can play around with vectors and rotation matrixes, and you can do lots of amazing things with a mix of maths and your imagination...
In game development, there are a lot of situations where you need to use the trigonometric functions. When programming a game, you'll often need to do things like find the distance between two points or make an object move. Here are a few examples:
Rotating a spaceship or other vehicle
Properly handling the trajectory of projectiles shot from a rotated weapon
Calculating a new trajectory after a collision between two objects such as billiard balls or heads
Determining if a collision between two objects is happening
Finding the angle of trajectory (given the speed of an object in the x direction and y direction)
发布评论
评论(8)
三角学最明显的用途是让物体沿任何给定方向移动,没有三角学这是不可能的。
它还用于其他用途,例如:
The most obvious use of trigonometry is to get an object to move in any given direction, without trigonometry this is impossible.
It is also used for other things, such as:
3D 模型由顶点(3D 空间中的坐标对或三元组的数字列表)以及连接它们的线来定义。这些线形成可以渲染、照亮、纹理化等的表面。
例如,为了旋转对象,您必须能够操纵这些顶点。如果您想将对象旋转一定角度或弧度,则必须使用三角函数来确定它的结束位置。
基本三角是游戏、模拟等所需的任何 3D 操作的基础。值得您花时间研究并熟悉这些函数的真正含义、它们的局限性,以及它们如何应用于和放大几何、信号处理、这
是一个很好的问题;大多数人只是点头,表现得好像这是理所当然的。除非你的名字是 Blaise 或 Renee,否则可能不是。
3D models are defined by vertices (numeric lists of coordinate pairs or triplets in 3D space), and lines that connect them. Those lines make surfaces that can be rendered, lit, textured, etc.
In order to, say, rotate an object, you have to be able to manipulate those vertices. If you want to rotate an object some number of degrees or radians, you'll have to use trig functions to figure out where it winds up.
Basic trig is fundamental to ANY 3D manipulation required for games, simulation etc. It's worth your time to investigate and become familiar with the real meaning of those functions, their limitations, and how they apply to and amplify the usefulness of geometry, signals processing, etc.
This is a great question; most just nod and act like it's obvious. Unless your first name is Blaise or Renee, it's probably not.
使用三角函数的一个示例是旋转矩阵
例如
该矩阵用于围绕原点旋转 x,y 平面中的点。
One example trig functions are used is in rotation matrices
For example
This matrix is used for rotating a point in the x,y plane around the origin.
2D 或 3D 空间中的游戏需要图形几何。用于忠实地建模运动的物理引擎需要几何形状。三角函数是几何学的基础。
就拿弹跳这样简单的事情来说吧。弹丸撞击墙壁并反弹的物理原理将很快让您相信三角函数的实用性。
Games in 2D or 3D space require geometry for graphics. Physics engines for modeling motion faithfully require geometry. Trig is fundamental to geometry.
Take something as simple as bouncing. The physics of a projectile hitting and wall and bouncing back will quickly convince you of the utility of trig functions.
三角学对于生成几乎所有曲线(例如椭圆或圆)至关重要,因此在游戏开发中具有大量用途。此外,正弦波对于柏林噪声和许多其他特殊效果很有用。
Trigonometry is crucial to produce almost all curves (as in from ellipses or circles) and therefore has PLENTY of use in game development. Additionally, the sine wave is useful for perlin noise and lots of other special effects.
编写一个绘制和更新模拟时钟的程序。
您在执行此操作时遇到的问题应该可以为您提供问题的答案。如果您对 sin 和 cos 有基本的了解,您应该能够使用它们来使时钟绘制变得非常容易。
如果这没有给你答案,请尝试在没有 sin 和 cos 的情况下绘制它。
Write a program that draws and updates an analog clock.
The problems you encounter while doing so should give you the answer to your question. If you have a basic understanding of sin and cos you should be able to use them to make the clock drawing pretty easy.
If that doesn't give you your answer, try to draw it without sin and cos.
好吧,我立即想到的一个应用程序是游戏中的特效...假设你有武器、咒语或能力,或者某种效果,可以产生一束光...你可以玩玩用数学来“塑造光束”...
同样的方式,假设你有一个门户,你希望在激活或进入时播放一些简洁的动画,你可以使用向量和旋转矩阵,并且你可以做很多令人惊奇的事情结合数学和你的想象力......
Well, an application that instantly comes to mind to me, is for special effects in game... say you have a weapon or spell or ability, or an effect of sorts, that makes a beam of light... you can play around with maths to "shape that beam"...
Same way, say you have a portal that you wish to play some neat animations upon activation or entrance, you can play around with vectors and rotation matrixes, and you can do lots of amazing things with a mix of maths and your imagination...
在游戏开发中,有很多情况需要用到三角函数。在编写游戏编程时,您经常需要执行一些操作,例如计算两点之间的距离或使物体移动。以下是一些示例:
旋转宇宙飞船或其他飞行器
正确处理旋转武器发射的弹丸轨迹
计算两个物体(例如台球或头)碰撞后的新轨迹
确定是否发生碰撞两个物体之间正在发生
求出轨迹角度(给定物体在 x 方向和 y 方向上的速度)
这里有一个很好的链接 各种类型的视频游戏开发所需的不同数学领域。
检查这些链接以进一步阅读:
相机视野:3D预测与三角学
Flash 游戏设计中的三角函数< /a>
In game development, there are a lot of situations where you need to use the trigonometric functions. When programming a game, you'll often need to do things like find the distance between two points or make an object move. Here are a few examples:
Rotating a spaceship or other vehicle
Properly handling the trajectory of projectiles shot from a rotated weapon
Calculating a new trajectory after a collision between two objects such as billiard balls or heads
Determining if a collision between two objects is happening
Finding the angle of trajectory (given the speed of an object in the x direction and y direction)
Here's a good link to different areas of Math required in various types of video game development.
Check these links for further reading:
Camera field of view: 3D projections & trigonometry
Trigonometry for Flash Game Design