def start_target_to_space(start, target, length, width):
    """
    Create a state space for RRT* search given a start, target and
    length / width buffer.

    Args:
        start: tuple of form (x, y)
        target: tuple of form (x, y), (range_x, range_y)
        length: float specifying length to buffer
        width: float specifying width to buffer

    Returns:
        state space tuple of form (origin_x, origin_y), (range_x, range_y)
    """
    origin = (min(start[0], target[0][0] + length / 2) - length,
              min(start[1], target[0][1] + width / 2) - width)
    bounds = (max(start[0], target[0][0] + length / 2) - origin[0] + width,
              max(start[1], target[0][1] + width / 2) - origin[1] + width)
    return origin, bounds