> 4D Blocks
> Version 6
> Scene Language
Kinds of Blocks
More Geometry Commands
Elevated Train CommandsBuilding an elevated track is extremely simple. All you have to do is add some ramps to your track using the "u" and "d" instructions and then say "1 N platforms" after all the track is built (where N is the number of vertical levels), and voila. Everything else is just styles and decorations.
Another way you can make an elevated track is by starting the track at nonzero y … 1 for the first level, 2 for the second level, and so on. The y coordinates for elevated tracks are always level numbers rather than physical heights.
The track object must be on top of the stack for most of these commands to work. The only exceptions are "nomove" (which requires a shape) and "roundshape".
The first decoration you might want to add is pylons. To create a pylon, all you have to do is provide the coordinates of the top of the pylon (with y being the level number) and say "pylon". If you have multiple levels, don't worry, the program will look at the track underneath and try to figure out whether the pylon should go all the way down to the ground or just down to a lower level. In some situations the program might get it wrong, in which case you can override it with the "bpylon" command, which takes both a top point and a base level.
If you want to use some other shape as a decoration, and you want it to be immobile and unselectable like a pylon, you can apply the "nomove" command to it. (And if you want it to be the same color as a pylon, the default color is #00A000.)
That's all I have to say about decorations. Everything else is styles.
Vertical Track Parameters
The most fundamental thing you can adjust is the vertical track parameters. If you use the "newtrack" command they're set to default values, so you have to use the "newtrack2" command instead. It takes three arguments in addition to the already huge list of arguments that "newtrack" has.
The radius of curvature applies only to railcar motion. It doesn't produce any visible change in the shape of the ramps.
There are some constraints on these parameters, basically that the ramp angle has to be steep enough to get you to the desired height, but "newtrack2" will let you know if what you're trying to do is impossible.
platformstyle - There are currently five styles you can use. The last one is the default.
PS_SQUARE -- big square platforms
platformthickness - This lets you set the platform thickness. If you make the platforms really thick they'll go all the way down to the ground, which can be a nice effect sometimes.
platformwidth - This lets you set the platform width. (The width isn't used for square and round styles.)
platformcolor - This lets you set the platform color.
platformcorner - This is a boolean option (true or false) that applies only to 4D round platforms. It tells whether corners that are round in all three directions should get an extra diagonal face.
If you want to have big triangular ramps like in the file "train2-ramp3b", but you don't want the other platforms to go all the way to the ground, you can turn on the ramptriangle option: "true ramptriangle".
Pylons are polygonal columns. There are three pylon properties you can set.
pylonwidth - The actual column width, which is not the same thing as twice the polygon radius.
pylonsides - The number of sides.
pylonoffset - This is a boolean option (true or false) that tells how the polygons are aligned to the axes. By default (true) you get the same kind of polygons as with the "altpoly" command.
Manual Platform Creation
If you want all your platforms to have the same style, you can just set the style and then say "1 N platforms". If you want the style to vary by level, you can set the style for level 1, say "1 1 platforms", and repeat. But, if you want the style to vary within a level, you'll need to create at least some of the platforms manually. The system keeps track of which platforms have already been created, so you can create some platforms manually and then let "platforms" do the rest.
platform - This takes two position arguments, one that's a minimum and one that's a maximum. The command below, for example, will produce a 2x2 level 1 platform that covers grid positions (2,1,5), (3,1,5), (2,1,6), and (3,1,6).
[2 1 5] [3 1 6] platform
In the two PS_THIN styles, a platform can only cover more than one grid position if the track on the platform consists of one straight piece.
For making platforms that cover only one grid position, you can use the "dup" command to duplicate the array, like so.
[2 1 5] dup platform
rplatform - This takes the same two array arguments plus a four-digit binary number that tells which corners should be rounded. (You can use a % prefix to type binary numbers.) The digits control the NE, NW, SW, and SE corners respectively, so for example "%0100" would make the platform be round in the northwest corner only. See below for 4D round platforms.
ramp - This takes one argument, the grid position of the ramp. You can give the position of the top end or the bottom end, but if you use the top end, don't forget to increase the y coordinate.
4D Round Platforms
This will all make a lot more sense if you look at Round Platform Examples first.
In 4D, the "rplatform" command takes a twelve-digit binary number. The three groups of four digits control rounding in the zw, xw, and xz planes, respectively.
The "roundshape" command takes the same arguments as "rplatform" plus two more, a margin value as in "newtrack" and a corner flag as in "platformcorner", and returns the top face of the platform as a shape. You can then perform a prism operation on it to get a movable platform shape, or you can just admire the top face as a lower-dimensional object. The y components of the position arguments are not used. The command also works in 3D, it's just not very interesting there.
In both 3D and 4D, if a platform has width 1 in one or more directions, then some combinations of rounded edges are impossible and will be ignored. In 4D, there are two combinations that give error messages instead.
1. "Reverse join not supported when margin is nonzero."
If you run into this error message, you have two options: you can set the margin to zero, or you can adjust the rounding on the platform in question. I really do mean "adjust", not "reduce" … if you put rounding on the sharp edge of the reverse join, that works too.
If you're using the "platforms" command and don't know what platform is causing the problem, well, take another look at the error message. The bottom line is a set of arguments to "rplatform". You can add that (plus "rplatform") before the "platforms" call and have manual control of that one platform.
It may also help to make the platform larger temporarily so that you can see what's going on.
2. "Double reverse join not supported."
The only way to get this error message is to create a custom-rounded platform with "rplatform", so I'm just going to quote something funny Donald Knuth said in The TeXbook (p.299): "If you have been so devious as to get this message, you will understand it, and you will deserve no sympathy."