Map a screenshot target
Implement map_point(point, image_size, region). The image has width and height; region is logical origin x, origin y, width, height. Map the image point with independent x and y scale plus origin translation. Require finite numeric values and strictly positive dimensions; require half-open image bounds. Return a float-compatible coordinate pair. Origins may be negative. Raise ValueError for invalid inputs. No pointer movement occurs.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
EXAMPLE 1
Input(600,100), image=(800,400), region=(100,50,400,200)
Output(400.0,100.0)
EXAMPLE 2
Input(0,0), image=(10,10), region=(-20,5,100,100)
Output(-20.0,5.0)
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor