Elvas Tower: Quaternion Math.... - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Quaternion Math.... Rate Topic: -----

#1 User is offline   eric from trainsim 

  • Waste Disposal Engineer
  • Group: Private - Open Rails Developer
  • Posts: 1,578
  • Joined: 30-October 10
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 03 May 2013 - 11:54 AM

I'm currently reworking some of the guts on WorldFileHacker as I port it over to C#, particularly its ability to create forest objects along a track vector.

Reading in the TrackObj, I can extract out the second and fourth values of a QDirection.

Is there a somewhat straight-forward formula or even a function in C# which can be used to calculate the world file coordinates for what would be (as an example) 20 meters left and right of the centerline?

Right now, I'm just doing an offset set to the X/Y axis, but that's just not giving me the results I want.

#2 User is offline   Deepguinness 

  • Conductor
  • Group: Status: Active Member
  • Posts: 341
  • Joined: 30-April 08
  • Gender:Male
  • Location:Saarland
  • Simulator:MSTS
  • Country:

Posted 03 May 2013 - 03:58 PM

Hi eolesen,

please look in the documentation of Micheal Vone's Object Rotator.
I think there you find the formulars you need.

Search in the train-sim library for: objrot2.zip

Cheers
Arnold

#3 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,352
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 03 May 2013 - 04:59 PM

The object rotator spreadsheet has most columns of every page hidden and the page locked and as such it's impossible to examine the formulas. You'll need to find and download an excel password cracker that will open things up. I used that so on a few pages I could move the data entry cells down some rows to be adjacent to the answer cells (so I could see both when using the sheet). One glance at the revealed formulas was enough to convince me not to explore much and certainly to not change anything else. :sign_thanks: After some lengthy amount of time the pages locked up again and having made the few changes I needed I've left it locked.

I use the rotator sheets very, very often and regard them as one of only two truly indispensable tools for the route builder (the other is DEMEX).

Good luck.

#4 User is offline   Deepguinness 

  • Conductor
  • Group: Status: Active Member
  • Posts: 341
  • Joined: 30-April 08
  • Gender:Male
  • Location:Saarland
  • Simulator:MSTS
  • Country:

Posted 03 May 2013 - 05:07 PM

I don't ment the Excel spreadsheet, but the Word document: Object Rotator for MSTS-v2.doc

Cheers
Arnold

#5 User is offline   eric from trainsim 

  • Waste Disposal Engineer
  • Group: Private - Open Rails Developer
  • Posts: 1,578
  • Joined: 30-October 10
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 03 May 2013 - 07:34 PM

Thanks, Arnold & Dave, I'm already familiar with the document and utility.

What I'm looking for isn't really covered there -- it's meant for calculating straight line and curved distances.

What I am looking for is a function that would allow me to plug in a value representing the quaternion, and return the relative XY angle.

From that, I'd have the length of the hypotenuse (my offset distance) and the adjacent angle. Calculating the adjacent length and opposite length would give me the X and Y offsets to adjust my forest object's position parameters (or telephone poles, anything else which might be useful to try and offset as a faux-gantry object, etc...).

#6 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,352
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 03 May 2013 - 08:41 PM

You want right angle offsets, right? That's in the Line Up tab -- a two step process but if you know the formulas you can code it however you want. For any other angle use the rotate about object axis to obtain a qdirection value for the desired direction and the use that value over on Line Up with the desired distance.

#7 User is offline   Deepguinness 

  • Conductor
  • Group: Status: Active Member
  • Posts: 341
  • Joined: 30-April 08
  • Gender:Male
  • Location:Saarland
  • Simulator:MSTS
  • Country:

Posted 04 May 2013 - 02:34 AM

I used this document to place wire and poles at the tracks.
I made a spreadsheet to calculate the next position for the pole, using length of the wire, start position and the qdirection values.
It worked fine.

I hope you find the information you need. A possibility should be to contact Micheal Vone.

Cheers
Arnold

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users