La = vertices[0].y - vertices[2].y;
Lb = vertices[0].x - vertices[2].x;
Lc = vertices[0].x*vertices[2].y - vertices[2].x*vertices[0].y;
LLa = vertices[1].y - vertices[3].y;
LLb = vertices[1].x - vertices[3].x;
LLc = vertices[1].x*vertices[3].y - vertices[3].x*vertices[1].y;
d = La*LLb - LLa*Lb;
cout << "Cross .x= " << (Lb*LLc - LLb*Lc) / d << endl;
cout << "Cross.y= " << (Lc*LLa - LLc*La) / d << endl;
cross.x = abs((Lb*LLc - LLb*Lc) / d);
cross.y = abs((Lc*LLa - LLc*La) / d);
sprintf(mystr, "%lf, %lf", cross.x,cross.y);
参考了大牛的python 实现