11:00-12:00 M W F
In the course this fall, as in previous years,
I will show how mathematics and
computers can be used together to produce
graphics of mathematical interest.
The primary programming language to be
used is PostScript. It is ideal for this purpose
because its imaging model uses
affine (and even, implicitly, projective)
geometry in a crucial manner.
Elementary 3D graphics including perspective, and
perhaps something about the regular solids, will also be discussed.
A 3D extension to PostScript will be introduced for this purpose.
Towards the end of the term, students
will have to propose and carry out their own projects.
You can even look at some previous years' projects:
There are therefore two components to the course:
(1) Euclidean geometry and (2) graphics design,
but of course they interact. Geometry is required to
produce graphics, and graphics can be used to explain geometry.
M308 - Fall 1996.
These were among the earliest a class ever did,
and they wouldn't be acceptable now becuase of their
low mathematical content. They do illustrate in many cases
a high technical level.
- Fall 1999. These are of much higher mathematical quality,
although the quality varies widely. A few (Dawson, Ting)
The principal sources are available on the Internet.
Students will be
given accounts in the Mathematics Department undergraduate
computer laboratory, and will also be able to
run GhostScript or GhostView
on PC-compatible machines or Macintoshes elsewhere.
The documentation below is usually in PDF
format, but occasionally in PostScript.
You can obtain a PostScript interpreter at the
GhostView & GhostScript home pages.
For PDF files
Acrobat Reader is available from Adobe.
We have PostScript help on our
local help facility.
In addition, the following are available on line:
More links to information on PostScript can be found at
Luc Devroye's PS
The diagnostic quiz
Second homework - due Friday, September 20.
How to hand in programs
Problems with the first homework:
- Every PostScript file must start with the two
(as emphasized in §5 of Chapter 1 of the
It might run correctly in gsview without these
characters, but it probably won't print
and it won't open correctly as a .ps file inside
- For Question #4, there will be no picture and no display in
the graphics window. Nonetheless,
put your procedure and your sample usage code on a separate page.
If you use = or == there
will be a message displaying in a message window.
You can see the Message Window with File/Open Message Window
or by pressing key "m" with the window active.
There are special problems with computers running Windows:
- To write PostScript files, use NotePad,
because more sophisticated word-processors such as Word will
... well, process your words, and what you
want is the plainest possible text. Unprocessed text.
- To get your file to have a name whatever.ps, save it as
a text file, which will likely give it an extension .txt.
Then rename it (say, in Explorer) to have an extension
.ps. (That all those Microsoft programs insist on the .txt
extension is yet another example of how Microsoft knows
better than you do what you want to do. Not.)
- To run your files in ghostscript,
associate the extension .ps to
the program ghostscript (in Explorer). Then when you click on
a file with that extension, it will open it in ghostscript.
There are other programs you might associate to this extension,
but in these (for example gsview) there is a way to
open the file from within the program itself.
This is not possible in gs, and as far as I can see this is the
only way to run a PostScript program in gs on a Windows machine.
The reason I want you to try running your files in gs is
that it is a lowest common denominator among environments,
whereas for gsview you may have customized your environment in
a special way. For more information,
look at this
tip, or search in google
for something like "windows explorer associate extensions".
You can find more detailed instructions for how to deal with
ghostscript (as opposed to gsview) on Windows machines at the
home page. Also, when ghostscript is installed,
it puts a copy of the help file
Use.htm on your system.
At the site ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/
can be found older versions of gsview, in case you have trouble with one version.
These may require older versions of ghostscript, too. (For Windows, you'll want an .exe file.)
- It seems that ghostscript is not
available separately from gsview
for OS 9. I guess we'll just have to live with that.
- A nearly perfect exposition of Euclid I.35
by one of this term's students.
Third homework - due Monday, October 7.
Fourth homework - due Monday, November 4.
Fifth (and last) homework - due Friday, November 25.
Some sample 3d programs. These are a sequence of programs
illustrating a few tricks of the ps3d
package. Several are animated by page-turning. One thing to realize
is that 2D and 3D graphics commands should be kept separate,
because they affect different parts of
the pipeline that turns ps3d commands into marked points on a page.
- [ 3dA.ps ] A simple unit square with corners
at (0, 0), (1, 0), (1, 1), (0, 1),
seen flat on in `wire frame', and in orthogonal projection.
- [ 3dA.ps - source code ]
- [ 3dB.ps ] The same
square but rotated 45 degrees around
the y axis, and in perspective.
- [ 3dB.ps - source code ]
- [ 3dC.ps ] Now animated in a loop, rotating around the
- [ 3dC.ps - source code ]
- [ 3dD.ps ] With the rotation axis shown.
- [ 3dD.ps - source code ]
- [ 3dE.ps ] Now the square is
rotating around its central vertical axis. It demonstrates that
the effect of coordinate changes in ps3d as in ordinary PS is
to move the frame of the coordinate system in which you are drawing.
Note that the original square itself has been shifted left one-half unit.
- [ 3dE.ps - source code ]
- [ 3dF.ps ] A rotating 2-sided square,
with different sides shown by something special to this figure.
- [ 3dF.ps - source code ]
- [ 3dG.ps ] The same effect, but by a more
complicated and versatile technique, using the notion
of a face of a 3d figure as an array of points plus visibility function.
- [ 3dG.ps - source code ]
- [ 3dH.ps ] With shading from a light source.
- [ 3dH.ps - source code ]
- [ 3dI.ps ] With shadows (from a different light source).
- [ 3dI.ps - source code ]
- Some advice from a student on how to set file inclusion correctly
in PostScript. I would appreciate any reports on how this works.
- A good site for project ideas - Alex
Bogomolny's cut-the-knot site