X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fgeom.cpp;h=bc161bf9fc74b10fa70547fe0a4d26e4b148481c;hb=2d5f45472d142796f87b8b737cc0b56fc9de3bf7;hp=2749d6d7d34fee19dc04d88f8c0a485a4f796468;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/geom.cpp b/src/geom.cpp index 2749d6d7d..bc161bf9f 100644 --- a/src/geom.cpp +++ b/src/geom.cpp @@ -23,34 +23,34 @@ * convert lines to form * ax + by = c * dx + ey = f - * + * * ( * e.g. a = (x2 - x1), b = (y2 - y1), c = (x2 - x1)*x1 + (y2 - y1)*y1 * ) - * + * * In our case we use: * a = n0.x d = n1.x * b = n0.y e = n1.y * c = d0 f = d1 - * + * * so: - * + * * adx + bdy = cd * adx + aey = af - * + * * bdy - aey = cd - af * (bd - ae)y = cd - af - * + * * y = (cd - af)/(bd - ae) - * + * * repeat for x and you get: - * + * * x = (fb - ce)/(bd - ae) \endverbatim - * + * * If the denominator (bd-ae) is 0 then the lines are parallel, if the - * numerators are then 0 then the lines coincide. + * numerators are then 0 then the lines coincide. * - * \todo Why not use existing but outcommented code below + * \todo Why not use existing but outcommented code below * (HAVE_NEW_INTERSECTOR_CODE)? */ IntersectorKind intersector_line_intersection(NR::Point const &n0, double const d0, @@ -69,12 +69,12 @@ IntersectorKind intersector_line_intersection(NR::Point const &n0, double const return PARALLEL; } } - + double Y = n0[NR::X] * d1 - n1[NR::X] * d0; - + result = NR::Point(X, Y) / denominator; - + return INTERSECTS; }