public Vector getIntersection(Edge other, boolean ray) {
		double dx1 = end.x - start.x;
		double dy1 = end.y - start.y;
		double dx2 = start.x - other.start.x;
		double dy2 = start.y - other.start.y;
		double dx3 = other.end.x - other.start.x;
		double dy3 = other.end.y - other.start.y;
		if(dy1 / dx1 != dy3 / dx3) {
			double d = dx1 * dy3 - dy1 * dx3;
			if(d != 0) {
				double r = (dy2 * dx3 - dx2 * dy3) / d; 
				double s = (dy2 * dx1 - dx2 * dy1) / d; 
				if(r >= 0 && (ray || r <= 1)) {
					if(s >= 0 && s <= 1) {
						return new Vector(start.x + r * dy1, start.y + r * dy1);
					}
				}
			}
		}
		return null;
	}