Logo Search packages:      
Sourcecode: inkscape version File versions

IntersectorKind Geom::line_segment_intersect ( Geom::Point const &  p00,
Geom::Point const &  p01,
Geom::Point const &  p10,
Geom::Point const &  p11,
Geom::Point result 

Determine whether & where a line segments intersects an (infinite) line.

If there is no intersection, then result remains unchanged.

neither segment is zero-length; i.e. p00 != p01 and p10 != p11.

Definition at line 157 of file geom.cpp.

References line_intersection(), and line_segment_intersectp().

Referenced by rect_line_intersect().

    if(line_segment_intersectp(p00, p01, p10, p11)) {
        Geom::Point n0 = (p01 - p00).ccw();
        double d0 = dot(n0,p00);

        Geom::Point n1 = (p11 - p10).ccw();
        double d1 = dot(n1,p10);
        return line_intersection(n0, d0, n1, d1, result);
    } else {
        return no_intersection;

Generated by  Doxygen 1.6.0   Back to index