The GNU 3DLDF Website

Author: Laurence D. Finston.

This copyright notice applies to the text and source code of this web site, and the graphics that appear on it. The software described in this text has its own copyright notice and license, which can be found in the distribution itself.

Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 The Free Software Foundation

Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of this license is included in the file COPYING.TXT

Last updated: August 18, 2008.

[Dodecahedron Logo]


Table of Contents

Top
Introduction
Late Breaking News
Old News
The 3DLDF Language
Sources
CWEB Sources
Development Versions
Current Sample
Distribution
Documentation
Focuses (Under Construction)
Complex Numbers (Under Construction)
Matrices (Under Construction)
Arcs (Under Construction)
Conic Sections
Ellipses (Under Construction)
Circles
Parabolæ
Hyperbolæ
Polyhedra
Cuboids
Regular Platonic Polyhedra (Under Construction)
Semi-Regular Archimedean Polyhedra (Under Construction)
Great Rhombicosidodecahedron
Catalan Solids (Archimedean Duals) (Under Construction)
Rhombic Triacontahedron
Polyhedron Models
Quadric Surfaces (Under Construction)
Cones
Cylinders (Under Construction)
Ellipsoids
Spheres
Paraboloids (Under Construction)
Elliptical Paraboloids (Under Construction)
Hyperbolic Paraboloids (Under Construction)
Hyperboloids (Under Construction)
One-Sheet Hyperboloids (Under Construction)
Two-Sheet Hyperboloids (Under Construction)
Wave Forms
Prime Numbers
Origami and Paper-Folding
Sundials
Converting EPS Files
Converting TeX Text to Images
Graph Paper (Plain and Perspective)
Animation
Flipbooks
Manga Patterns (Screen Tone)
Code Samples and Images
Mailing lists
File Permissions
Reverting Buffers
Links
Contact

Back to top

Introduction

GNU 3DLDF is a package for three-dimensional drawing with MetaPost output. GNU 3DLDF 1.2.0, the collective name for my development versions , implements an interpreter for a METAFONT-like language. GNU 3DLDF is intended, among other things, to provide a convenient way of creating 3D graphics for inclusion in TeX documents. It can also be used for creating animations, which can contain text typeset using TeX.


Back to contents
Back to top

Late Breaking News

2008.08.18.
Added more examples of interference patterns and a flipbook with a cycloid pattern.

2008.08.10.
Started working on plans for a knitted dodecahedron model.

Added a flipbook with interference patterns.


Back to contents
Back to top

Old News

2007.12.18.
I've started working on sets of functions and parser rules for complex numbers and matrices. They use data types and functions defined in the GNU Scientific Library. GNU 3DLDF now links to this library if it is available. All code using the GSL is conditionally compiled, so 3DLDF should fail gracefully if the GSL is not available and a user tries to use any features that require it.

2007.12.18.
I have also added web pages for Complex Numbers and Matrices, but they are both under construction.

2007.11.08.
Started working on plans for a cardboard dodecahedron model with sundial faces. So far, I've only calculated the dial for a single face. However, there are diagrams illustrating the method. The files can be found on the Polyhedron Models page (Dodecahedra) or on the Sundials page (Dodecahedron Model).

This news not old enough for you? Then try some Even Older News.


Back to contents
Back to top

Sources

The complete sources for GNU 3DLDF are available from the CVS repository for the 3DLDF project on the GNU Project's software development site Savannah. The C++ program code is in the CWEB subdirectory.

CWEB Sources

I've written the C++ code using Donald Knuth and Silvio Levy's CWEB System of Structured Documentation. The files with the extension .web contain the C++ code for the main program. The files with the extension .w contain the GNU Bison code for the parser. Both kinds of files also contain documentation written using TeX .

If you want to get started reading the source code, the main() function is in main.web.

If you check the CWEB subdirectory, you will notice that it contains very few header files. These are generated from the .web files by ctangle, which is part of the CWEB package.

GNU 3DLDF is built incrementally. That is, the source files are ctangled and compiled in a particular order. As a consequence, the header files become available as the .web files are ctangled. loader.web is the first .web file to be ctangled and compiled. Of the header files belonging to the GNU 3DLDF package, it only includes config.h, which is generated by the configure script. pspglb.web is the next file to be processed, and includes loader.h. creatnew.web follows, and includes loader.h and pspglb.h. And so on. main.web is the last .web file to be ctangled and compiled, and includes all of the header files generated from the other .web files. The order in which the header files are included in main.web reflects the order in which the corresponding CWEB files are processed: loader.web, pspglb.web, creatnew.web, gsltmplt.web, io.web, colors.web, transfor.web, pens.web, etc.

For information about the parser, see the 3DLDF language page.


Back to contents
Back to top

Development Versions

2005.11.09.
Announcement: GNU 3DLDF Development Versions

I now strongly recommend that users use my development versions, collectively numbered 1.2.0, rather than Release 1.1.5.1. 1.2.0 is interactive, and therefore a lot easier and more fun to use than 1.1.5.1. I've also added a lot of features since I released 1.1.5.1. Click here for instructions on obtaining 1.2.0.

I'd like to release a new stable version of GNU 3DLDF, but I need to completely rewrite the manual. This is a very big job, and requires a large block of time for uninterrupted work—something I don't have at the moment.

While I'm well aware of how much better it would be if there was a manual, it is nonetheless possible to learn how to use 1.2.0 without one. The files sample0.ldf, sample1.ldf, and sample2.ldf contain many examples of how to use 1.2.0, I've been adding explanations and examples to these webpages, and I'm very willing to answer questions addressed to the help-3dldf-*-AT-*-gnu.org mailing list. (Replace -*-AT-*- with @ for the email address.) Please note that you must subscribe in order to use this mailing list: In order to keep spam out, all posts from non-subscribers are automatically discarded. See Mailing lists for more information and instructions on subscribing. However, if you don't wish to subscribe, you may contact me directly.

Current Sample

2007.10.29.
This section contains links to the files that make up the current sample. PLEASE NOTE: The links are to the entries for these files in the CVS repository, not to the files themselves! The most recent version of these files, or any earlier version, can be viewed or downloaded from the webpage for any given file. The file `currsmpl.tgz' contains all of the files in the form of a tarball, i.e., a compressed (gzipped) archive file. The CVS repository entry for `currsmpl.tgz' is located here: currsmpl.tgz

As I work on the package, I add code in sample2.ldf. Older code can be found in the files sample1.ldf and sample0.ldf.

2007.10.25.
When I commit new files to the CVS repository, I always make sure that running `make run' creates valid output. This is usually a drawing illustrating whatever I'm working on that day. It may not be very exciting, depending on what that is, and sometimes may be no more than a dot, just to ensure that something is output. Often, however, the drawings are more elaborate.

The command `make run' causes the following actions to occur:

Run 3DLDF on sample2.ldf

sample2.ldf may include one or more files of 3DLDF code containing macro definitions. These are the ones that currently exist:
polyhed.lmc Macros for polyhedra
sundials.lmc Macros for sundials

Run MetaPost on 3DLDFmp.mp, which includes sample2.mp

Run TeX on 3DLDFtex.tex, which includes 3DLDFtex.bas.

Run DVIPS on 3DLDFtex.dvi producing 3DLDFtex.ps

I include a link to 3DLDFtex.pdf here for good measure.

Links to these files are included here to make it possible for readers to see the result of using 3DLDF without necessarily having to install the package. The file `currsmpl.tgz' contains all of the source and generated files listed in the form of a "tarball", i.e., a compressed (gzipped) archive file. I also store compressed (gzipped) versions of the current PostScript and PDF files in the CVS repository:

currsmpl.tgz

3DLDFtex.ps.gz

3DLDFtex.pdf.gz

A good source of information for the parser is the file parser.output. See the 3DLDF language page for more information.

The development versions implement a language modelled on Donald Knuth's METAFONT and John Hobby's MetaPost languages, so it should seem familiar to users of those packages. For example, this is a simple but complete 3DLDF program:

beginfig(1);
point p[];
p0 := (2, 0, 10);
polyhedron d;
d := unit_dodecahedron rotated (15, 15, 15) scaled 5 shifted p0;
draw d;
dotlabel.top("$p_0$", p0);
endfig;
end;

This is the result:


[Dodecahedron]

I am making my development versions available on the CVS repository of the 3DLDF project on the GNU Savannah site.
I have taken steps to make it easier for people to download and install the package. The compressed archive file 3DLDFsnp.tar.gz contains all the files needed to install the package.
The file 3DLDFsnp.tar.gz.sig is a detached signature for 3DLDFsnp.tar.gz made using GnuPG (the GNU Privacy Guard). Alternatively, CVS users can download the entire repository from Savannah. Instructions for doing this can be found here.

Instructions for installing and using GNU 3DLDF can be found in the files INSTALL, 00README , and README in the CVS repository. I am currently in the process of updating these files, so if anything in them is confusing, or if you have any other questions, please don't hesitate to ask for assistance. I would prefer that queries be posted to the help-3dldf-*-AT-*-gnu.org mailing list. (Replace -*-AT-*- with @ for the email address.) Please note that you must subscribe in order to use this mailing list: In order to keep spam out, all posts from non-subscribers are automatically discarded. See Mailing lists for more information and instructions on subscribing. However, if you don't wish to subscribe, you may contact me directly.

I have started rewriting the 3DLDF User and Reference Manual to account for my changes. These files can be found here. The files are Texinfo input files, however readers should pretend for the present that they are plain text and ignore the markup, because it is not yet possible to generate output from them.


Back to contents
Back to top

Distribution

2005.09.28.
For information about the source code for GNU 3DLDF, see Sources.

2005.10.31.
I now strongly recommend that users use my development versions, collectively numbered 1.2.0, rather than Release 1.1.5.1. See Development Versions for more information.

2004.01.16.
3DLDF 1.1.5.1 Released.

In this release I correct a couple of minor problems I discovered in release 1.1.5:

See also http://www.gnu.org/directory/graphics/3D/3DLDF.html .

The official site for downloading 3DLDF is http://ftp.gnu.org/gnu/3dldf , but I will continue to make it available here.

The complete 3DLDF-1.1.5.1 distribution: 3DLDF-1.1.5.1.tar.gz

Other sites for downloading:


Back to contents
Back to top

Documentation

2006.01.25.
The most recent version of the GNU 3DLDF manual (see below) documents Release 1.1.5.1. I need to rewrite it completely in order to account for the many changes I've made in my Development Versions. I have been documenting the latter on these web pages. The old manual may still be of use to people who want to know how 3DLDF is implemented, but it is quite out-of-date by now.

2005-01-22.
I've abandoned work on the GNU 3DLDF 1.2.0 Manual --- Plain Text Version (Last updated 2005-01-31). I now plan to convert it to Texinfo. Until I do, however, it may still be useful to people who want to learn how to use 3DLDF 1.2.0.

The downloadable versions of 3DLDF: The Program, and the versions in the distribution have the table of contents at the front. This is not the case, if you generate them yourself. In order to do this, I used dviselect and dviconcat. I have not yet written make rules to do have this done automatically.

User and Reference Manual

The 3DLDF User and Reference Manual, Edition 1.1.5.1, as an HTML document suitable for browsing, with one webpage per node.

The 3DLDF User and Reference Manual , Edition 1.1.5.1, as an HTML document suitable for browsing, entirely on one webpage.

The 3DLDF User and Reference Manual , Edition 1.1.5.1 in HTML format, with one webpage per node, as a compressed archive file (gzipped tar file) for downloading.

The 3DLDF User and Reference Manual , Edition 1.1.5.1 in HTML format, entirely on one webpage, as a compressed (gzipped) file for downloading.

The 3DLDF User and Reference Manual , Edition 1.1.5.1, as a compressed (gzipped) PostScript file for downloading.

The 3DLDF User and Reference Manual , Edition 1.1.5.1, as a PDF (Portable Document Format) file for viewing on-line (if your browser has an appropriate plug-in).

The 3DLDF User and Reference Manual , Edition 1.1.5.1, as a compressed (gzipped) PDF (Portable Document Format) file for downloading.

The Program

3DLDF: The Program for version 1.1.5.1 as a PDF file for viewing on-line (if your browser has an appropriate plug-in).

3DLDF: The Program for version 1.1.5.1 as a compressed (gzipped) PDF file for downloading.

3DLDF: The Program for version 1.1.5.1 as a compressed (gzipped) PostScript file for downloading.

3DLDF: The Program for version 1.1.5.1 as a compressed (gzipped) DVI file for downloading.


Back to contents
Back to top

Converting EPS Files

2005-09-02
The utility conveps is included in the GNU 3DLDF distribution. It is for converting the Encapsulated PostScript files generated by MetaPost to other formats.

When the EPS files generated by MetaPost don't contain any TeX text, there's no problem converting them to other formats, so there's no need for a special utility. However, when they do, programs that convert one graphics file format to another can't handle them.

conveps solves this problem by including the EPS files in TeX files, and running TeX, dvips, mogrify, and convert. The structured PostScript (PS) files produced by dvips namely can be converted to other formats.

The source code is available here: conveps.web conveps has quite a few options for manipulating the images in various ways. The cweaved output of conveps.web contains instructions on how to use it. The versions of this as of this date (2005.12.16) are contained in the following files:

conveps.pdf — PDF file.
conveps.ps.gz — Compressed (gzipped) PostScript file.
conveps.dvi.gz — Compressed (gzipped) DVI file.


Back to contents
Back to top

Converting TeX Text to Images

It's sometimes useful to convert TeX text into other formats, so that it can be displayed in a browser or combined with images created in some other way. ImageMagick's convert program can be used to convert the PostScript files generated from TeX text to other formats.

The file box_math.txt contains TeX code for making examples of this. (It's called box_math.txt so browsers will display it as an ASCII, i.e., plain text, file without complaining.) The version of this file included in the 3DLDF distribution may be found here: box_math.tex. The latter file may be more recent than the version on this web page.

There are two basic ways of formatting text using the code in box_math.txt. The first way formats running text using a specified \hsize. In this case, TeX chooses the line breaks. The second way is for the user to specify the line breaks. In this case, the macro \boximage in box_math.txt chooses an \hsize large enough for the longest line.

In the following examples, the frames aren't part of the images. I've added them to show the size of the images.

This is an example of running text with \hsize == 15cm:

[Box math example 1]

This is an example of text with explicit line breaks:

[Box math example 2]

It would be very tedious to type in the code for explicit line breaking for more than a couple of examples. Instead, the code in box_math.txt is intended to be used by a utility that generates images from TeX code and a few arguments for setting options.

How it Works

The macro \boximage puts the text into a \vbox and surrounds it with a red frame made up of \vrules. The top, bottom, left, and right margins between the frame and the block of text can be set by the user. After running tex and dvips, a PNG file (b.png) is created from the resulting PostScript file (b.ps) by the command convert -crop 0x0 +antialias -fill white -opaque "rgb(255,0,0)" b.ps b.png. The -crop 0x0 option removes the parts of the image that lie outside the frame. The -fill and -opaque options together change the color of the red frame to white. The +antialias option disables use of anti-aliasing, so that the color of pixels in the image are left unchanged. Without this option, the -fill and -opaque wouldn't be able to remove the red frame cleanly, because some of the red pixels would have been changed. If a frame is desired, the -fill and -opaque options can be omitted. The first argument to \boximage makes it possible to specify a different color for the frame, if the image contains red text. The color used for the frame shouldn't appear in the image.

Problems

One problem with converting PostScript files created using TeX to images is the poor resolution and hence the poor appearance of such images when displayed in a browser. The relationship between image size and resolution is tricky. The fonts used for TeX are mostly available in small sizes for use on devices with relatively high resolution. Plain magnification doesn't produce good results, because single pixels are merely replaced by groups of pixels. I still have a lot to learn about the issues involved.

Another problem is that the images are not scalable in browsers. Increasing the display size of the text on a web page has no effect on the included images. It might be possible to have a set of images that are identical except for the font size and use JavaScript or PHP to choose the right one based on the magnification used for the web page. However, this would only work if JavaScript or PHP was enabled, and it might not be desirable to require this.


Back to contents
Back to top

Mailing lists

2005-05-02. I've replaced @ with -*-AT-*- in all of the email addresses on these webpages, and removed all clickable references to email addresses. I've been forced to this step by the huge amounts of spam I receive.

2005-05-21.
I have reactivated the help-3dldf-*-AT-*-gnu.org mailing list, but only for subscribers. Postings from non-subscribers are automatically discarded. I have deactivated the other GNU 3DLDF mailing lists. I have been forced to take this step by the huge amounts of spam posted to these lists. For the same reason, I've also replaced @ with -*-AT-*- in all of the email addresses on these webpages, and removed all clickable references to email addresses. If would prefer that all queries and comments be addressed to help-3dldf-*-AT-*-gnu.org, but if you don't wish to subscribe, you may contact me directly.

2005-05-21. The following mailing list is now available:
(Replace -*-AT-*- with @ for the email address.)
help-3dldf-*-AT-*-gnu.org for users to ask one another for help.

To subscribe, visit http://lists.gnu.org/mailman/listinfo/help-3dldf.
Alternatively, you can send an email with subscribe <email address> as the subject or the body to
help-3dldf-request-*-AT-*-gnu.org.


Back to contents
Back to top

File Permissions

I've now put the release versions of the files in 3DLDF under version control using RCS. This has significant advantages, but has the unpleasant effect of making some or all of the files in the distribution read-only, unless I've checked them out before calling make dist. On Unix-like systems, file permissions are changed using chmod. For example,
chmod u+w foo.web
makes foo.web writable for the user.

The dist target is generated automatically by Automake, and I don't know how to make it change the permissions to read-write. So users will have to reset the permissions themselves. Please let me know if you have problems: help-3dldf-*-AT-*-gnu.org (Replace -*-AT-*- with @ for the email address.) Please note that you must subscribe in order to use this mailing list: In order to keep spam out, all posts from non-subscribers are automatically discarded. See Mailing lists for more information and instructions on subscribing. However, if you don't wish to subscribe, you may contact me directly.


Back to contents
Back to top

Reverting Buffers

The way GNU 3DLDF 1.1.5.1 and earlier versions using) are built makes it necessary to touch one or more of the CWEB source files sometimes, thus changing their datestamps. If you're currently working on one of these files, you will have to revert the buffer visiting that file. (If you're using 1.1.5.1, I strongly recommend switching to my Development Versions. You shouldn't be using any version earlier than 1.1.5.1.)

This will only affect you if you are editing the CWEB source files. It will not affect you if you are using GNU 3DLDF 1.2.0 or a more recent version. 1.2.0 is interactive, as will be any future versions, so that users will not need to edit the CWEB source files.

However, if you are affected by this problem, and you're using Emacs, you can set a key to revert the buffer without querying by putting the following s-expression (symbolic expression) into your .emacs file:

(global-set-key [f5] '(lambda () (interactive) (revert-buffer t t)))

Or, if you're using, for example, foo mode, you can put the following sexp into your foo-mode-hook declaration:

(local-set-key foo-mode-map [f5] '(lambda () (interactive) (revert-buffer t t)))

For example,

(setq lisp-mode-hook '(lambda () (local-set-key [f5] '(lambda () (interactive) (revert-buffer t t)))))

Or, if you've defined a foo mode yourself, you can put the key assignment into foo-mode-map:

(if foo-mode-map ()
(setq foo-mode-map (nconc (make-sparse-keymap) c-mode-map))
;; else
(define-key foo-mode-map [f5] '(lambda () (interactive) (revert-buffer t t))))


Back to contents
Back to top

Links

Laurence Finston's Website.
Marc van Dongen's MetaPost Pages.
L. Nobre G.'s MetaPost Pages.
Anthony Phan's Web Pages (m3D).


Back to contents
Back to top

Contact

If you want to contact me about 3DLDF, please put 3DLDF, 3dldf or something similar in the subject line of your email. Otherwise, it's likely to be filtered.

If you want to encrypt an email to me, you can use my public key .
Fingerprint: 0007 566D B0E0 96AE 3F4A EBE5 6213 D0F0 7376 08BA

Laurence Finston

email: lfinsto1-*-AT-*-gwdg.de
s246794-*-AT-*-stud.uni-goettingen.de
Please use only one address at a time! (Replace -*-AT-*- with @ for the email addresses.)


Back to contents
Back to top