Map an exact continuous point to the pixel cell that contains it by taking the floor of each coordinate.

Example

Use floor to map a continuous point to the pixel cell that contains it.

highlighted = computed this step

Step 1 — Start with a pixel grid

Start with a continuous point over the grid.

use floor to choose the cell\text{use floor to choose the cell}
Continuous point to pixelThe point floors to row 2, column 2.01234501234P

Step 2 — Floor the x-coordinate

Floor x to choose the pixel column.

73=2\lfloor \frac{7}{3} \rfloor= \hl{2}

Step 3 — Floor the y-coordinate

Floor y to choose the pixel row.

114=2\lfloor \frac{11}{4} \rfloor= \hl{2}

Step 4 — Highlight the pixel

Highlight the cell containing the point.

pixel=(2,2)pixel=( \hl{2} , \hl{2} )
Continuous point to pixelThe point floors to row 2, column 2.01234501234P
plot-point-to-pixel A pixel cell is addressed by an integer row and column. The floor function chooses the cell containing a non-integer coordinate.