Maths help!

Soldato
Joined
18 Oct 2002
Posts
16,347
Location
The land of milk & beans
Hey all,

I'm trying to make a racing driver management sim and I've got the basics working in a C# console app. You give the code a track, driver and a car and it'll spit out X number of laptimes.

Now, I'm trying to model tyre degredation in to the laptimes and I know how I want to do it, unfortunately my GCSE maths is letting me down. What I need is to get values in the range 0-10 for the grip level based on the current lap and the tyres being used. Here's a basic graph I knocked up in PS to demonstrate the model:

tyre-graph.jpg


*edit*
Just realised I forgot the key - Soft, Medium, Hard

Now from my research I think I need to use the trigonometry functions of Math, however I don't understand what/how to make them work for this scenario?

Virtual cookies/beers are on offer for anyone can give me a nudge, link, or example code showing how I can do this :)

Thanks guys.
 
Last edited:
Thanks for the help!

I managed to solve this using Excel in the end - shock, horror! The graphing tool has a handy feature which lets you create a polynomial trend line from a dataset, and it will also generate the equation for the curve for you too. I ended up with this:

polynomial.jpg


Thanks again, beer and cookies are on me!

36356.jpg


Decadent-Chocolate-Chip-Cookies.jpg
 
Hmmm it appears I spoke too soon. The equation excel spits out only maps the first part of the curve... is that all that's possible with one equation?

Original:

equation.jpg


And then that equation plotted:

plot.jpg
 
Aha! I think I've cracked it, thanks mostly to this online too, which spits out polynomial equations based on supplied x,y coords.

That gave me this:
0.000000002291032891 * x^10 - 0.00000030551481 * x^9 + 0.00001742387542 * x^8 - 0.0005544179378 * x^7 + 0.01076963547 * x^6 - 0.1313698186 * x^5 + 0.9973748349 * x^4 - 4.492224546 * x^3 + 10.50060047 * x^2 - 7.513197218 * x + 2.121501817

Which becomes this:
fixed-polynomial.jpg


Hurrah!
 
Back
Top Bottom