PaperModelers.com

Go Back   PaperModelers.com > Papermodelers' Bar and Grill > Other Things We Do & Make

Reply
 
Thread Tools Display Modes
  #51  
Old 05-19-2023, 11:24 PM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
This works because MetaPost, given 2 or more points, tries to find "the most pleasing curve" through them. It is not necessary to specify all of the points on a curve or to give an equation for it, parametric or otherwise. The very complicated algorithm for finding this curve is on pages 130--132 of Donald Knuth's The METAFONTbook (and includes formulae found by John Hobby).

It is possible to give "hints" to MetaPost by specifying the directions a path takes when entering or leaving a point, by changing the "tension" of the curve, etc.

METAFONT and MetaPost use Bézier curves, which may be of interest to people here who make car models, because they were developed and used for designing car bodies. I'm sure they played a role in making them more aerodynamic, which is certainly a good thing. However, I think cars today all look the same and the ones of my childhood had more interesting shapes. I don't think the Dodge Dart or the Ford Thunderbird were particularly aerodynamic.

We had a Rolls Canardly. That's the one that rolls down one hill and canardly get up the next.

Bézier curves are only useful in 2D because they aren't invariant under the perspective projection. NURBS (non-uniform rational B-splines) are a generalization of Bézier curves that are and are therefore standard in 3D graphics applications.
Reply With Quote
  #52  
Old 05-20-2023, 01:29 PM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Linear perspective

The subject of linear perspective came up on another thread, in the context of the isometric, axonometric and dimetric representations of objects in model plans. I thought this might be of interest to some people, but I don't want to hijack that thread, so I'll post it here:

These are sections from a manual I wrote in 2003 and last updated in 2007:

3DLDF User and Reference Manual (The Perspective Projection)

3DLDF User and Reference Manual (Perspective Functions)

They explain and illustrate the difference between doing a perspective drawing using vanishing points, as one would do by hand, and the way 3D graphics programs do it, using matrix multiplication.

The manual is very out-of-date and shows how you would use the latter method in C++, using 3DLDF as a software library. Since 2009, 3DLDF has an interpreter, which makes this unnecessary. However, in this context it doesn't matter.
Reply With Quote
  #53  
Old 05-21-2023, 10:37 PM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Got this to work. The MetaPost macro `raindrop' takes 14 arguments, 9 of which determine the shape and position of the "raindrop" or "teardrop" shape.

The latter is derived from a circle, the center and radius of which is specified in the call to the macro. The point at the top is specified as a height value, e.g., 2cm, that determines the distance of the point R1 from the center (R0).

The raindrop consists of three paths that are joined: 1. a curve from a point on the original circle (R3) up to R1, 2. the mirror-image of this curve about a vertical line passing through the center of the circle and 3. a curve joining R3 and its reflection, R8, through the point R7. The latter determined by a parameter, which is a scalar value with units, specifying a distance below the points R3 and R8. The x-coordinate of R7 is that of the center of the original circle.

To get the combined path to curve nicely, the point R4 is found along the line R1 to R3. This is done by using the "mediation" or "of-the-way" function, i.e., R4 is 1/m "of the way" from R3 to R1, where `m' is a parameter to the macro. Then, the perpendicular to the line R3R1 passing through R4 is found, followed by the point R5, lying on the perpendicular on the opposite side of R3R1 to R4. Then, the mediation function is used again to find the point R6 along the line R4R5.

To get the combined curve to be smooth where the individual curves join at R3 and R8, "hints" are given to MetaPost to ensure that the direction of the curve is the same as that of the straight lines R3R1 and R8R1.

To get the curve to make a good point at the top (at R1), a default value of 87.5° is used to determine the direction of the curve as it travels from R6 to R1. However, this value may be modified by an additional parameter that is added or subtracted from the default value.

Another parameter determines the position of the resulting curve. If it's 0, it's not moved. If it's > 0, it's shifted upwards and if it's < 0, downwards.

There are two parameters for setting whether the help lines and curves and labels are printed, as well as the resulting curve itself.

Finally, two `path' variables are passed to the macro, which assigns the resulting curve and the original circle to them as their values.

I think the shapes I've found look pretty good. However, I'll have to try to get a series of raindrops that fit what I'm trying to achieve and, if experience is any guide, will have to make some modifications to the macro. A good way of optimizing macros is to try to "break" them by using extreme values for the parameters and trying to fix what goes wrong.

I think this is a good example of how it's possible to parameterize drawings using MetaPost, just as fonts are parameterized using METAFONT.
Attached Thumbnails
Lettering-april_showers.jpg  
Attached Files
File Type: pdf april_showers.pdf (12.4 KB, 2 views)
File Type: txt april_showers.mp.txt (16.3 KB, 1 views)
File Type: txt april_showers.txt (1.9 KB, 1 views)

Last edited by Laurence Finston; 05-21-2023 at 11:15 PM.
Reply With Quote
  #54  
Old 05-22-2023, 12:31 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
The point R3 isn't fixed, it's also determined by parameter specified by the user. The `raindrop' macro uses a predefined path called `fullcircle', which has 8 points. They can be retrieved by using the "point of" operation, e.g., for a path p, "point 2 of p".

MetaPost can interpolate between points of a path, so you can also say, e.g., "point 2.75 of p". In these examples, the value used is around 5. `fullcircle' starts at the left and goes around counter-clockwise, so this is about 5/8 of the way around the circle.

In MetaPost, the length of a path is not the distance travelled by a point traversing the path, but rather the number of points on it. In the case of a circle, the distance between point 0 and point 1, point 1 and point 2, etc., will probably be nearly exactly the same, but this is not true in the general case.

All paths in MetaPost are Bézier curves, which are parameterized curves generated using a variable `t' where the course of the curve is determined by a function f(t). You can think of `t' representing time and the curve is the trace of a point moving through space over a period of time.

Generally speaking, it will not be possible to determine the length of the curve. This would require integration and function f(t) is not integrable. To the best of my knowledge, parametric functions as a whole are not integrable.

Of course, it's possible to generate curves in MetaPost that represent mathematical curves whose lengths may be calculated, however MetaPost itself doesn't provide any predefined operations for this. It does provide the standard arithmetical operations, trigonometric functions and other operations, but this isn't what it was designed for.

In 3DLDF, I provide more operations for numerical calculations and more data types based on mathematical curves and surfaces. When using 3DLDF, calculations are mostly performed in the latter and the MetaPost code contains mostly drawing and filling and housekeeping commands.
Reply With Quote
  #55  
Old 05-22-2023, 12:39 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Quote:
Originally Posted by Laurence Finston View Post
Then, the perpendicular to the line R3R1 passing through R4 is found, followed by the point R5, lying on the perpendicular on the opposite side of R3R1 to R4.
This is wrong. R5 can't lie on the "opposite side" of R3R1, because R4 lies on the line. R5 lies on the perpendicular of R3R1 in the direction toward the center of the circle.
Reply With Quote
Google Adsense
  #56  
Old 05-24-2023, 08:51 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
I had a very difficult time getting this to work. These are two drawings from my "Midsummer Night's Dream" project, Bottom and Titania (in case you couldn't guess), placed on top of watercolor backgrounds. After a lot of trial and error I finally succeeded but I haven't completely understood the process.

The problem is that color replacement works on all pixels of a given color, so it was difficult to avoid changing ones in the foreground or background, when trying to make the masks with either the foreground or background sections transparent. Ultimately it worked by creating a selection and only operating on it. However, sometimes what I did worked and sometimes it didn't and I'm not sure why.

I referred to a manual on GIMP that I bought but it would make things much easier if I would sit down and really spend some time reading the documentation.

I bought a DIN A4 scanner, which wasn't very expensive. It will actually scan items that are somewhat larger than A4. Scanning at the library I didn't want to get the glass of the scanner dirty so I scanned using transparent pockets for anything that I thought might rub off and that caused streaks on the scanned image. They have book scanners there with a camera above and pointing down at the items to be scanned. I'll try that for the backgrounds I did in A3.

The blue of the watercolor background in the second picture is quite different from its appearance in real life. I don't know what the cause is, it could be the scanner or my computer. Really reproducing color accurately is a science in itself and probably still requires special equipment that in turn needs to be calibrated. I don't think this would be realistic for me.

On the other hand, the ink I used for the drawings (Rohrer und Klingner tusche, which is manufactured by Schmincke), reproduces very well. For the skin color in the drawing of Titania, I used air brush ink. I did these drawings around 2003 or 2005 and except for the white ink and the mixtures I made using white, which dried up, all of the ink is as good as new.
Attached Thumbnails
Lettering-bottom_walking.jpg   Lettering-what_angel_wakes_me.jpg  

Last edited by Laurence Finston; 05-24-2023 at 09:04 AM.
Reply With Quote
  #57  
Old 05-24-2023, 09:15 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Quote:
Originally Posted by Laurence Finston View Post
The problem is that color replacement works on all pixels of a given color, so it was difficult to avoid changing ones in the foreground or background, when trying to make the masks with either the foreground or background sections transparent.
What's really needed is a color that is only used for this purpose, i.e., that would otherwise never appear in an image. Too late for that, though, unless someone defines a new format for graphics files. However, it might be difficult to make it compatible with other formats.
Reply With Quote
  #58  
Old 05-25-2023, 08:59 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
I've figured out how to do this now. In the XCF files (in GIMP's native format) corresponding to the first two images, the white areas are transparent. It's now quite easy to exchange the backgrounds.

This drawing, and others from this project and some other projects, started out as pencil sketches, which I then cleaned up and inked or finished using another medium. I used good drawing paper, so it was possible to erase without ruining the drawings.

The most obvious way of doing the outlines would have been to use a technical pen, however this isn't what I did. Technical pen ink isn't strongly pigmented and this is very noticeable when used together with very strongly pigmented drawing tusche. Instead I used the black tusche from Rohrer and Klingner, which is a very deep black. You can't use drawing tusche with a fountain pen at all. You can, of course, use it with nibs and I do this sometimes, but not usually for drawings. Mostly, as with this drawing, I used a fine brush. It's more difficult and it takes longer but I enjoy doing it and I think the results are worth it.

I printed out the image using a copier and started cutting out the figure. I want to try adding joints, as in pop-up books, to make it moveable. I haven't made a direct comparison to the original drawing, but I think the colors reproduced quite accurately.
Attached Thumbnails
Lettering-what_angel_wakes_me_black_figure_transparent_background.jpg   Lettering-what_angel_wakes_me_transparent_figure_black_background.jpg   Lettering-what_angel_wakes_me_original_figure_kadmium_orange_gouache_background.jpg   Lettering-what_angel_wakes_me_original_figure_yellow_and_blue_watercolor_background.jpg   Lettering-dscf0005.jpg  

Lettering-dscf0006.jpg   Lettering-dscf0007.jpg  

Last edited by Laurence Finston; 05-25-2023 at 09:10 AM.
Reply With Quote
  #59  
Old 05-25-2023, 02:31 PM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
The first image is another drawing for "A Midsummer Night's Dream". I did this one using Faber-Castell Polychromos colored pencils, which have a wax base. I think they also reproduce very well.

I'm starting to get the hang of GIMP. I loaded the file multiple times and scaled and rotated the images to try to get a "swarm" of ladybug fairies (second image). It's somewhat time-consuming, so the swarm is rather small. I may work on it some more, but at the moment I just wanted to test this idea.

The third image is an illustration for E.T.A. Hoffmann's story "The Golden Pot" ("Der goldne Topf"). I've included it because I think it's an especially good example of how Polychromos pencils reproduce.
Attached Thumbnails
Lettering-ladybug1.jpg   Lettering-ladybug_multiple_small_1.jpg   Lettering-j.jpg  
Reply With Quote
  #60  
Old 05-26-2023, 01:26 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
In this example, I've exported the image from GIMP to an EPS file and included the latter in the MetaPost file ttemp.mp (uploaded here as ttemp.mp.txt) using the `exteps' package: CTAN: Package exteps

In ttemp.mp, I add a frame and the crosshairs and position the image. I could have added the text using one or more `label' commands, but I didn't do that. Running MetaPost creates the file ttemp001.eps, which I include in the TeX file ttemp.txt. Here, I add the text and have it write over the image.

I'm much better at TeX and MetaPost than I am at GIMP and I prefer to program instead of clicking through menus with a mouse, which TeX and MP make possible. For some things, the other way of working is better and it is possible to use Scheme, Perl or Python for programming within GIMP; I just have to learn how to do it. However, for typesetting purposes, TeX is certainly superior to GIMP.
Attached Thumbnails
Lettering-ttemp_low_res.jpg  
Attached Files
File Type: txt ttemp.mp.txt (2.3 KB, 1 views)
File Type: txt ttemp.txt (1.9 KB, 0 views)
File Type: pdf ttemp_low_res.pdf (1.17 MB, 1 views)
Reply With Quote
Google Adsense
Reply

Tags
animation, fonts, lead type, type metal, typesetting

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)
Copyright © 2007-2023, PaperModelers.com