This article presents mathematical tools for computer-generated ornamental patterns, with a particular attention payed to Islamic patterns. The article shows how, starting from a photo or a sketch of an ornamental figure, the designer analyzes its structure and produces the analytical representation of the pattern. This analytical representation in turn is used to produce a drawing which is integrated into a computer-generated virtual scene. The mathematical tools for analysis of ornamental patterns consist of a subset of tools usually used in the mathematical theory of tilings such as planar symmetry groups and Cayley diagrams. A simple and intuitive step-by-step guide is provided.