Struct RasterMirrorBorder

Mirror border policy using edge-inclusive symmetric reflection.

struct RasterMirrorBorder;

For one axis with extent N > 0, coordinates follow a 2*N period.

For N = 4 the infinite index pattern is:

... 2 3 | 3 2 1 0 | 0 1 2 3 | 3 2 1 0 | 0 1 ...

Thus both edge samples are repeated at reflection boundaries.

Equivalently, with r = euclideanModulo(c, 2*N):

r < N -> r otherwise 2*N - 1 - r

This definition intentionally distinguishes raster-d mirror semantics from alternative reflect-without-edge-repeat conventions.

The policy is undefined for zero extent and an operation must reject such a request before attempting mirror mapping.

Example

Example selecting edge-inclusive mirror border semantics.

import raster;
static assert(RasterMirrorBorder.kind == RasterBorderKind.mirror);