This article is also available in Japanese.

The ability to write your own user-defined surfaces is an important feature in ZEMAX. It is described in several articles in the "Programming ZEMAX" hierarchy at http://www.zemax.com/kb/categories/Tutorials/Programming-ZEMAX/ . Specifically, http://www.zemax.com/kb/articles/58/1/How-to-Compile-a-User-Defined-Surface gives a detailed description of how to write and compile a user-defined surface.

This article describes how to use Waterloo Maple to help in the process of writing a user-defined surface. Maple is a powerful mathematics package, which can be used to produce optimized C (and other language) code from entered equations.

In this article I will describe creation of a simple surface based on the Odd Aspherical shape with additional decentered Gaussian sag. Such a surface is useful for tolerancing of certain types of optical elements, mostly for modelling of local irregularities. Maple will be used to produce the code needed to compute the surface sag and surface normal vector at any point on the surface.