From the VR Reading Room
 
Your information source for:
• Train/railroad simulators, virtual railroading and V-scale modeling

Also of interest:

Home
VR Reading Room
Virtual Railroader 'Zine
VMR Journal 'Zine
VR Blogger
Basic Trainz
Library
V-Scaler Column



Calculating Diverging Curves For BVE

By Tom Beevers

One of the more tricky things involved in BVE route construction pertains to the offset of diverging curves at a junction or similar. I'd previously been stuck with using trial and error, but whilst musing over a mathematics question, I thought of how the general equation of a circle may be used to create an equation in order to find the offset. I knew taking A level maths had its rewards!

This article will derive a formula from the general equation of a circle, which you can then use to calculate the displacement – you could just skip to that bit, but you'd probably be best off reading the whole article to get an idea of where it comes from. The mathematics involved isn't that great, no more than simple GCSE or AS level.

Here is a diagram of the problem, modelled as a circle with a tangent at junction J. The tangent is the running line, and the circle represents the diverging line of a known radius r. Of course we don't need the whole circle, just a small arc of it – but we can easily discard the surplus information later.

We need to know d, the offset to use for the diverging line at a point x meters away from the junction. This is what can be fed into a BVE .rail statement.

(x - a)2 + (y - b)2 = r2
(for an explanation and proof of this, see any GCSE or A-level Pure Mathematics textbook)

We know r, the radius of the circle. To make the problem easier, we can let the centre C of the circle be (0, r) e.g. for a 400m radius curve, it will be at (0,400) (taking 1 unit to be 1 metre). This means the origin of the coordinates system is the start of the junction (i.e. point J is at (0,0)) – which simplifies things later.

Hence for our circle, we now have the formula
X2 + (d - r)2 - r2 = 0
Rearranging and substituting d for y gives
X2 + (d - r)2 - r2 = 0
More conveniently, we can rearrange to make d the subject, and hence write
d = r - (r2 - x2)1/2
(the limitations of HTML force us to substitute the 1/2 exponent for the square root symbol)

And so we have the formula.

We can now make use of this formula. Substituting the known value for r, and x (displacement from the start of the junction, which will be in 25m increments) will allow to you solve for d.

Note though that when x > r, the equation breaks down.

Here is a plot of d (y - axis) against x (x - axis) for a curve where r = 150. You can see the circle shape at the lower end of the scale, but when x > 150 (approximately) the line continues on, not following the circle.



To show the usage of the equation a little more clearly, let us go through an example.

Example

(NB: the first version of the article contained an error in this section – this was due to an oversight / cock-up on my part. This version is canonical.)

To plot a rail that diverges on a line of radius 800m from the mainline:

Taking first 25m from the junction, we know at this point
r = 800 <--- the radius of our curve
x = 25  <--- how far away we are from the origin
So if we substitute those values into the equation
d = r - (r2 - x2)1/2
we get
d = 800 - (8002 - 252)1/2
and punching those values into a calculator gives d = 0.39 (3SF).

You could take it to a greater degree of accuracy, but for the purposes of BVE, 3SF is plenty sufficient.

To calculate values at the subsequent points, you simply need to increase the value of x. For the purposes of BVE, this will normally be in 25m segments.



As an example, I put the values calculated into the OS_ATS test route and applied an 800m radius smooth curve object onto the diverging curve. The fact that the smooth curve object appears with no kinks on this line verifies that the equation is correct.

Other Formulae

As with so many problems, there are lots of ways of solving it – a search of the Train-Sim.com forums reveals a range, some using trig or circle segments instead of a purely algebraic method. Remember also that a little adjustment to the values might be necessary before putting your values into the final route, particularly if they must fit particular objects, or simply if the “correct” curve looks odd when put into the route.

Displacements Table

The following table has been constructed to aid route developers in finding instant offset values for common curve radii.

To use it, select your radius from the top. Then work down to the desired displacement value (x), and the value of d will be in the respective cell.

Table 1: 150 < r < 650

Table 2: 700 < r < 2000

I've constructed a spreadsheet to allow you to quickly calculate values of d by this method, if you don't want to use a calculator. This will be available in .ods format from http://brj.rr.nu in the near future.

I hope this article has been of some use to you, if you want to discuss the formula or pick holes, then feel free to email me tombeevers2000 gmail com .

Tom

More Articles:
[Visit the VR Reading Room.]

If you want to be notified when a new article arrives, join the VR-News group at Yahoo. This group is purely for notification. Anyone can join; only the moderator can post.

�2006 Tom Beevers. All rights reserved.