How can you find the coordinates between two given points on a straight line(JavaScript)?
问题 I want to get all the x,y,z coordinates between 2 given points, on a straight line. I need to be able to do this in JavaScript for checking whether a projectile collides in my game. So, for example: Point 1: (0,0,0) Point 2: (2,2,2) -> 0,0,0 - 1,1,1, 2,2,2 Edit, here is working code for anybody who is lost. def ROUND(a): return int(a + 0.5) def drawDDA(x1,y1,z1,x2,y2,z2): x,y,z = x1,y1,z1 length = (x2-x1) if (x2-x1) > (y2-y1) else (y2-y1) if (y2-y1) > (z2-z1) else (z2-z1) dx = (x2-x1)/float