MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ normalize_coords() [2/2]

MAYAFLUX_API glm::vec3 MayaFlux::normalize_coords ( double  window_x,
double  window_y,
uint32_t  window_width,
uint32_t  window_height 
)

Convert window pixel coordinates to normalized device coordinates (NDC)

Parameters
window_xX coordinate in window space [0, width]
window_yY coordinate in window space [0, height] (top-left origin)
window_widthWindow width in pixels
window_heightWindow height in pixels
Returns
NDC coordinates as vec3 (x, y, 0.0) in range [-1, +1] (center origin, +Y up)

Window coordinates use top-left origin with Y increasing downward. NDC coordinates use center origin with Y increasing upward. Z is always set to 0.0 for 2D screen-space positions.

Example: normalize_coords(0, 0, 800, 600) → (-1.0, -1.0, 0.0) // top-left normalize_coords(400, 300, 800, 600) → (0.0, 0.0, 0.0) // center normalize_coords(800, 600, 800, 600) → (+1.0, +1.0, 0.0) // bottom-right

Definition at line 20 of file Windowing.cpp.

22{
23 return Kinesis::to_ndc(window_x, window_y, window_width, window_height);
24}

References MayaFlux::Kinesis::to_ndc().

+ Here is the call graph for this function: