imageToNormalizedCoordinates

Converts a pixel coordinate to a normalized coordinate in 0, 1 range. Uses (dimension - 1) as divisor so that the first pixel maps to 0.0 and the last pixel maps exactly to 1.0, making round-trips through operations like rotation around (0.5, 0.5) mathematically correct. Returns 0.0 if dimension is 1 or less (degenerate image — no meaningful range).

Parameters

pixelCoord

the pixel coordinate to convert

dimension

the image dimension (width or height) in pixels