public static MapNode crossing(MapNode from, MapNode to,
			Set<MapNode> neighbors, double direction) {
		direction = normalize(direction);

		if (neighbors.size() == 1) {
			return from;
		} else if (neighbors.size() == 2) {
			Iterator<MapNode> iterator = neighbors.iterator();
			MapNode tmp = iterator.next();
			if (tmp == from) {
				return iterator.next();
			} else {
				return tmp;
			}
		} else if (neighbors.size() > 2) {
			Vector2d origin = direction(from, to);
			MapNode result = null;
			double min = Double.MAX_VALUE;

			for (MapNode neighbor : neighbors) {
				Vector2d way = direction(to, neighbor);
				double angle = normalize(angle(origin, way));
				double distance = distance(direction, angle);
				if (min > distance) {
					result = neighbor;
					min = distance;
				}
			}

			return result;
		} else {
			throw new IllegalArgumentException("illegal neighbor count");
		}
	}