TeXhax Digest Tuesday, January 6, 1987 Volume 87 : Issue 02 TEXHAX02.87 Editor: Malcolm Brown Today's Topics: Rendering a Bezier cubic curve TeXhax 86/14 Re: Plea from a novice TeX User Re: DVI Driver for IBM 3279 graphics terminals TEX pre-viewer for ATARI? LaTex notes ---------------------------------------------------------------------- Date: Thu, 1 Jan 87 23:03:02 PST From: ramshaw@decwrl.DEC.COM (Lyle Ramshaw) To: texhax@score.stanford.edu Subject: Rendering a Bezier cubic curve The Metafont book, on page 13, gives a geometric method based on midpoints for computing a Bezier cubic curve from its four Bezier control points. Brian Keck, of Telecom Australia Research Laboratories, recently asked for a justification of this method. As in the Metafont book, let z1, z2, z3, and z4 be the Bezier points of the segment z([0,1]) of the cubic polynomial curve z(t) given by z(t) = (1-t)^3*z1 + 3*(1-t)^2*t*z2 + 3*(1-t)*t^2*z3 + t^3*z4. Construct the midpoints z12 = 0.5[z1, z2], z23 = 0.5[z2, z3], and z34 = 0.5[z3, z4]. In a second stage of interpolations, construct the midpoints z123 = 0.5[z12, z23] and z234 = 0.5[z23, z34]. In one last interpolation, construct the midpoint z1234 = 0.5[z123, z234]. It is easy algebra to check that the point z1234 so constructed is precisely the point z(1/2), and Brian didn't have any trouble with that. But something more is true. Note that the curve segment from z1 to z1234 is a cubic polynomial segment in its own right; in particular, it is z([0, 1/2]). We can convert it into the standard form in which t varies from 0 to 1 by defining w(t) := z(t/2) and then considering w([0,1]). What are the Bezier points of w(t)? A little more algebra verifies that they are z1, z12, z123, and z1234; that is, we have w(t) = z(t/2) = (1-t)^3*z1 + 3*(1-t)^2*t*z12 + 3*(1-t)*t^2*z123 + t^3*z1234. Similarly, the curve segment z([1/2, 1]) from z1234 to z4 is also a cubic segment in its own right, and its Bezier points are z1234, z234, z34, and z4. Therefore, if we re-execute the midpointing process starting with the four points z1, z12, z123, and z1234, we will compute w(1/2) = z(1/4). Similarly, if we start the midpointing process with z1234, z234, z34, and z4, we will compute z(3/4). Thus, we are in a position to render the entire cubic segment z([0, 1]) by using the midpointing process in a divide-and-conquer recursive fashion. The midpointing process for computing a point on a polynomial curve has recently been christened the de Casteljau Algorithm. The French mathematician de Casteljau, working for Citroen, realized the importance of the Bernstein polynomials for computer aided geometric design concurrently with and independently of Bezier, who worked for Renault. For more information, see the article "A Survey of curve and surface methods in CAGD" by W. Bohm, G. Farin, and J. Kahmann in pages 1-60 of volume 1 of the journal Computer Aided Geometric Design (1984) and the sources cited therein. Lyle Ramshaw ------------------------------ Date: Fri, 2 Jan 87 08:56:38 PST From: Reply-To: PEB%DM0MPI11.BITNET@forsythe.stanford.edu To: TEXHAX@score.stanford.edu Subject: TeXhax 86/14 Re: Plea from a novice TeX User From: Peter Breitenlohner (089) 31893-412 PEB at DM0MPI11 Max-Planck-Institut fuer Physik (Werner-Heisenberg-Institut) Foehringer Ring 6 D-8000 Muenchen 40 I would suggest the following macro definition: \def\bicenter#1#2{\line{\hfil\clap{#1}\hfil\hfil\clap{#2}\hfil}} \def\clap#1{\hbox to0pt{\hss#1\hss}} % analogous to PLAIN's \llap and \rlap together with the input \vglue0pt\vfil \bicenter{name_information_one}{name_information_two} \bicenter{address_one}{address_two} ...... \vfil\break best regards Peter ------------------------------ Date: Fri, 2 Jan 87 08:56:58 PST From: Reply-To: PEB%DM0MPI11.BITNET@forsythe.stanford.edu To: TEXHAX@score.stanford.edu Subject: Re: DVI Driver for IBM 3279 graphics terminals From: Peter Breitenlohner (089) 31893-412 PEB at DM0MPI11 Max-Planck-Institut fuer Physik (Werner-Heisenberg-Institut) Foehringer Ring 6 D-8000 Muenchen 40 To: Malcolm Brown TEXHAX at SCORE Since none of the more competent people seem to supply this info i'll do so: There is a (DVItype based) DVI Driver for IBM 3279G called DVIgddm, written by Ferdinand Hommes (= GRZ008@DBNGMD21.BITNET ) and Mr. Stumm from GMD, Bonn, W.Germany. This driver prepares a bitmap which is then displayed via (the IBM product) GDDM. I think you can obtain DVIgddm from GMD. regards Peter ------------------------------ Date: Fri, 2 Jan 87 13:20 PST From: Subject: TEX pre-viewer for ATARI? To: texhax@su-score.arpa X-Original-To: texhax@su-score.arpa, SYSTEM Has anyone out there in TEXland, written a TEX pre-viewer for the ATARI 1040ST micro? Thank you in advance... Nik Zapantis, UVIC Physics (SYSTEM@UVPHYS.BITNET) ------------------------------ Date: Fri, 2 Jan 87 12:13:44 pst From: lamport@decwrl.DEC.COM (Leslie Lamport) To: texhax-request@score.stanford.edu Subject: LaTex notes In-Reply-To: Your message of Fri 2 Jan 87 08:03:15-PST. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Eric Hildum wants to put two figures side by side, and complains that Section 5.4.3 is inscrutable. I guess I should have included an expanded discussion of boxes in the book; the various box-making commands provide solutions to lots of problems. The basic thing to realize is that TeX does all its typesetting by putting boxes together, with appropriate spaces between them. The most common sort of box consists of a single letter. A line of text is a box that is composed of a horizontal row of smaller boxes and (interword) spaces. And so on... Now, consider Hildum's problem. He wants two figures that look like the following: +----------------------------+ +--------------------------------+ | | | | | | | | | Figure 9 | | Figure 10 | +----------------------------+ +--------------------------------+ He probably doesn't want any space between them, so he needs a line of `text' consisting of two boxes and no space. The width of each box is presumably half the line width--i.e., .5\textwidth. Hence, he wants a paragraph consisting of a single line, which consists of two boxes of width .5\textwidth. Now, how do we make a box of wdith .5\textwidth? That depends upon what goes inside the box. For example, \framebox[.5\textwidth]{foo} produces a framed box of that width containig the word `foo' horizontally centered within it. In Hildum's case, the stuff inside the box is probably going to be in paragraph mode. So, he wants a parbox, which is produced with either the \parbox command or the minipage environment. (See page 99 for an explanation when to use which.) He'll probably use the minipage environment, typing something like the following (the `%' prevents an interword space between the two boxes) \begin{minipage}{.t\textwidth} ... \end{minipage}% \begin{minipage}{.t\textwidth} ... \end{minipage} But, there's one problem. It's clear that this will get the correct horizontal positioning of the boxes, but what about their vertical positioning? TeX knows how to align the letters in a text line, but it needs to be told how to align parboxes--in particular, what to do if the two boxes have different heights. Hildum probably wants the bottoms aligned, as in +----------------------------+ + + +--------------------------------+ | | | | | | | | | Figure 9 | | Figure 10 | +----------------------------+ +--------------------------------+ which he gets by typing \begin{minipage}[b]{.t\textwidth} ... \end{minipage}% \begin{minipage}[b]{.t\textwidth} ... \end{minipage} (Note: if neither the `b' `t' nor default centering option gives the desired vertical alignment, you can put one of the parboxes inside a \raisebox command.) Now, since these two boxes are supposed to be a figure, they go inside a figure environment. Captions are made with the \caption command. So, he types \begin{figure} \begin{minipage}[b]{.t\textwidth} ... \caption{Text of first caption.} \end{minipage}% \begin{minipage}[b]{.t\textwidth} ... \caption{Text of second caption.} \end{minipage}% \end{figure} (If he wants an in-text figure, he should use an optional argument for the figure environment containing the `h' option.) I'll close with an exercise for the reader. Do the same thing, except make each figure 1/2" wider than .5\textwidth, with the first figure extending 1" into the left margin. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Mark Roth wants to get a listing of all the entries in a .bib file. Oren Patashnik has been considering including this feature, but I seem to recall that he decided that it wasn't worth the effort. The syntax of .bib files is simple enough that it should be quite easy to write a program that goes through a .bib file and produces a file containing \cite or \nocite commands for each entry. He also requested a way of printing the cite key with an entry. It should be easy to create a bibliography style that uses the key as the label, so the key would appear in the bibliography and be printed by the \cite command. You'd change to a standard bibliography style when you've finished writing and are ready to produce the final version. ++++++++++++++++++++++++++++++++++++++++++++++++++ On a related issue... People should remember that the document style appropriate for the final output may not be the best one to use when writing the document. This is especially true if you use a previewer. Previewers should provide the ability to scroll pages--for example, to show the bottom 2/3 of page 7 and the top 1/3 of page 8--instead of just flipping to a new page. One can then design a document style so that the first text line of page 8 is displayed immediately below the last text line of page 7, enabling you to view the entire document as if it were on a continuous scroll. (Page numbers could appear in the margin.) This is the ideal way to use a previewer while writing the document. Of course, one switches to a standard document style when fine-tuning the final printed version. However, a typical writer spends 4-8 hours per page writing a document; he should spend at most a couple of minutes per page formatting it. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Chuck Cross asks about TeX/LaTeX for the Macintosh+. I'm told that there's a company in Canada selling it. Addison-Wesley also markets TeX for the Mac; they will be selling LaTeX for it too, but I don't think it's available quite yet. Leslie Lamport ------------------------------ % %\bye % End of TeXhax Digest ************************** -------