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

◆ from_pixel()

static AABB2D MayaFlux::Kinesis::AABB2D::from_pixel ( float  x,
float  y,
float  w,
float  h,
uint32_t  win_w,
uint32_t  win_h 
)
inlinestaticnoexcept

Construct from pixel-space top-left rect, converted to NDC.

Parameters
xLeft edge in pixels.
yTop edge in pixels (top-left origin, +Y down).
wWidth in pixels.
hHeight in pixels.
win_wWindow width in pixels.
win_hWindow height in pixels.

Definition at line 66 of file Bounds.hpp.

69 {
70 auto nx = [&](float px) {
71 return (px / static_cast<float>(win_w)) * 2.0F - 1.0F;
72 };
73 auto ny = [&](float py) {
74 return 1.0F - (py / static_cast<float>(win_h)) * 2.0F;
75 };
76 return { .min = glm::vec2(nx(x), ny(y + h)), .max = glm::vec2(nx(x + w), ny(y)) };
77 }
uint32_t h
Definition InkPress.cpp:28

References h, and min.