A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Nice Big Quadratic Mess

  1. #1
    Bacon-wrapped closures Nialsh's Avatar
    Join Date
    Dec 2003
    Location
    Houston!
    Posts
    338

    Nice Big Quadratic Mess

    Okay, I've been working on an equation for a ping-pong game that will allow the computer to "aim" from its current position (xs and ys) at a variable angle (theta) to a certain spot on the table (xf and yf) at a given speed (V), while being acted on by constant gravity (a). I've managed to get an equation that I think is right, but algebra alone doesn't seem to be enough math background to isolate t. (Note that I had to use a few strange symbols since this forum doesn't allow for special characters: t=theta; +/- should be ontop of eachother; sqrt=square root)
    V*cos(t) = (a(xs-xf))/(-V*sin(t)+/-sqrt(V^2*sin(t)+2a(ys-yf)))
    Any help is appreciated.

  2. #2
    Senior Member
    Join Date
    Mar 2002
    Posts
    183
    Are you trying to solve this for a particular variable or what?

  3. #3
    Bacon-wrapped closures Nialsh's Avatar
    Join Date
    Dec 2003
    Location
    Houston!
    Posts
    338
    Yes, I'm trying to solve for t.

  4. #4
    Senior Member
    Join Date
    Mar 2002
    Posts
    183
    solve it for what? I'm assuming one of the final positions. The only problem is that you have two unknowns and only one equations

  5. #5
    Bacon-wrapped closures Nialsh's Avatar
    Join Date
    Dec 2003
    Location
    Houston!
    Posts
    338
    I guess I'm not understanding what you're saying. The end result I'm looking for is an equation with only t on one side, and the rest of the variables on the other, with no recurrences of t.

  6. #6
    Senior Member
    Join Date
    Mar 2002
    Posts
    183
    Oh...and it actually does say that in your first post, sorry. whew, that's a toughie with the two sins and the cos. I'll give her a go, but I wouldnt expect myself to be able to solve it. Off the top of my head, I would think my strategy would be to square everything, then sin^2 + cos^2 = 1. The one sin is under the square root, leaving it just sin(t). The inverse sin for the answer...thats the plan, not sure how well it will work.

  7. #7
    Member
    Join Date
    May 2004
    Location
    Raleigh NC
    Posts
    34
    V*cos(t) = (a(xs-xf))/(-V*sin(t)+/-sqrt(V^2*sin(t)+2a(ys-yf)))
    makes no sense... specifically the
    ...sin(t)+/-sqrt(...

    looks like a typo, so if you could fix it maybe?

    edit: oh man, this is old... i hope you still needed help with that ...er i hope you dont need help, er something. i dunno.
    so there!

  8. #8
    Senior Member novex's Avatar
    Join Date
    Nov 2001
    Location
    Gold Coast, Australia.
    Posts
    186
    Well.. that was narky! If you havent solved it yet (its been 10 days or so) then this is what I got

    Code:
    t = acos((a(xs - xf)) / (V(-V * sint +/- sqrt(V^2 * sint + 2a(ys-yf)))))
    ebsay.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center