uncenter: Centered to Normalized Range Transform
Coordinate transformation from centered to normalized space
The uncenter functions transform coordinates from a centered range [-1, 1] to a normalized range [0, 1]. This is the inverse operation of the center function.
For any input value v
, the transformation applies:
This linear transformation maps:
-1
→0
0
→0.5
1
→1
Available Functions
Function | Input Type | Output Type | Description |
---|---|---|---|
uncenterFloat | float | float | Transform single value |
uncenterVec2 | vec2 | vec2 | Transform 2D vector |
uncenterVec3 | vec3 | vec3 | Transform 3D vector |
ライブエディター
const fragment = () => { const centered = uv.sub(0.5).mul(2) const normalized = uncenterVec2(centered) return vec4(normalized, 0.5, 1) }