
#include "Integral.h"


Integral::Integral(double _t1, double _t2, double _t3, double _t4, double _b)
{
#define PI (3.141592654)
	
t1 = _t1;
t2 = _t2;
t3 = _t3;
t4 = _t4;
b = _b;
}

void int_function_1_func(double x, double xminusa, double bminusx, double &y, void *ptr) 
{

double g1 = t1-t3*cos(x);
double g2 = t3*t3*(sin(x)*sin(x)) + (t2-t4)*(t2-t4);
double g3 = t3*cos(x);
double g4 = t3*sin(x);
double g5 = t2 - t4;
double gf = sqrt(g1()*g1() + g2());
double M1 = 2*g5()*g3()*log(g1()+gf()) + (1/4)*(3*(g3()*g3()-g4()*g4()) - (g1()+g3())*(g1()+g3()))*log((gf()-g5())/(gf()+g5()));
double M2 = -2*atan((g1()*(g1()+gf())+g4()*g4())/(g4()*g5())) + atan((g5()+g1()+gf())/g4()) - atan((-g5()+g1()+gf())/g4());

y = cos(x)*(gf() + g3()*log(g1()+gf()));

}

double Integral::N1()
{
	double a = 0;
    double b = PI;
    autogkstate s;
    double v;
    autogkreport rep;

    autogksmooth(a, b, s);
    alglib::autogkintegrate(s, int_function_1_func);
    autogkresults(s, v, rep);

    return v;

}
