liveBook · Manning

Bilinear function

As explained in Geometry for Programmers

A bilinear expression is a polynomial expression that is linear in each of two variables and may contain their product.

A bilinear function is built from two variables, using only their product, each variable separately, and a constant: P(x, y) = a₁xy + a₂x + a₃y + a₄. Each coordinate of a bilinear transformation has its own expression. Although it generalizes rotation, translation, and scale, it is not a linear transformation and does not correspond to matrix multiplication. section 4.2.4 section 8.1.1

In two-dimensional geometry, bilinear functions support several useful operations:

  • Map the four corners of a rectangle or square; those four point correspondences determine the transformation across the whole space. section 8.1.1
  • Create curved, concave images from straight-edged shapes while preserving every straight line. section 4.2.4
  • Interpolate a value on a rectangular grid by performing linear interpolation in one direction, then interpolating the resulting interpolants in the other. section 8.1.2

Interpolating a rectangular grid

Given values z₁₁, z₁₂, z₂₁, and z₂₂ at (0, 0), (0, 1), (1, 0), and (1, 1), first calculate z₁(y) = (1 − y)z₁₁ + yz₁₂ and z₂(y) = (1 − y)z₂₁ + yz₂₂. Then calculate z(x, y) = (1 − x)z₁(y) + xz₂(y). The result is a bilinear interpolant over the square. section 8.1.2

Figure 4.15 A bilinear transformation makes a square into a curvy concave object.
04-15

See how a bilinear transformation turns a standard square into a curvy concave object. section 4.2.4

How Geometry for Programmers covers it

How deep it goes
Derives coordinate formulas, four-point determination, and nested interpolation, while deferring broader higher-order transformations.
Examples
Demonstrates square deformation, rectangle corner mapping, and four-corner z-value interpolation.
What it assumes
Builds from linear polynomials and one-dimensional linear interpolation before extending them to two variables.
What you can do after
Apply bilinear transformations and interpolants via SymPy-defined equations or nested one-dimensional interpolation.
How it connects
Connects bilinear functions with linear interpolation, affine transformations, projective transformations, and polynomial transformations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.