Skip to content

clipFromView

clipFromView(t, width, height): Float32Array

Defined in: webgl/transform.ts:15

Build a column-major 3x3 matrix mapping reference pixel coordinates (origin top-left, y down, the space d3 projections / geoPath produce) through a d3-zoom transform and into WebGL clip space [-1, 1] (origin center, y up).

Pixel -> zoomed pixel: px’ = kpx + x, py’ = kpy + y Zoomed pixel -> clip: cx = px’/W2 - 1, cy = 1 - py’/H2 (y flipped)

Composed (cx,cy,1) = M (px,py,1), so pan/zoom is a single uniform update and the GPU never re-projects geometry.

ViewTransform

number

number

Float32Array