Let me catch up here. I started a post last night that got too long and I kept falling asleep and gave up.
@BuilderBob
If you only used points A thru F how did you determine the elevation curve you plotted thru them as the track height can only be measured at the spline points?
In the gradient plot the curve drops to 0 between each spline point. If the grade was layed out correctly I wouldn't expect to see this. How did you measure this as the gradient is only available in the hud displays in Driver and the spline points aren't?
The Trainz track spline does infact act a bit like this as the curvature tend to be larger near the spline points and flattens out as you approach the middle - at least when you have long sections of spline between widely space points. But because of the way the adjacent sections effect the shape I wouldn't expect to see every section doing the same thing.
The Trainz track spline is a bit of a mystery as no one outside N3V apparently knows its exact make up. I have my own ideas based on a lot of testing that it's a type of cubic bezier spline. Normally 4 points are required to define this curve. 2 end points that it passes thru and 2 intermediate points that is doesn't pass thru unless it is a straight line. The 2 intermediate points are used to control the shape of the curve. In Trainz though we only have the end points to control the shape. Since 4 points are required the game must create the other two for us.
Those 2 intermediate don't exist as points in the route, a mathematical location works just as well and in fact another formulation of the spline using end points and end tangents could also conceivably work. The location of the intermediate points though would lie on the extensions of the chords of the adjacent spline sections at some fixed fraction of the chord length from the end points. Hence the end point of the next section can be used to change the shape of the curve but end points further away have no effect on it. Not as fexlible as the normal bezier formulation but we've traded some flexibility for assurance that the curve will be well behaved and suitable for running trains - wiggles not included. At least that's the way I see them and have programmed them in some of the utility programs I use. If you were using TRS06 I could read the trk file and plot out everything I need to figure out what's going on but TS12 I can't work with yet.
Bob Pearson
@BuilderBob
You kind of lost me here. Are you saying the projected horizontal distance doesn't matter? Because it does - in fact it's vital. The height difference between the spline points is directly proportional to the projected horizontal distance. The gradeient is the difference in height between two adjacent spline points divided by the projected horz distance of the arc length between them. Expressed as a ratio or percentage or whatever way you care to do it. If you plot out the track route elevation the vertical axis should be the height and the horizontal axis must then be the horizontal projected distance of the arc length. Unless you follow this convention the gradients will appear distorted.That the gradient might be calculated over a linear distance was my first concern, but that was easily dismissed. That the arc distance calculation might be inaccurate did occur to me, but I was not originally concerned with the actual path length calculation - I just needed it to be long enough to get the required height change at the given (average) gradient - the exact length needed to achieve that didn't matter. That approach also means that any need to project the track onto the horizontal plane to calculate distance would not affect things.
Based on what I said above I have to ask what is the scale you used for the horizontal axis in the above plot? Also how did you measure the projected horz distance? Or as a practical matter just the arc length of the track since for most rr work the difference between the 2 is very small and could be for most practical cases be ignored. Based on the height difference the arc length of the track for this portion of the route should be about 4.4km.This is the height map. As you can see, the variations are extreme, and do not seem to be related to any problem smoothing the 2% into the start and end - in fact, the top section where it flattens is quite well smoothed. The bottom portion is a 2% straight through a tunnel and that also smooths into the first section quite well. Perhaps I need more tunnels and bridges. A B C D E F are the spline points, and the numbers next to them are the gradient in that direction.
The map makes it clear that the problem is associated with the spline points, but since the spline points also define the horizontal curvature then that probably doesn't help much.
If you only used points A thru F how did you determine the elevation curve you plotted thru them as the track height can only be measured at the spline points?
In the gradient plot the curve drops to 0 between each spline point. If the grade was layed out correctly I wouldn't expect to see this. How did you measure this as the gradient is only available in the hud displays in Driver and the spline points aren't?
The Trainz track spline does infact act a bit like this as the curvature tend to be larger near the spline points and flattens out as you approach the middle - at least when you have long sections of spline between widely space points. But because of the way the adjacent sections effect the shape I wouldn't expect to see every section doing the same thing.
The Trainz track spline is a bit of a mystery as no one outside N3V apparently knows its exact make up. I have my own ideas based on a lot of testing that it's a type of cubic bezier spline. Normally 4 points are required to define this curve. 2 end points that it passes thru and 2 intermediate points that is doesn't pass thru unless it is a straight line. The 2 intermediate points are used to control the shape of the curve. In Trainz though we only have the end points to control the shape. Since 4 points are required the game must create the other two for us.
Those 2 intermediate don't exist as points in the route, a mathematical location works just as well and in fact another formulation of the spline using end points and end tangents could also conceivably work. The location of the intermediate points though would lie on the extensions of the chords of the adjacent spline sections at some fixed fraction of the chord length from the end points. Hence the end point of the next section can be used to change the shape of the curve but end points further away have no effect on it. Not as fexlible as the normal bezier formulation but we've traded some flexibility for assurance that the curve will be well behaved and suitable for running trains - wiggles not included. At least that's the way I see them and have programmed them in some of the utility programs I use. If you were using TRS06 I could read the trk file and plot out everything I need to figure out what's going on but TS12 I can't work with yet.
Bob Pearson