m3Dmanual.pdf or better m3Dmanual.ps.gz
shfilloperator. It is not so complicated in fact, it is just heavy enough to deserve higher level programming. I've made some trials with my
BezierPatchcontrol sequence: it is like a trompe-l'oeil, since it is drawing a flat picture in 3-dimensional space.
OnDepth; ... endOnDepth(
m3Dplain.mp) uses this algorithm. It allows to sort up to (theorically!)
ropewith the name
tubeand making some enhancements suggested by Jens Schwaiger, I've made recently greater enhancements which allow to draw knots without any question about what is before what... On the left, a trefoil knot obtained by “tube”, on the right, the same knot obtained with “etube” (enhanced tube).
BezierPatchhas been introduced. See the tea pot below.
MetaFont and MetaPost are nice languages for drawing two dimensional objects like fonts or technical drawings. They are certainly the most natural tools when using the TeX formatting system. So that TeX' users may learn and use them for their common formatting tasks.
The matter is that we have to learn also many other communication technics just as Web-stuff. Doing all from TeX-MetaFont(Post) basic knowledge would be for some people (at least for me) quite appreciable.
One thing I like is three dimensional animations. Many years ago, Denis Roegel has created his own MetaPost's format for such things, but it was too complicated for me. So I felt like designing my own extension of MetaPost language at least for some simple three dimensional pictures.
I do not attempt to provide some definitive package. I have not even really written a real or complete manual for my programs. I think that any acquainted MetaPost user may understand what they contain by reading them and find maybe some ideas for writting his/her owns.
Among links on this subject, one finds also Luis Nobre's FeatPost, Laurence Finston's GNU 3DLDF, Denis Roegel's MP2GL, ... nice things. It is also a pleasure to link this page to mold3D, a very impressive MetaPost contribution for drawing molecules due to Yang Wang.
In order of appearence, one has: a quite strange chair (suggested by Jens Schwaiger, see also this page), the Viviani's window, 4 steps of the Sierpinski-Menger sponge, 2 use of a ‘rope’, the sponge again, the gasket (level 5), some curious thing using ‘revolution’, some C6, nothing in particular.
Since, the more pictures one designs, the more efficient programming becomes, I've come to those very non-perfect and unstable programs which are included in the archive m3D.tar.gz:
Things change from time to time. At the beginning of year 2005, I
QuickSort implementation: its arguments form a
list and its output is the corresponding ordered list stored into the
SortedList control sequence. Sorting is done by handing
sublists which are stored in temporary control sequences and passed
through recursion as lists. This is nothing else but lists. Formerly I
used temporary strings to do part of the job which was quite clumsy
and slow. The size of the lists is limited by the size of MetaPost
input stack (150 on my computer). For larger lists one should design
its own sort algorithm.
Still about sorting and strings there is the
environment. Its former implementation was
OnDepth; Refpoint ... Action "..."; ... endOnDepth;
Its role is to perform various actions in an order depending of the
depth with respect to the observer of the associated reference points.
The problem was to store the text of every action and to be able to
use it in the proper order when executing
I stored actions into temporary strings which would be then scanned by
scantokens. First this was ugly, then it was also
inefficient since the text of each action could not have contained
symbolic tokens as macro or loop parameter. Now the syntax is
OnDepth; Refpoint ...; Action (...); ... endOnDepth;
One must notice that a semicolon must follow the argument of
Refpoint. The argument of
Action is a
delimited text (no more a string). It is stored into a variable
control sequence. The trick is that the suffix of this control
sequence could not have been a number, I had to replace it by a
pseudo-romannumeral (here is the trick).
A nice way for drawing the Sierpinski-Menger sponge as been suggested to us by Elvire Scheibling: in place of removing stuff from an initial cube, just take the smallest cube, copy it 20 times to get the first level sponge, and do the same copying again with this new cube. The problem is that this construction always requires a geometrically growing memory room. By the way I recently changed the implementation of the Sierpinski-Menger sponge (m3Dlib01.mp). The program is much heavier but it leads to some slightly lighter pictures.
Even for simple composite objects like this sponge, sorting is needed. I'm grateful to Pascal Grosse for his brightfull explanations of the Quick Sort algorithm.
Making an animation is merging many pictures into a movie. The starting point of the control sequences I use for that was the 3D package of Denis Roegel.
A very few people tried to use my macros and gave me, in some way, some feed back. They are usually real advanced MetaPost users (and will recognize them). I warmly thank them for the interest they have for my attempts in 3 dimensions.