Thread: quick math

  1. #1
    Registered User
    Join Date
    Jun 2005

    quick math

    ok im working with a graph and im making it so if i click somewere and it makes a ball that ball will go twords another point.
    what i have to work with is a function than is like this :
    create(baseball,xstarting position,ystarting position,x velosity,y velocity)
    i have it so it will get the position of the mouse for position xstarting position , ystarting position and i dont know how to make it so i can give it a velocity that will got twords another position all the time and the other position is moving? and help??

  2. #2
    Registered User
    Join Date
    Jun 2004
    considering time in seconds the position of the ball will be, disregarding attrition
             | x = x_initial + v_x * time
    pos(t) = |
             | y = y_initial + v_y * time + 9.8 * time^2 / 2
    in 'y' you have to account for the gravity.
    Then you have to solve a system of equations. You know the final position (x, y) and the initial position (x, y). 2 variables remain (vx, vy) and 2 equations. Solve the system.
    Last edited by xErath; 07-06-2005 at 08:48 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. how to use operator+() in this code?
    By barlas in forum C++ Programming
    Replies: 10
    Last Post: 07-09-2005, 07:22 PM
  3. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 10:33 AM
  4. toughest math course
    By axon in forum A Brief History of
    Replies: 12
    Last Post: 10-28-2003, 10:06 PM
  5. Quick math question
    By PJYelton in forum A Brief History of
    Replies: 3
    Last Post: 04-03-2003, 10:06 AM