![]() |
|
#1
|
||||
|
||||
|
Argh maths! Train problem...
edit:If you can think of any improvement to the questions, wording, versatility or whatever, please say so,
thanks.Right...I've got no idea if this is easy or hard, what level it is etc, I just know it's beyond me today; working with vectors and matrix multiplications has sploded my brain! So here it is. None of the specific numbers are known prior to use so I'm looking for generic equations to solve the three following problems. Fear not, this isn't a homework cheat or anything, they're my questions which I can't even answer.../sigh. If wanted I'll post the resulting code for anyone who wants it :Variables in their simplest form: Current point. Destination point. Total Time of the journey. Current Time of the journey. Elapsed time since the last tick. Worthy of note is that the current and destination points, as well as the total time of the journey may change at any point during cycling of the used equation. Once in transition, the object will be unaware of its source point of origin so use of this variable is not allowed. The equations calculated must be shown as an amendment of the previous test and as such, tests may be taken at any specific non-integer based unit of time elapsed, throughout the objects journey. Unit descriptors are insignificant. 1)Determine an accurate equation for use which will allow the object to travel from a source point to its destination in a linear fashion. 2)Determine an accurate equation for use which will allow for the object to travel and arrive at its destination as if under deceleration in an exponential fashion, using the equation of x squared. 3)Use the above equation to calculate deceleration with an unknown exponent. 1)My gut instinct was to try: Amend position by : (Destination - Source) / (Total time - Current time). The problem comes with time remaining being measured at irregular points. I'll demonstrate the problem. ___Distance remaining_____Time remaining___ _________20__________________5_________ _________16__________________4_________ _________12__________________3_________ __________8__________________2_________ __________4__________________1_________ __________0__________________0_________ So you apply the formula to the first instance which is a simple 20/5 = 4 and thus amend the position by 4. If the next tick is at 1 second in, you can take 16, divide it by 4 and the formula still works. If however the next tick is at any other time, it simply falls apart as it hasn't taken into consideration the amount of time elapsed since the last test. So the answer is: Amend position by : ((Destination - Source) / (Total time - Current time)) * elapsedTime. 2) Here is where I'm stuck. If the source point was always zero, it wouldn't be so much of a problem but it's not. Any ideas anyone? Thanks in advance, have fun!
Last edited by kirennia; 4th February 2010 at 11:58 AM. |
| Sponsored Links |
|
#2
|
||||
|
||||
|
For question number 2 (and 3 I guess), here is a demonstrative graph of what I mean.
|
|
#3
|
|||
|
|||
|
Try thestudentroom to be honest - some of the uni students on there are absolutely fantastic with maths.
|
|
#4
|
||||
|
||||
|
this is not uni level. this is 13 year old level...
/edit, except the hard bits I didnt bother to read :P
__________________
Drinking for Britain since 1984!
|
|
#5
|
||||
|
||||
|
well for the deceleration you know that the speed is determined by x^n and you know how far you need to go to get to the end point. so you plug the distance into the time euation then differentiate for distance.
i cba to do the differentiation but that's basically it. |
|
#6
|
||||
|
||||
|
if thats maths for 13yr olds, I'm in the shit when it comes to helping my kids with maths homework....I'm so glad Vae is good with numbers!
__________________
Only dead fish go with the flow....and everyone knows that dead fish stink! |
|
#7
|
||||
|
||||
|
I've had another look and am partially there. I've figured out that quadratic equations are needed although not in the sense I know them.
If you have the end point on the graph, as well as the beginning and an exponent which can be manipulated to whatever you want it to be, does anyone have any pointers as to how to figure out any point on the graph (other then those two...? ![]() totalTime - currentTime will give the beginning x value, totalTime - currentTime + elapsedTime will give the second x position. ax^z + bx + c... c is unrequired so ax^z +bx... So what do you do if you don't know the quadratic and linear cooeficients, argh! Or do I already know them and I just don't know it yet (from the variables given in the top post)? It's an as-level pure 1 issue but sadly I can't remember for the life of me how to do it. Any suggestions would be greatly appreciated. Could show the resulting video if wanted as an incentive!
|
|
#8
|
|||
|
|||
|
Without looking too closely at your equation, I would say to find a, b (& c), you'd be best formulating some simultaneous equations.
if x represents time, y represents distance. So you have y = ax^z + bx (+ c). If you differentiate (dy/dx) you'll get a 2nd equation. Consider the points when dydx = 0. You have values to plug in from your table & you can simply do some simple algebra to find the values of a & b. Last edited by Bugz; 4th February 2010 at 11:36 PM. |
|
#9
|
||||
|
||||
|
Without looking too closely at your equation, I would say you're screwed tbh.
|
|
#10
|
||||
|
||||
|
Well it's all implemented and working. Currently the camera begins slow and ends fast but that's a minor issue. The formula is also split into two parts to avoid double calculation of the same exponent value. As for part three, you merely replace the ^2 with ^t.
Formulae required: y = ax^2 + bx + c. AmendPositionBy : ((elapsedTime + currentTime) * a)^2 - (currentTime * a)^2 For anyone interested in the code, or if anyone could help improve the general calculation times somehow: Click to:
I'll post the rotational calculations once they're in and working. |
|
#11
|
||||
|
||||
|
Lot of ADHD potential in this thread
|
|
#12
|
||||
|
||||
|
/hug.
Forgot to post the code. Currently I've only got it working for the camera beginning slow and speeding up as it closes in on the object but anyway, anyone interested in the code, here it is. It all works except for rotation on the z-axis which is highly frustrating. It's not working for linear or exponential movement however so that leads me to beleive that the problem is rooted elsewhere, probably with my matrix manipualtions. edit:Argh at removal of trailing spaces and tabs! Click to:
And anyone who can see efficiency improvement, feel free to comment, otherwise I guess this thread has run its course!
|
|
#13
|
|||
|
|||
|
Is this for a speed camera or some such device?
|
|
#14
|
||||
|
||||
|
From what I can see, X^n /4H = L-LP
But then again I dont know what i am talking about and made this up
__________________
http://gimpchimp.etilader.com/display.php?user=Bahumat |
|
#15
|
||||
|
||||
|
Almost.
![]() It's for a camera system itself. CurrentPosition is the literal world position of the camera, lockPosition is its target. The timer is there for movement between two objects. With the calculation worked out, it'll be a much easier task to use exponential movement for all objects in the world. All depends on what H/L and LP stand for... Last edited by kirennia; 8th February 2010 at 04:55 PM. |
![]() |
|
| Tags |
| argh, maths, problem, train |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [GAMES] Problem...choices choices choices!!!! Argh! | old.Tohtori | Off-Topic | 25 | 20th January 2009 09:22 AM |
| Argh! Keyboard problem. | old.Tohtori | Off-Topic | 3 | 1st June 2006 08:37 PM |
| IE6 error messages, application error, memory reading problem??? ARGH | TUG | Techie Discussion | 5 | 28th October 2004 07:19 PM |
| Argh, CS problem, help plz | old.dog_dough | Half-Life - TFC / CS / NS etc | 7 | 10th August 2001 03:30 PM |
| Argh Realistic Mods argh | old.[GA]Kaidos | Half-Life - TFC / CS / NS etc | 2 | 9th September 1999 06:36 PM |