Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainWindow::on_lineEditA_textChanged(QString str)
- {
- eq1.a.set(str);
- }
- void MainWindow::on_lineEditB_textChanged(QString str)
- {
- eq1.b.set(str);
- }
- void MainWindow::on_lineEditC_textChanged(QString str)
- {
- eq1.c.set(str);
- }
- void MainWindow::on_lineEditD_textChanged(QString str)
- {
- eq1.d.set(str);
- }
- void MainWindow::on_lineEditE_textChanged(QString str)
- {
- eq1.e.set(str);
- }
- void MainWindow::on_lineEditF_textChanged(QString str)
- {
- eq1.f.set(str);
- }
- void MainWindow::on_lineEditA_2_textChanged(QString str)
- {
- eq2.a.set(str);
- }
- void MainWindow::on_lineEditB_2_textChanged(QString str)
- {
- eq2.b.set(str);
- }
- void MainWindow::on_lineEditC_2_textChanged(QString str)
- {
- eq2.c.set(str);
- }
- void MainWindow::on_lineEditD_2_textChanged(QString str)
- {
- eq2.d.set(str);
- }
- void MainWindow::on_lineEditE_2_textChanged(QString str)
- {
- eq2.e.set(str);
- }
- void MainWindow::on_lineEditF_2_textChanged(QString str)
- {
- eq2.f.set(str);
- }
- double f1(double a1, double b1, double c1, double d1, double e1, double f1, double x, double y)
- {
- return a1x^2 + b1xy + c1y^2 + d1x + e1y + f1;
- }
- double f2(double a2, double b2, double c2, double d2, double e2, double f2, double x, double y)
- {
- return a2x^2 + b2xy + c2y^2 + d2x + e2y + f2;
- }
- double f1_x(double a1, double b1, double d1, double x, double y)
- {
- return a1x + b1y + d1;
- }
- double f1_y(double b1, double c1, double e1, double x, double y)
- {
- return b1x + c1y + e1;
- }
- double f2_x(double a2, double b2, double d2, double x, double y)
- {
- return a2x + b2y + d2;
- }
- double f2_y(double b2, double c2, double e2, double x, double y)
- {
- return b2x + c2y + e2;
- }
- int XPEHOBmain()
- {
- double W = 0, D1 = 0, D2 = 0, x = 0.5, y = 0.5, E = 0.001, xk = 0, yk = 0;
- int _count = 0;
- while (_count < 32000)
- {
- W = f1_x(a1,b1,d1,x,y)*f2_y(b2,c2,e2,x,y) - f2_x(a2,b2,d2,x,y)*f1_y(b1,c1,e1,x,y);
- D1 = f1(a1,b1,c1,d1,e1,f1,x,y)*f2_y(b2,c2,e2,x,y) - f2(a2,b2,c2,d2,e2,f2,x,y)*f1_y(b1,c1,e1,x,y);
- D2 = f2(a2,b2,c2,d2,e2,f2,x,y)*f1_x(a1,b1,d1,x,y) - f1(a1,b1,c1,d1,e1,f1,x,y)*f2_x(a2,b2,d2,x,y);
- if (W == 0)
- {
- qDebug() << "error";//why??
- break;
- }
- xk = x - D1/W;
- yk = y - D2/W;
- if ((abs(x-xk)+abs(y-yk)) <= E)
- {
- qDebug() << "Done!";
- break;
- }
- else
- {
- x = xk;
- y = yk;
- _count++;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement