Appendix A - Analytical Aids

Coordinate Systems

A common source of error and frustration are the simple differences between the conventions of MSTS and XNA.  The two coordinate systems are drawn to facilitate comparison.  Both the x- and y-axes are drawn in the same orientation: x is to the right, and y is out of the paper.  The principal differences are that the MSTS z-axis points north, and the XNA z-axis points south.  The MSTS system is left-handed; the XNA system is right-handed.


In the MSTS system, azimuth (rotation about the y-axis) is positive rotating clockwise, and absolute angles are measured from north.  With XNA, positive rotations about the y-axis are counterclockwise, and absolute angles are measured from south.  Thus, angles in MSTS are 180° out of phase with those of XNA.  For an angle λ, λMSTS = π – λXNA for angles in radians.

Circular Arc Analysis

The following method of interpolating points on a circular arc is useful.  Both a left-hand curve and right-hand curve are illustrated.  The analysis will proceed with the left-hand curve, and the right-hand curve will follow by symmetry.


For simplicity, assume the horizontal axis is aligned with the x-axis, and the Point-of-Curve (PC) is at the origin.  The unit vector Forward, tangent to both curves points north; unit vectors Left and Right point respectively along the negative and positive x-axes.  The MSTS convention for the angle, λ, subtended by a point P on the curve is shown: Left-hand curves are specified by negative angles, and right-hand curves are specified by positive angles.

For a left curve, the center of the arc (O) is pointed to by Left, and a vector vPC_O = R Left locates the center.  Desiring to express algebraically the radial vector between O and P, vO_P, you will note that it can be obtained by rotating a vector between O and PC (-vPC_O) by the angle λ: vO_P = -vPC_O [R(λ)], where [R(λ)] is the transformation matrix for rotation about the y-axis by the angle λ.  Finally, denoting the position of point P by vPC_P, we conclude vPC_P = vPC_O + vO_P.

To generalize this a bit, PC does not have to be at the origin of the coordinate system.  Simply add a position vector from the origin to point PC into the sum in the above equation.

To generalize further, I will emphasize that PC can be any point on the arc, not just the root of the arc.  Of course, that would mean that Forward would have to be replaced by a unit vector describing the orientation of a tangent to the curve at that point, say f.  Similarly, Left would have to be generalized to reflect the direction from PC to O.  That is simply the cross product of Up (a unit vector in the positive y-direction), or Up X f.

Dynamic track, from a world file perspective, has only left-hand curves.  This means that, for mesh generation, you don’t have to worry about right-hand curves.  However, TDBTraveller needs to worry about both.  It is very important that dynamic track mesh generation and TDBTraveller at least use the same method for computing the path on a curve (if not common code).  The development for right-hand curves parallels the development for left-hand curves.  Simply substitute Right for Left whenever λ is positive.  Post-SVN163, TDBTraveller and dynamic track do use the same method and common code to the extent feasible.  The shared code consists of two TDBTraveller methods named MSTSInterpolateAlongStraight and MSTSInterpolateAlongCurve.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.