我有一个多边形,里面是一个移动的球.如果球击中边界,球应该会反弹.
我当前的'解决方案':我将多边形分成几行,并计算球何时击中移动线

所有变量:
a = length of a
b = length of b
c = length of c
ax = x position of A
ay = y position of A
bx = x position of B
by = y position of B
cx = x position of C
cy = y position of C
vax = speed of A on the x-axis
vay = speed of A on the y-axis
vbx = speed of B on the x-axis
vby = …Run Code Online (Sandbox Code Playgroud)