Introduction

The standard Mathematica function ParametricPlot3D requires the parameter domain to be a rectangle. Suggestions for handling nonrectangular domains usually involve triangulation of the domain and a version of the function TriangularSurfacePlot from the ComputationalGeometry package (see [1] and [5]). The package SurfaceClip.m takes a different approach. A rectangle containing the parameter domain is first paved with a set of rectangles, which are then clipped to the shape of the domain. The parametrization functions are then applied to the vertices of the clipped polygons.

As an example, Figure 1 shows a portion of a complicated surface called the bisectrix of the tetrahedron (see [2], [3], [4]). The three pieces of the figure are congruent to the piece of surface shown in Figure 2.

Figure 1. Three surface patches.

Figure 2. A single patch.

The single patch has a reasonably simple parametrization (, , ), but to plot the edges correctly the parameters must be restricted to the portion of the unit square in the p-q plane lying above the hyperbola (Figure 3). To draw Figure 2, a grid of rectangle polygons covering the square was first defined (Figure 3). This polygonal grid was then clipped using the expression , giving the set of polygons shown in Figure 4. Clipping is accomplished by discarding polygonal vertices lying in the region where is positive. Finally, the parametric equations were applied, mapping each remaining polygon to a three-dimensional polygon. (The three pieces of Figure 1 are images of the piece of Figure 2. They were computed using homogeneous transformations from the Wickham-Jones packages [5].)

Figure 3. Paving a rectangle.

Figure 4. Clipped paving.

The package SurfaceClip.m contains the function ClippedParametricPlot3D that automates this procedure. The function takes four arguments and the syntax is that of the built-in function ParametricPlot3D with an extra argument added. The first three arguments of the two functions are the same, defining the parametrization functions and a rectangle in the parameter plane. The last argument is a list of clipping functions that are applied in succession.