   Themepark Problem
  I know i'm going to go.. "Ohhh.. duh!!", but here we go.I'm making a theme park simulation app, and right now i'm trying to get the population to go from ride to ride, in a strait line (for now).Each ride is placed on a square, xy coordinate map, along with their walking duration (distance) from the center origin. Basically, I'm trying to figure out the theorem or equation to calculate where a person should be at X mins if they're walking from A to B: I figured, at first to use to pythagorean theorem (a^2 + b^2 = c^2) to get the missing walk duration, but after everyone walked from a certain angle and ended up somewhere i dunno, i then remembered that only worked with right triangles. (And once i have the third duration, i know i have to use this to calc where the person is between the rides.)Then I thought that since my park is square, that i can use the same theorem with the walls of the park, and figure out the third side:I felt like I was on the right track, but i'm stuck... not very good at geometry, i guess advTHANKSance[edited by - _untitled on February 5, 2004 4:09:23 PM]
  If u just need the distance between A and B:distance=sqrt ((a.x-b.x)^2 + (a.y-b.y)^2)) if u wanna know where some1 is afterx minuts. Ull need the degrees between A and B. And the use Sinus and Cosinus to calculate the x and y.Then u multipyl x and y with the minuts he walked and add it to position of A.I hope this is what u mean..;  Hmmm... I think i know what you mean. I'll try it out ...edit: Ow my brain   Can u elaborate further with an example maybe. Or point me to a site that has one?   [edited by - _untitled on February 5, 2004 8:36:54 PM];  I assume that you mean people travel a constant velocity.So,distance = velocity * timetime = distance / velocitySince velocity is constant you know that already.If the two points you are travelling between are fromA = (x1,y1) to B = (x2,y2) then the distance squared isdistance^2 = (x1-x2)^2 + (y1-y2)^2So take the square root of both sides to get the distance.Since, time = distance / velocity,you can now compute the time it takes to go from A to B (or B to A). Now, I am guessing you need to figure out how to compute the x,y coordinates of a person travelling from A to B.  Call the time to go from A to B, tAB.Let''s say 1 person leaves point A at time t1.Call the simulation time, time t.if ( t - t1 == tAB ) then person is at point B.if ( t - t1 > tAB ) then person has gone past B (signal error!)if ( t - t1 < tAB ) then person is somewhere between A and B.(t - t1) / tAB = fraction of total distance covered = fXdistance = abs(x1 - x2)Ydistance = abs(y1 - y2)xc = current x position relative to starting pointyc = current y position relative to starting pointxc / Xdistance = fyc / Ydistance = fxc = f * Xdistanceyc = f * Ydistanceif( x1 <= x2 then x = x1 + xcelsex = x1 - xc)if( y1 <= y2 theny = y1 + ycelsey = y1 - yc)So x and y will now contain the person''s coordinate.Note xc will be 0 for vertical lines and yc will be 0 for horizontal lines.;  Thanx! I think thats what i needed also, a friend helpped me find a solution aswell:I''ll try both ... 