View Full Version : Compass headings
sniper297
02-17-2008, 09:15 PM
Been saying all along it would be nice if there was a way to find out the direction the track was going, I think that's what some of you math whizzes are talking about with your cosines and tangents. Way to get an approximate compass heading in the absence of any real data;
http://forums.flightsim.com/vbts/showpost.php?p=1371377&postcount=3
If I know the radius of the curve and the length of the curve, I can use the PI formula to find out the angle of divergence of the curve. Knowing that, a 200 meter diameter circle is 628 meters in circumference, or 1.744 meters per full compass degree.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1631&stc=1&d=1203296769
When you start a world editor session the tracklaying tool defaults to due north, that's your starting benchmark, don't rotate the doohickey.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1632&stc=1&d=1203296780
Start stretching a track out from the starting direction, hold down the CTRL key and wiggle it back and forth;
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1633&stc=1&d=1203296790
Until the lines turn yellow and it snaps straight.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1634&stc=1&d=1203296798
Now you have a piece of straight track aligned due north and south. Copy that (CTRL C) and then move to where you want to work and paste a copy (CTRL V). Limits of the new forum, next post more pics.
sniper297
02-17-2008, 09:25 PM
For this example, let's say I'm doing a prototype route and need to start from a silo and lay track heading 255 degrees.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1635&stc=1&d=1203297372
255 is in the southwest quadrant, 75 degrees off due south.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1636&stc=1&d=1203297379
75 times 1.744 comes out to 130.8, you may need to decide how fussy you want to be with this, is 130.9 close enough or do you want to spend a few minutes wiggling the mouse around until you hit 130.8 exactly? Managed to get it after a couple minutes, coming off the south end of my benchmark track and turning right 75 degrees, the end of this track is now heading 255.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1637&stc=1&d=1203297385
Detaching that curve section I move it over to the silo, at the same time adjusting the Y value for whatever elevation MSL the specs call for.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1638&stc=1&d=1203297391
And then from the end of that curve, start my line heading 255 at the correct elevation from my chosen starting point.
PaulD
02-18-2008, 06:27 PM
If I read what you are saying correctly, we need an option to type in the direction (in degrees) that we want to lay track in as opposed to just setting the direction freehand?
Even with the "Shift" option for "fine tuning" you still can't lay a second track EXACTLY parallel to the first. It's going to intersect or move away somewhere down the line. We need a way to lay a track at an exact angle.
Is that correct?
sniper297
02-18-2008, 07:57 PM
Hee-hee, I wrote that for the prototype purists, not for "we", I don't really give a rat's ass if I make the Lake Street EL route and the Laramie Avenue station is 35 feet northeast of where it is in the real world. These things are important to some people tho, in MSTS some of the Pocket Protector Petes manually hacked assorted position and Qdirection values in the WORLD files, even creating spreadsheets to match the real world values down to a thousandths of an inch. :rolleyes: For my purposes it would be nice to be able to type in a compass direction within one full compass degree, or even be able to READ which direction the track is going, but since the game don't provide that, this is a workaround if you're not really seriously fussy.
Parallel tracks, they took out the option to use the offset tool for tracks because track generated by that process has no track rule, You can still add a parallel track later, just a matter of using what's available.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1655&stc=1&d=1203378461
Let's say for this one I need to add another yard track and want it to be exactly parallel to the others. Use the split tool to disconnect a section;
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1656&stc=1&d=1203378469
Straight part is 22.8 meters, write that down;
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1657&stc=1&d=1203378477
Curve is 120.6 meters long and 117.5 radius, write that down. Select a track rule (or make your own by hacking the bin) with the parallel spacing you want and lay doubletrack, replacing the section you cut out and at the same time adding the track parallel to that.
http://forums.flightsim.com/vbts/attachment.php?attachmentid=1658&stc=1&d=1203378486
After that it's just a matter of laying more track to reconnect everything.
Straight track is dead simple, cut out a short section and replace with double track, then continue from the end of the parallel stub section for perfect alignment. You can also move it over to respace it, as long as you leave the rotation ring alone it will always be the same azimuth wherever you move it. :D
livercup
02-19-2008, 06:48 PM
I have succesfully figured out how to aim a straight piece of track in any direction (up to 1/10,000 of a degree I think). I figured out the directional thing in the Track Tile file, and created a formula, to change it to degrees, using excel. At this point I have only converted dergrees to the whole number, but my trials have worked!!!!
Now I have to figure out how to figure the degree direction from one lon/lat point to another.
Tom
sniper297
02-23-2008, 10:37 PM
Any further progress on that? Or at least what the datablock for a section of track looks like, with interpretation of what the numbers mean. Be nice to align bridges on a grade exactly. Or more or less exactly, anyway. :cool:
livercup
02-24-2008, 11:48 PM
I'm still fiddling with it. I can change the track tile file to repoint the track direction, but have not found the relationship with that number, lon/lat, or tile coordinates. Some sort of 3d projection matrix that I have not solved, Just did an interesting experiment, though, that might have some promise, but it's to late in the evening to verify it. Might need some input and advice from you Monday. This is one that would be much easier for RS to provide us than to figure out ourselves.
I would love to start track laying in my route, but I have some really long straight sections that I am not going to fake, as they will create all kinds of problems down the line. Besides, I am one of those anal folk that likes the track where it is suppose to be. I've spent 5 years laying 450+ miles of track in msts (one route) and haven't placed much scenery at all. BUT the track is where it is supposed to be! :) For me it is that challenge, more than anything else, that I enjoy. I love my railroad.
Tom
Paddington bear
02-25-2008, 12:17 AM
Hi,
livercup, it depends on what sort of distance you talking about between one lat/long and the other here as to whether you can continue in a straight line across the earths surface and end up where you intended. Such an idea is close to the realms of actual navigation and great circuls and rhumb lines and ....... oh wait, that only applies to finding ones way in the real round world. RS is a member of the flat earth society. Don't mind me, forget all this reality stuff.
Ross
livercup
02-27-2008, 08:31 PM
It has been a real pleasure relearning trigonometry if nothing else. Thanks to Sniper297 for his ideas in the thread this thread that got me started. What I've come up with so far is: (a) I can aim a straight piece of track, to any other point on the route, within 1/10 of a degree of accuracy. (b) I can align objects (like bridges) at zero grade including objects (and there are some) that have a different axis of orientation.
From here I can easily work out (I think) doing the same thing on a grade. I will work on it next. I am also still working on deciphering the 3d matrix so I can relate it to compass heading. If I can do this, I will be able to aim track straight to within 1/1000 of a degree of accuracy, which would be far better over great distances.
I'm going to clean up my excel file and write some directions, explanations, and comments (including what the numbers do in the Track Tile and Scenery File files. When I'm finished I would like someone to put it to the test, if you would be so kind. I have tested and retested the thing. and don't think there are any errors, but you never know.
Tom
livercup
02-27-2008, 11:20 PM
Figured out the grade stuff also.
Tom
trackinspector
02-28-2008, 07:04 PM
Hi Tom,
How did you( or did you ) get the grade function to work? everytime I enter a grade in the box in the lower flyout it either stands the track straight up or down depending on whether I have a positive or negetive grade. I have the grades from a track chart for my area and would like to have them close if possible.
thanks for any insight
Larry
Paddington bear
02-28-2008, 09:12 PM
hi,
The grade box thingy number is the other part of a ratio. eg 1 in 600. the 1 is taken for granted in RS and the whole number is what you enter in the box . if you want a 1% grade and you put 1 in the box it is the equivilent of 1 : 1 = 45 degrees so the track goes straight up or down as anything over a certain point is considered impossible. So a 1% grade needs 100 in the box. - for down hill.
Ross
trackinspector
02-28-2008, 10:11 PM
Thanks Ross,
I was trying to make it to complicated:o,your explanation makes sense, now it works
Larry
sniper297
02-29-2008, 02:34 PM
Had the same problem, got a decimal point with four zeros after it and assumed they were there for a purpose. Apparently them silly Redcoats added them as a joke since only the whole numbers are used in the "1 in XXX" gradient rules. There are different ones, like so many "Mils" (furriner heathens are allergic to good old Christian feet and yards) or an actual percent grade. I'm used to the 1 in XXX now so I always use that, automatically making the conversions (want a 1% grade that's 100, 2% grade is 2 in 100 same-same 1 in 50 so type in 50, etc.). Mostly I adjust afterwards to get the track to the same height as the one I want to connect it to, and the grade ends up being whatever it comes out to.
http://forums.flightsim.com/vbts/showthread.php?t=263973
Addendum to that old post, Adam casually mentioned the "L" key once, haven't been able to drag a full list out of him yet since we can never catch him. But if you select the gradient tool and hold down the L key while clicking every few feet along the tracks you can conform track to the terrain contours, which is how my roller coaster route in the file library was done. :cool:
livercup
02-29-2008, 09:37 PM
Ok, I figured out the matrix and can aim a straight pieces of track anywhere. The last test I did, I aimed a piece from one point to another 22 miles away, and was off by only four feet. That is as good as it gets, with having to round off coordinates in the Track Tile File, and is perfectly good enough for my purposes.
Also figured out the scenery part of it (bridges etc...). You can easily clone a second piece to the exact heading and grade of the first. I can also set any "beginning piece" to any heading and grade I choose. Could probably adjust the second piece's height to match the end of the first piece, but haven't gone there yet. Isn't there some way to snap these peices together anyway? I haven't played with much object placing yet, just object munipulation.;)
I'm not sure what anyone would wish to use this for specifically, so if you let me know, I might be able to taylor it. If anyone wants it that is.
Tom
livercup
03-01-2008, 12:35 PM
What I got so far. Start pic is mile post 76. found coordinates for desired start and end, put them in excel formula, come up with new RS heading, change the Track Tile File, reload, end up at Mile Post 54 appx. 4 feet from aiming point.
Tom
livercup
03-01-2008, 12:38 PM
This is the heading for scenery files. It is a little more complicated. Copy these to another piece of scenery and you will have the same heading and grade. If pieces have differnet axis of orientation you must convert these.
Tom
livercup
03-01-2008, 12:42 PM
Bottom right of the scenery file should say "z coordinate not shown". This is how you idnetify you scenery piece, sorry. Again I've figured out the matrix and how to create these headings from scratch using desired heading and grade. Working on tidying up the file this weekend.
Tom
livercup
03-15-2008, 01:54 AM
Got it done and tested. Will somebody look at it for me, and see if they can find any errors? If it checks out I will upload it, if anyone wants that is.
Tom
sniper297
03-15-2008, 01:21 PM
Little lost here;
http://forums.flightsim.com/vbts/attachment.php?attachmentid=2419&stc=1&d=1205597426
Got a section of straight track, got a bridge, at different angles. Only use I can see would be if I can change the rotation of the bridge to match the track section exactly.
Track section tangent;
StartTangent d:numElements="2" d:elementType="sFloat32" d:precision="string">0.1247 0.9922</StartTangent
Dunno how that relates to compass degrees, but let's look at the bridge;
<Height d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0.0000</Height>
<RXAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">0.9762 0.0000 0.2170 0.0000</RXAxis>
<RYAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">0.0000 1.0000 0.0000 0.0000</RYAxis>
<RZAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">-0.2170 0.0000 0.9762 0.0000</RZAxis>
Dunno which is the horizontal rotation axis, and in any case there's four blocks of numbers in each rather than two, so what gets copied over?
Be advised, I dropped out of a vocational high school where I majored in auto mechanics and knife fighting, so altho I have the skills to change your spark plugs and manufacture a switchblade in a machine shop, I don't even know how to open an Excel spreadsheet. Manual hacking of the files in RStoolsTMB is the limit of my skills here.
livercup
03-15-2008, 02:15 PM
Hi, what I figured out is how all those x y and z axis work in RS. What I can do now is aim a piece of track directly to anyother point in the route and align that bridge exactly to that track heading and grade. You do have to manually change that Track Tile Files and the scenery files. What the excel file does is formulate all those headings for you and show you where to put them.
For me, I just wanted to be able to accurately cover long distances from point to point. I started fiddling with it, and quite miracalously, figured it out. I am no math wizard, just curious. As for as aligning the bridges goes, I just wanted to see if I could do it. Might have some application for someone, might not interest anyone, I've just have had fun doing it. And I can have my accurate straight track now.:o
TOM
sniper297
03-15-2008, 06:25 PM
Question is, which is which? I'd be delighted to test this by aligning the bridge with the track by hacking the bin file, but have no idea how the numbers correlate from one to the other.
livercup
03-15-2008, 06:57 PM
You get the tile numbers and piece coordinates from in the sim, or the files themselves, put them in the spread sheet, and the spread sheet converts them those coordinates to the RailSim Matrix. Copy the matrix (x,y,z coordinates) to the track piece( track piece z coordinates only) or bridge (xyz), save the file , restart the sim, and they are now at the same heading and grade. As of now, you must then drag the bridge to the track piece, but I am looking into them marrying themselves. I've added instructions, including illustrations, and would be happy to answer any questions you may have.
zbobg
03-15-2008, 07:05 PM
Got a section of straight track, got a bridge, at different angles. Only use I can see would be if I can change the rotation of the bridge to match the track section exactly.
Track section tangent;
StartTangent d:numElements="2" d:elementType="sFloat32" d:precision="string">0.1247 0.9922</StartTangent
Dunno how that relates to compass degrees, but let's look at the bridge;
<Height d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0.0000</Height>
<RXAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">0.9762 0.0000 0.2170 0.0000</RXAxis>
<RYAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">0.0000 1.0000 0.0000 0.0000</RYAxis>
<RZAxis d:numElements="4" d:elementType="sFloat32" d:precision="string">-0.2170 0.0000 0.9762 0.0000</RZAxis>
Dunno which is the horizontal rotation axis, and in any case there's four blocks of numbers in each rather than two, so what gets copied over?
That's exactly what I want to know how to do, and exactly where I got stuck and gave up.
Tracks are aligned by compass heading - the tangent entry - and the gradient of the track is set by a start altitude and an end altitude, that corresponds to the 'gradient tool' markers in the editor.
In comparison, static scenery objects (the bridge) are aligned by a quaternion matrix (the R?axis entries) which translates to an X axis rotation, a Y axis rotation and a Z axis rotation. The rotation is from north pointing and perfectly level. It is equivalent to pitch, yaw and roll.
So how to align a static scenery object to a track? Assume the track points north for no Y rotation, the track is not tilted left or right for no Z rotation then what's left is the X rotation which gives the tilt up and down or gradient. Given a track length and a start altitude and end altitude it's possible to compute an angle for the track gradient and translate that into a quaternion for the Y rotation. After placing the static object you could manually enter the X matrix numbers and thereby have that object perfectly aligned with the track. I think I might have the X,Y,Z axis definitions mixed up. but you get the idea. Not sure which axis rotates which way. One of the problems is that the X and Z axis are mathematically related in a non-obvious way.
Complicated? Yes, very. Impossible? No, but nearly, and tedious to do.
I'm thinking I might by examination of placed objects develop a table of matrix numbers for common gradients which could be used by manually editing the scenery tile's file. This would be used by placing a bridge, for example, then without moving it at all (as in pointing north with no left/right no up/down etc.) immediately manually edit the scenery tile to set the gradient. One that's done the object could be rotated left and right, up and down, forward and backward as necessary to get a final alignment so long as you don't change the gradient. When multiple objects are needed (bridges for example) a copy and paste of the first placed edited object is sufficient.
The difficulty is that it is almost impossible to obtain the actual gradient of a piece of track inside the editor. Point at the track and you get an indicator but it doesn't give an exact gradient value. So the only sure way of determining the track gradient is by a {track length / start alt / end alt } triangulation calculation.
The easy solution is to only use lofted scenery objects for aligning to track. It might even be possible to convert any static bridge (or other object) to a lofted object, you would use a population of one for example.
Here's another idea. It might be possible to take a stock Road or Track object, substitute a bridge geometry with the result being an bridge with gradient handles (in the editor) which you could use to more effectively align to a piece of track.
livercup
03-15-2008, 07:28 PM
I think I've come pretty close. True a track piece heading is based on the Z coordinate, but a acenery object which has a default n/s orientation is matched to the grade by the x axis. If it is deafult e/w then you use the y axis. The grade of track showing in the editor might not be exact, but unless your bridge is 3 miles long I don't think it makes a difference.
I recreated the rail sim matrix in the excel file and you can orient your track and objects any way you want using the info in the editor, Track Tile File, and Scenery File. It does work. I wish you guys would have a look. I will email it to you. If you agree I will upload it.
livercup
03-15-2008, 07:42 PM
By the way, ZbobG, you put me on to it with your reference to those web sites you gave me on the railsim forum. It took me a while to figure it out beacuse the RSmatrix doesn't match up exactly to the way the web site explained the 4x4 matrix (RS actually using 3x3). xyz values were swapped as well as the numbers in those matrix lines. Through trial and error I figured out what matched what and plugged it in excel. Then more trial and error. I swear it works.:D
zbobg
03-15-2008, 08:18 PM
I'm sure you'll understand that flight Sims, train Sims, engineering equations and modeling programs may (they usually do in fact) use different axis definitions. You just have to figure out which one is in use and translate properly. I guess you did that.
I would like to look at your work, but I have very limited Excel functionality. It called 'boycott Microsoft products' so I don't currently own or use Excel although I have used Excel in the past and I am familiar with its methods and use of equations. I am offended by Microsoft's refusal to use commonly accepted open source file formats and their refusal to publish the specifications of their proprietary file formats.
I'm currently using the Open Office Suite which has an Excel spreadsheet importer that may work as well as Excel. I also have a very old copy of Word 2000 which can also import Excel spreadsheets but it has very limited functionality.
You can e-mail me, I think, from my user info at this website. Or send me a PM and I'll give you my e-mail address.
livercup
03-15-2008, 08:43 PM
Just checked, it appears to work ok in open office.
Tom
livercup
03-19-2008, 01:01 AM
I found a few ommissions and errors and have corrected those. Also added the ability to calculate actual gradient using track coordinates. You were right, the grades are quite off in the editor. The editor rounds everything off, and it can make a difference when aiming and aligning. Tested and retested and it works correctly. Uploaded to file library today. Hope someone enjoys it!
Tom
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.