Geometry/Points and Lines/11068.cpp
// return true + intersection point if two lines are intersectio
return true + intersection point if two lines are intersectio
return true + intersection point if two lines are intersectio
point lineIntersect(line l1, line l2) {
    double a = l1.a, b = l1.b, c = l1.c, d = l2.a, e = l2.b, f = l2.c;
    double x, y;
    if (lineRelation(l1, l2) != 2) return point();
    if (fabs(b) < EPS && fabs(a) > EPS) {  
        x = c / a;
        y = (f - d * x) / e;
    } else if (fabs(a) < EPS && fabs(b) > EPS) { 
        y = c / b;
        x = (f - e * y) /d;
    } else {
        y = (c - a * f / d) / (b - a * e / d);
        x = (f - e * y) / d;
    }
    return point(x, y);
}
point lineIntersect ( line l1 , line l2 ) { double a = l1 . a , b = l1 . b , c = l1 . c , d = l2 . a , e = l2 . b , f = l2 . c ; double x , y ; if ( lineRelation ( l1 , l2 ) != 2 ) return point ( ) ; if ( fabs ( b ) < EPS && fabs ( a ) > EPS ) { x = c / a ; y = ( f - d * x ) / e ; } else if ( fabs ( a ) < EPS && fabs ( b ) > EPS ) { y = c / b ; x = ( f - e * y ) / d ; } else { y = ( c - a * f / d ) / ( b - a * e / d ) ; x = ( f - e * y ) / d ; } return point ( x , y ) ; }
return true + intersection point if two lines are intersectio
return true + intersection point if two lines are intersectio
// reta vertical // reta horizontal