Elvas Tower: TSRE Mod - Update Rotation - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

TSRE Mod - Update Rotation Rate Topic: -----

#11 User is offline   eric from trainsim 

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

Posted 27 February 2017 - 03:43 PM

View PostJovet, on 27 February 2017 - 03:27 PM, said:

I am pretty sure it's the Paste button next to the Copy Rot button. If it were captioned Paste Rot that would make more sense.


I tried that. It allows you to copy the QD from another track section or scenery object and apply it to the selected object, but there's no data entry option.

What I want to do is enter in a quaternion value that's being calculated by an outside utility.

#12 User is offline   Jovet 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 2,250
  • Joined: 14-January 08
  • Gender:Male
  • Location:Omaha, Nebraska.
  • Simulator:MSTS/Open Rails
  • Country:

Posted 27 February 2017 - 04:21 PM

View Posteolesen, on 27 February 2017 - 03:43 PM, said:

I tried that. It allows you to copy the QD from another track section or scenery object and apply it to the selected object, but there's no data entry option.
What I want to do is enter in a quaternion value that's being calculated by an outside utility.

Oh, sorry, I was under the impression you couldn't find the Paste button Goku was talking about.
The quaternion values are just regular text on the clipboard. You could type them into Notepad or something and Copy them to the clipboard and Paste them into TSRE in the interim.

#13 User is offline   eric from trainsim 

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

Posted 27 February 2017 - 07:36 PM

View PostJovet, on 27 February 2017 - 04:21 PM, said:

The quaternion values are just regular text on the clipboard. You could type them into Notepad or something and Copy them to the clipboard and Paste them into TSRE in the interim.


Thanks Joseph, that was the trick. It's a little kludgy, but copying the quaternion values over to the Windows clipboard worked with the Paste button next to "Copy Rot"


Todd (and others), I'll see if I can spend a little programming time to read in tile & X/Y/Z values from TSRE like the current app does with the RE's camera window.

The current functionality already copies the entire QDirection () line over to the Windows clipboard, so it's straight forward modify Tangent to copy just the quaternion values for a TSRE user.

#14 User is offline   Goku 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 27 February 2017 - 07:57 PM

Quote

kludgy

? It is much easier to just copy and paste something instead of typing by hand ...

#15 User is offline   SP 0-6-0 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 985
  • Joined: 12-November 05
  • Gender:Not Telling
  • Location:Another planet.
  • Simulator:MSTS/ORTS
  • Country:

Posted 02 March 2017 - 07:05 PM

Is Tangent still available any place?

Robert

#16 User is offline   eric from trainsim 

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

Posted 02 March 2017 - 08:05 PM

I never published it anywhere, but have made it available to anyone who asked.

Here's the last setup file I had for it.

Attached File(s)



#17 User is offline   eric from trainsim 

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

Posted 03 March 2017 - 08:50 AM

Since we lost some posts... Goku had asked if it made sense to include the functionality from Tangent within TSRE...

I think that's a fine idea. The formula used in Tangent is below:

public void DoMath()
{
    try
    {
        float dx = 2048 * (EndObject.TileX - StartObject.TileX) + EndObject.PosX - StartObject.PosX;
        float dy = EndObject.PosY - StartObject.PosY;
        float dz = 2048 * (EndObject.TileZ - StartObject.TileZ) + EndObject.PosZ - StartObject.PosZ;
        double heading;
        if (Math.Abs(dx) > 0)
        {
            if (dx > 0) {
                heading = 90 - 180 / Math.PI * Math.Atan(dz / dx);
            }
            else {
                heading = -90 - 180 / Math.PI * Math.Atan(dz / dx);
            }
        }
        else {
            heading = -90 + Math.Sign(dz) * 90;
        }
        double distance = Math.Sqrt((dx * dx) + (dy * dy) + (dz * dz));
        double slope;
        if (Math.Abs(dy / distance) < 0.99999)
        {
            slope = Math.Atan(dy / Math.Sqrt(dx * dx + dz * dz));
        }
        else {
            slope = Math.Sign(dy / distance) * 1000;
        }

        double slopedeg = 0;
        if (Math.Abs(dy / distance) < 0.99999)
        {
            slope = 180 / Math.PI * Math.Atan(dy / Math.Sqrt(dx * dx + dz * dz));
        }
        else {
            slope = Math.Sign(dy / distance) * 90;
        }

        double headingcos = Math.Cos(-0.5 * heading * Math.PI / 180);
        double headingsin = Math.Sin(-0.5 * heading * Math.PI / 180);
        double slopecos = 1;
        double slopesin = 0;
        double slopedegcos = 1;
        double slopedegsin = 0;
        double QD4 = (headingcos * slopecos * slopedegcos) + (headingsin * slopesin * slopedegsin);
        double QD2 = (headingsin * slopecos * slopedegcos) - (headingcos * slopesin * slopedegsin);
        double QD3 = (headingcos * slopesin * slopedegcos) + (headingsin * slopecos * slopedegsin);
        double QD1 = (headingcos * slopecos * slopedegsin) + (headingsin * slopesin * slopedegcos);
        QD = Math.Round(QD1, 6).ToString() + " " + Math.Round(QD2, 6).ToString() + " " +
         Math.Round(QD3, 6).ToString() + " " + Math.Round(QD4, 6).ToString();
        textBox1.Text = QD;
        Clipboard.SetText(QD);
    }
    catch {
        textBox1.Text = "Unable to calculate";
    }
}



#18 User is offline   SP 0-6-0 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 985
  • Joined: 12-November 05
  • Gender:Not Telling
  • Location:Another planet.
  • Simulator:MSTS/ORTS
  • Country:

Posted 03 March 2017 - 12:15 PM

Thanks for making Tangent available. I will be checking it out this weekend.

Robert

#19 User is offline   Goku 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 03 March 2017 - 02:57 PM

Thanks for sharing, but TSRE has already functions for this, used in other places.

#20 User is offline   cnw_fan 

  • Hostler
  • Group: Status: Active Member
  • Posts: 86
  • Joined: 21-January 15
  • Gender:Male
  • Simulator:MSTS
  • Country:

Posted 04 March 2017 - 06:01 AM

I would like to see functionality of Tangent be made possible in TSRE. I use Tangent a lot but I have to use the old MS editor for functionality to calculate the two points of a road or track object. Please consider Tangent as a function , that way people who use TSRE won't have to take so many steps to make Tangent work or go back to MS editor. Just make sense to add Tangent. That was the whole purpose of this thread.

  • 2 Pages +
  • 1
  • 2
  • 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