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

◆ unit_square()

std::function< glm::vec2(glm::vec2)> MayaFlux::Kinesis::unit_square ( AABB2D  bounds)
inlinenoexcept

Unit-square coordinates of a point within bounds.

Inverse to position_picker, which maps [0,1]² onto the region.

Parameters
boundsRegion in NDC.
Returns
Callable producing a value in [0, 1]².

Definition at line 61 of file Projection.hpp.

62{
63 const glm::vec2 origin = bounds.min;
64 const glm::vec2 extent { bounds.width(), bounds.height() };
65
66 return [origin, extent](glm::vec2 p) -> glm::vec2 {
67 if (extent.x <= 0.F || extent.y <= 0.F)
68 return glm::vec2(0.F);
69 return glm::clamp((p - origin) / extent, glm::vec2(0.F), glm::vec2(1.F));
70 };
71}
float height() const noexcept
Definition Bounds.hpp:38
float width() const noexcept
Definition Bounds.hpp:37

Referenced by MayaFlux::Portal::Forma::Geometry::position_picker().

+ Here is the caller graph for this function: