Learn to code with Dennis - Tutorial 1-5 now available

Status
Not open for further replies.
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

nutter

Member
Joined
13 Nov 2005
Messages
769
Location
Albrighton, Nr. Wolves, Shrops
Just glad i din't have to do the maths. For the route i want to build once these have finished (wolves-wellington) there arn't any island platforms and only 2 diveraging routes.

THANKS FOR THE GREAT TOOLS
 

Tom B

Established Member
Joined
27 Jul 2005
Messages
4,559
Sadly BRJ appears to be down at present... but the VR article is more up to date.

Spready never found it's way online - but I'll put it up in the near future.

Displacement tables were done one day when bored at lunchtime :D.
 

nutter

Member
Joined
13 Nov 2005
Messages
769
Location
Albrighton, Nr. Wolves, Shrops
looks like i'll have to go back to infants first.

ask my mates. In my book 2+2=5.

It's a saying ain't it

If you make a wrong assumption then you are said to have put 2 and 2 together and got 5.

Anyone else heard of that saying
 

LabRatAndy

Member
Joined
4 Jun 2006
Messages
29
Nutter,
There is an article writen about calculateing the diverging curves like in Dennis's tutorial at http://brj.rr.nu in the development section it is the devopment/developing section under articles, called "Calculateing Diverging Curves.

Also try looking at maths revision web sites like www.mathsnet.net/asa2/2004/c22/circle2.html

Also remember you have to take in to account the co-ordinents of the centre of the circle when trying to calculate the postition of the diverging curve, this usually (0, radius of curve). Hope this helps yuo to get your head around the maths Nutter, it took me a couple of hours of head scratching to work it get it myself.

Thank you Dennis For such a Good tutorial, its good to learn how much work goes into creating routes

LabRatAndy.
 

nutter

Member
Joined
13 Nov 2005
Messages
769
Location
Albrighton, Nr. Wolves, Shrops
Nuts thinks it's going to take more than a few hours to get his head round this.

Nuts go a B in maths (GCSE) so it's just a case of looking at the right part of the books.
Which therom is it we're using, and could you give me a very simple example of how it works.
If it's something nuts recognises he'll be happy

(I like righting in 3rd person context, more intresting)
 

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
If you Google "equation of a circle" there are any number of explanations, for example this one http://www.analyzemath.com/CircleEq/Tutorials.html

The important thing to rememeber when applying this to BVE coding (certainly track geometry) is that we are looking at relative displacements between the circle and a straight line parallel to the y axis, hence when you see the equation written in the form (x - h)2 + (y - k)2 = r2 it can be simplified to x2 + y2 = r2.

Normally, we know the radius of the curves we are working with and given that we wish to calculate displacements (x) at known values of y (the distance along the track), it is more useful to rearrange this equation to x2 = r2 - y2.

Do not use the route distance as y - this must be set as being the point of divergence.

now get the calculator out....

If we apply this to generate (for example) the displacement (x) of a 750m (r)radius curve at 25m (y) from the point of divergence, we calculate the following;

r2 = 750 * 750 = 562500
y2 = 25 * 25 = 625

so, if x2 = r2 - y2 then x2 = 562500 - 625 = 561875
taking the square root of this will give us x = 749.58322.



Now for the important bit...
if we perform the same calculation at 0m we obtain the following;
r2 = 750 * 750 = 562500
y2 = 0 * 0 = 0

so, if x2 = r2 - y2 then x2 = 562500 - 0 = 562500
taking the square root of this will give us x = 750 - the radius of the curve.

It is the difference between the calculated displacements that are used when constructing diverging (or converging) curves, in this example at 25m the offset is given by 750-749.58322 = 0.41678m.

Similarly, for the same curve, 50m from the point of divergence,

r2 = 750 * 750 = 562500
y2 = 50 * 50 = 2500

so, if x2 = r2 - y2 then x2 = 562500 - 2500 = 560000
taking the square root of this will give us x = 748.33148.

and the offset will be given by 750 - 748.33148 = 1.66852m

If we were to use this as the basis for a curve in BVE, the code would look something like this (if we are starting the curve at 1000m)

1000,.railstart 1;0,
1025,.rail 1;0.41678,
1050,.rail 1;1.66852,

and so on. If the curve goes to the left, just use negative values of the calculated displacements.

There is no real need to use more than two decimal places in the route coding and the calculations can be performed much more rapidly in a spreadsheet.

In the spreadsheet on my website, to calculate the required offsets, just enter the radius into the cell indicated (C5, text coloured red) and the offsets (at 25m intervals) are returned as the green numbers in column H. So to use that spreadsheet, all you have to do is type in the radius of the curve.
 

Tom B

Established Member
Joined
27 Jul 2005
Messages
4,559
nutter said:
Nuts thinks it's going to take more than a few hours to get his head round this.

Nuts go a B in maths (GCSE) so it's just a case of looking at the right part of the books.
Which therom is it we're using, and could you give me a very simple example of how it works.
If it's something nuts recognises he'll be happy

(I like righting in 3rd person context, more intresting)

Plugging the right numbers into the formula

d = r - (r^2 - x^2)^1/2

where r is the radius and x is the displacement...

So for Dennises example of 50m into a 750m curve

d = 750 - (750^2 - 50^2)^1/2

which gives d=1.67 (3SF).

BTW if you're not that up on indices, anything raised to the power 1/2 is the square root of it. Indices are used here because they're easier than square root symbols to show in plain text.
 
Status
Not open for further replies.

Top