psychos.visual.units.NormalizedUnits#
- class psychos.visual.units.NormalizedUnits(window: Window)[source]#
Bases:
UnitA unit system that normalizes coordinates and sizes with respect to the window dimensions.
In this normalized system: - (1, 1) represents the top-right corner of the window. - (-1, -1) represents the bottom-left corner of the window. - (0, 0) represents the center of the window. - (-1, 1) represents the top-left corner of the window. - (1, -1) represents the bottom-right corner of the window.
Methods
__init__(window)from_name(name, window)Instantiate a unit system class by name or return the instance if already provided.
inverse_transform(x, y)Convert coordinates from pixel values to units.
inverse_transform_size(width, height)Convert size from pixel values to units.
transform(x, y)Convert coordinates from units to pixel values.
transform_size(width, height)Convert size from units to pixel values.
- inverse_transform(x: int, y: int) Tuple[float, float][source]#
Convert coordinates from pixel values to units.
- inverse_transform_size(width: int, height: int) Tuple[float, float][source]#
Convert size from pixel values to units.