Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 00:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Absolutely Mind Blasting

Discussion on Absolutely Mind Blasting within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
Absolutely Mind Blasting

Code:
        static double f(double x, int klimit)
        {
            double result = Double.NaN;
            double numerator, denominator;
            int k;

            if (Math.Abs(x) < 1)
            {
                result = 0;
                for (k = 0; k <= klimit; k++)
                {
                    numerator = Math.Pow(-1, k) * Math.Pow(x, 1 + (2 * k));
                    denominator = 1 + (2 * k);
                    result += (numerator / denominator);
                }
            }
            else if (Math.Abs(x) > 1)
            {
                result = 0;
                for (k = 0; k <= klimit; k++)
                {
                    numerator = Math.Pow(-1, k) * Math.Pow(x, (-1) - (2 * k));
                    denominator = 1 + (2 * k);
                    result += (numerator / denominator);
                }
                numerator = Math.PI * Math.Sqrt(x * x);
                denominator = x * 2;
                result = (numerator / denominator) - result;
            }
            else // x == 1
            {
                return 0.25 * Math.PI;
            }
            return result;
        }
Code:
        static double finv(double x, int klimit)
        {
            Func<int, int> factorial = (n) =>
            {
                int num = 1;
                for (int j = n; j > 0; j--)
                    num *= j;
                return num;
            };

            Func<double, int, double> g = (gx, gklimit) =>
            {
                double gres = 0;
                double gnum, gdenom;
                for (int gk = 0; gk <= gklimit; gk++)
                {
                    gnum = Math.Pow(-1, gk) * Math.Pow(gx, (2 * gk));
                    gdenom = factorial(2 * gk);
                    gres += (gnum / gdenom);
                }
                return gres;
            };

            Func<double, int, double> h = (hx, hklimit) =>
            {
                double hres = 0;
                double hnum, hdenom;
                for (int hk = 0; hk <= hklimit; hk++)
                {
                    hnum = Math.Pow(-1, hk) * Math.Pow(hx, (2 * hk) + 1);
                    hdenom = factorial((2 * hk) + 1);
                    hres += (hnum / hdenom);
                }
                return hres;
            };

            return (h(2 * x, klimit) / (g(2 * x, klimit) + 1));
        }
Code:
finv( f ( x , k ) , k )
Will give you the same result as the x parameter
Well, not the exact result, but as k (klimit) increases, accuracy increases.


How's this relevant to CO?
Well, if we build on the f() function a bit we can do this...
Code:
        static double f2(double y, double x, int klimit)
        {
            if (x > 0)
                return f(y / x, klimit);
            else if (y >= 0 && x < 0)
                return Math.PI + f(y / x, klimit);
            else if (y < 0 && x < 0)
                return (-Math.PI) + f(y / x, klimit);
            else if (y > 0 && x == 0)
                return Math.PI / 2;
            else if (y < 0 && x == 0)
                return (-Math.PI) / 2;
            return Double.NaN;
        }
Code:
        static int GetAngle(int X1, int Y1, int X2, int Y2)
        {
            return (int)Math.Round(f2(Y2 - Y1, X2 - X1, 5) * 180 / Math.PI);
        }
InfamousNoone is offline  
Thanks
2 Users
Old 10/28/2010, 07:06   #2
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Easy geometry homework ftw.
Arcо is offline  
Old 10/28/2010, 07:07   #3
 
elite*gold: 0
Join Date: Aug 2010
Posts: 50
Received Thanks: 3
Umm wtf does this do lol?
oten681 is offline  
Old 10/28/2010, 07:09   #4
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
Nothing -- well, that's not true but it's not worth explaining. I just found it highly fascinating.
InfamousNoone is offline  
Old 10/28/2010, 07:29   #5
 
elite*gold: 20
Join Date: Oct 2010
Posts: 451
Received Thanks: 259
Thank you for sharing that. I found it interesting because I didn't know much about the math class until now.
FuriousFang is offline  
Old 10/28/2010, 10:00   #6
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Absoultely fantastic on how that works(Never done anything with maths(Well, not much)) May come in handy. #Bookmarked
_DreadNought_ is offline  
Old 10/28/2010, 10:21   #7
 
NukingFuts's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 480
Received Thanks: 111
nice and pretty fascinating
NukingFuts is offline  
Old 10/28/2010, 13:29   #8
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
WHAT IS THIS I DONT EVEN ---
_tao4229_ is offline  
Old 10/28/2010, 22:13   #9
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
I warned you that bricks would be shat.
InfamousNoone is offline  
Thanks
4 Users
Old 10/29/2010, 05:11   #10
 
elite*gold: 20
Join Date: Oct 2010
Posts: 451
Received Thanks: 259
Quote:
Originally Posted by copz1337 View Post
"Oh Absolutely" nerds these days.
Lol, srry that the math confuses you.
Noobs these days

EDIT: xP i'm sorry, that was a bit harsh. Try and understand it. The result is interesting.
FuriousFang is offline  
Old 10/29/2010, 13:25   #11
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
10 dollars says nobody that has posted in this thread understands it
_tao4229_ is offline  
Old 10/29/2010, 13:32   #12


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by _tao4229_ View Post
10 dollars says nobody that has posted in this thread understands it
Agree.
Korvacs is offline  
Old 10/29/2010, 13:42   #13
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
I don't understand it.
Basser is offline  
Old 10/29/2010, 13:53   #14
 
elite*gold: 0
Join Date: Sep 2008
Posts: 694
Received Thanks: 207
I got lost, sigh. Should get more into coding.
DragonHeart is offline  
Old 10/29/2010, 14:01   #15


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
This doesnt have very much to do with programming, you need to be good at maths to understand this.
Korvacs is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
CABAL PH Try My new Bot Absolutely FREE!!!!!!!
08/27/2008 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 8 Replies
all Pinoyz!!!! try my self made bot!! heres the link trust me scan it if you want - got an update my new version - dont forget to give me -!!!!!!



All times are GMT +2. The time now is 00:36.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.