  We give a necessary and sufficient condition on a $d$-dimensional affine
subspace of $\mathbb{R}^n$ to be characterized by a finite set of patterns
which are forbidden to appear in its digitization. This can also be stated in
terms of local rules for canonical projection tilings, or subshift of finite
type. This provides a link between algebraic properties of affine subspaces and
combinatorics of their digitizations. The condition relies on the notion of
{\em coincidence} and can be effectively checked. As a corollary, we get that
only algebraic subspaces can be characterized by patterns.
