Returns the crosspoint of lines l1 and l2. If lines don't cross returns null.

<p>Note returns null if lines are parallel and also when lines ate equal.!
@param l1
@param l2
@return
186642
public static Point crossPoint(Line l1, Line l2)
    {
        return crossPoint(l1, l2, null);
    }
1052089
public static final double departure(WayPoint loc1, WayPoint loc2)
    {
        return departure(loc2.getLatitude(), loc1.getLatitude());
    }
902273
def intersection(L1, L2):
    
    D = L1[0] * L2[1] - L1[1] * L2[0]
    Dx = L1[2] * L2[1] - L1[1] * L2[2]
    Dy = L1[0] * L2[2] - L1[2] * L2[0]
    if D != 0:
        x = Dx / D
        y = Dy / D
        return x, y
    else:
        return False
854253
private static Point getIntersection(Shape shape,
                                         Line2D.Double line) {
        if (shape instanceof Ellipse2D) {
            return getEllipseIntersection(shape,
                                          line);
        } else if (shape instanceof Rectangle2D || shape instanceof Path2D) {
            return getShapeIntersection(shape,
                                        line);
        } else {
            // something strange
            return null;
        }
    }
536815
public HitResult intersect(Shape shape, Line line) {
		float distance = Float.MAX_VALUE;
		HitResult hit = null;
		
		for (int i=0;i<shape.getPointCount();i++) {
			int next = rationalPoint(shape, i+1);
			Line local = getLine(shape, i, next);
		
			Vector2f pt = line.intersect(local, true);
			if (pt != null) {
				float newDis = pt.distance(line.getStart());
				if ((newDis < distance) && (newDis > EPSILON)) {
					hit = new HitResult();
					hit.pt = pt;
					hit.line = local;
					hit.p1 = i;
					hit.p2 = next;
					distance = newDis;
				}
			}
		}
		
		return hit;
	}
116911
public JFeatureSpec<T> cross(final String x1, final String x2,
                               final BiFunction<Double, Double, Double> f) {
    Function2<Object, Object, Object> g = JavaOps.crossFn(f);
    return wrap(self.cross(Tuple2.apply(x1, x2), g));
  }
94625
public static String lineToString (Point p1, Point p2)
    {
        return lineToString(p1.x, p1.y, p2.x, p2.y);
    }
203751
public static Bbox intersection(Bbox one, Bbox two) {
		if (!intersects(one, two)) {
			return null;
		} else {
			double minx = two.getX() > one.getX() ? two.getX() : one.getX();
			double maxx = two.getMaxX() < one.getMaxX() ? two.getMaxX() : one.getMaxX();
			double miny = two.getY() > one.getY() ? two.getY() : one.getY();
			double maxy = two.getMaxY() < one.getMaxY() ? two.getMaxY() : one.getMaxY();
			return new Bbox(minx, miny, (maxx - minx), (maxy - miny));
		}
	}
1365571
function intersect_line_line(p1, p2, p3, p4) {
		var denom = ((p4.y - p3.y)*(p2.x - p1.x) - (p4.x - p3.x)*(p2.y - p1.y));

		// lines are parallel
		if (denom === 0) {
			return false;
		}

		var ua = ((p4.x - p3.x)*(p1.y - p3.y) - (p4.y - p3.y)*(p1.x - p3.x)) / denom;
		var ub = ((p2.x - p1.x)*(p1.y - p3.y) - (p2.y - p1.y)*(p1.x - p3.x)) / denom;

		if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {
			return false;
		}

		return new Springy.Vector(p1.x + ua * (p2.x - p1.x), p1.y + ua * (p2.y - p1.y));
	}
84548
public static int sld2awtJoin( String sldJoin ) {
        if (sldJoin.equals(lineJoinNames[1])) {
            return BasicStroke.JOIN_BEVEL;
        } else if (sldJoin.equals("") || sldJoin.equals(lineJoinNames[2])) {
            return BasicStroke.JOIN_MITER;
        } else if (sldJoin.equals(lineJoinNames[3])) {
            return BasicStroke.JOIN_ROUND;
        } else {
            throw new IllegalArgumentException("unsupported line join");
        }
    }
832860
public static void drawLine(Point p1, Point p2, PlotOperator plot)
    {
        drawLine(p1.x, p1.y, p2.x, p2.y, plot);
    }
1103579
def lines_intersect(pt1_p, pt2_p, pt1_q, pt2_q):
    '''
    '''
    #
    # The idea here is to do the cross-product of the vector from
    # point 1 to point 2 of one segment against the cross products from 
    # both points of the other segment. If any of the cross products are zero,
    # the point is colinear with the line. If the cross products differ in
    # sign, then one point is on one side of the line and the other is on
    # the other. If that happens for both, then the lines must cross.
    #
    for pt1_a, pt2_a, pt1_b, pt2_b in ((pt1_p, pt2_p, pt1_q, pt2_q),
                                       (pt1_q, pt2_q, pt1_p, pt2_p)):
        v_a = pt2_a-pt1_a
        cross_a_1b = np.cross(v_a, pt1_b-pt2_a)
        if cross_a_1b == 0 and colinear_intersection_test(pt1_a, pt2_a, pt1_b):
            return True
        cross_a_2b = np.cross(v_a, pt2_b-pt2_a)
        if cross_a_2b == 0 and colinear_intersection_test(pt1_a, pt2_a, pt2_b):
            return True
        if (cross_a_1b < 0) == (cross_a_2b < 0):
            return False
    return True
303754
public static float pointLineDistSq (float px, float py,
                                         float x1, float y1, float x2, float y2) {
        x2 -= x1;
        y2 -= y1;
        px -= x1;
        py -= y1;
        float s = px * y2 - py * x2;
        return (s * s) / (x2 * x2 + y2 * y2);
    }
952639
public DoublePoint Add(DoublePoint point1, DoublePoint point2) {
        DoublePoint result = new DoublePoint(point1);
        result.Add(point2);
        return result;
    }
1432
def distance2_to_line(pt, l0, l1):
    '''
    '''
    pt = np.atleast_1d(pt)
    l0 = np.atleast_1d(l0)
    l1 = np.atleast_1d(l1)
    reshape = pt.ndim == 1
    if reshape:
        pt.shape = l0.shape = l1.shape = (1, pt.shape[0])
    result = (((l0[:,0] - l1[:,0]) * (l0[:,1] - pt[:,1]) - 
               (l0[:,0] - pt[:,0]) * (l0[:,1] - l1[:,1]))**2 /
              np.sum((l1-l0)**2, 1))
    if reshape:
        result = result[0]
    return result
916495
public Deque<Integer> getCrossoverPoints() {
        Collections.shuffle(parameterIndexes);
        List<Integer> crossoverPointLists =
                        parameterIndexes.subList(0, rng.nextInt(maxCrossovers - minCrossovers) + minCrossovers);
        Collections.sort(crossoverPointLists);
        Deque<Integer> crossoverPoints = new ArrayDeque<Integer>(crossoverPointLists);
        crossoverPoints.add(Integer.MAX_VALUE);

        return crossoverPoints;
    }
1128682
public DoublePoint Multiply(DoublePoint point1, DoublePoint point2) {
        DoublePoint result = new DoublePoint(point1);
        result.Multiply(point2);
        return result;
    }