メインコンテンツまでスキップ

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:

uncenter(v)=v×0.5+0.5\text{uncenter}(v) = v \times 0.5 + 0.5

This linear transformation maps:

  • -10
  • 00.5
  • 11

Available Functions

FunctionInput TypeOutput TypeDescription
uncenterFloatfloatfloatTransform single value
uncenterVec2vec2vec2Transform 2D vector
uncenterVec3vec3vec3Transform 3D vector
ライブエディター
const fragment = () => {
      const centered = uv.sub(0.5).mul(2)
      const normalized = uncenterVec2(centered)
      return vec4(normalized, 0.5, 1)
}