chiark / gitweb /
selecting solutions
[trains.git] / layout / informat.txt
1 Locations, angles, etc.
2
3  Key type is a `loc', which is a named location (absolute, 2D) and
4  direction (at the location).  Angles are generally positive
5  anticlockwise; bearings are angles measured from East.  The origin is
6  at the South-West.
7
8 Syntaxes
9  New location
10   <identifier>
11  Existing location
12   [-]<identifier>  (- means reverse the sense)
13  Quantity (length/angle)
14   <number>[<unit>]
15   Angle units: d (degrees,default)  r (radians)
16   Length units: mm (default)  cm  m
17  Identifiers (of locs and objects) start with lc letter, then
18  alphanums and underscores
19
20 Commands
21
22  abs P X Y A
23   Defines loc P given coordinates (distances) and absolute bearing
24
25  rel F T L R A
26   Defines loc T: start at loc F, go forward L, translate right R,
27   turn left A.
28
29  extend F T len L [R]        length L
30  extend F T upto U [R]       s.t. perpendicular at T passes through U
31  extend F T ang A R          subtending directionally A
32  extend F T uptoang A R      s.t. direction at T is A
33  extend F T parallel U R     s.t. direction at T is same as at U
34   Draws an arc or line from loc F, defining the other end as loc T.
35   If length R specified, draws an arc of radius R; R +ve curves to the
36   right; R -ve to the left.
37
38  join F T R [S ...]
39   Joins one existing loc, F, to another, T.  F's direction points to
40   the new track; T's away - ie the added track leaves F in F's
41   direction and arrives at T in T's direction.  R is the minimum curve
42   radius allowed.  S selects from the available solutions, and may be
43   any of the following
44      long                  prefer longer length solution
45      short                 prefer shorter length solution
46      right|left            prefer mostly bending to the left resp. right
47      beginright|beginleft  prefer first bend to the right
48      endright|endleft      prefer final bend to the right
49      [!]twoarcs            prefer [not] two circular arcs of equal radius
50      [!]arcline            prefer [not] one line and an arc of max radius
51      [!]arcsline           prefer [not] line between two arcs of min radius
52   if this doesn't resolve, will pick the shortest.
53
54  defobj O
55  [commands]
56  enddef
57   Defines the object O.  Inside the definition, the commands do not
58   draw when the object is being defined.  The object has its own
59   coordinate space and its own location namespace.
60
61  obj[flip] O A F [P]
62   Places an instance of object O.  The loc defined inside O as F
63   (`formal parameter', F must be just <identifier>) is placed at
64   existing loc A (`actual parameter').  If prefix P (syntax is that of
65   an identifier) is specified, each other loc L inside O is exported
66   into the global namespace as a new loc PL.  If `flip' is used then
67   the object is placed with object-space y coordinates negated (ie, it
68   is mirrored so that the object's North exchanges with South).