【发布时间】:2015-10-30 18:43:37
【问题描述】:
所以我正在制作某种 2d 物理引擎(是的,我知道从头开始制作物理引擎很难)并且我需要一些帮助。
我需要一个算法来说明在屏幕上绘制多边形顶点的位置,它应该给出一个介于 0 和 1 之间的数字,0 是可能的最小位置 (0),1 是可能的最大位置(窗口宽度或高度(1920 或 1080))。
我给每个多边形这些变量:
// = comment
x = [a number wetween 0 and 1]
y = [allso a number between 0 and 1]
width = [between 0 and 1]
height = [between 0 and 1]
vertices = [ // This makes a triangle
0, 1, // bottom left of a "box" created at [x] * [window width], [y] * [window height] with the width of [width] * [window width] and height [height] * [window height]
1, 1, // bottom right of the "box"
0.5, 0 // top middle
]
我怎样才能在屏幕上的哪个位置(以 0-1 格式)绘制顶点?
【问题讨论】:
标签: algorithm polygon vector-graphics