1. Dashboard
    1. Letzte Inhalte
  2. News
    1. Submit article
  3. Forum
  4. Chat
  5. Gallery
    1. Albums
  6. Lexicon
  7. Downloads
  • Login
  • Register
  • Search
Tools
  • Everywhere
  • Tools
  • Articles
  • Pages
  • Forum
  • Gallery
  • Files
  • Lexikon
  • News
  • News update
  • More Options

Welcome to our Page!

Dear visitor, welcome! To use all features of this page, you should consider registering. If you are already registered, please login.

Sign In Now
or
Register a new account
  1. Dashboard
    1. Letzte Inhalte
  2. News
    1. Submit article
  3. Forum
  4. Chat
  5. Gallery
    1. Albums
  6. Lexicon
  7. Downloads
  1. Dashboard
    1. Letzte Inhalte
  2. News
    1. Submit article
  3. Forum
  4. Chat
  5. Gallery
    1. Albums
  6. Lexicon
  7. Downloads
  1. Trainz.de
  2. Filebase
  3. Tools, software & tutorials
  4. Tools
  • Sidebar
  • Sidebar

MathPlus - Library mit häufig benötigten Mathefunktionen

    • ✔ TRS 2019
    • ✔ DLS
    • T:ANE
  • Mika
  • July 7, 2019 at 8:19 PM
  • 1k Downloads
  • 1 Comment
  • Download
  • Overview
  • Versions 2
  • Comments 1

Diese Library enthält Annäherungen für viele häufig benötigte Mathefunktionen und kann ganz leicht in euren Skript eingebunden werden

Beschreibung

Diese Library enthält Annäherungen für viele häufig benötigte Mathefunktionen und kann ganz leicht in euren Skript eingebunden werden.

Installation

1. <kuid:388413:439002> dem script-include-table hinzufügen. Wenn es in der config des Mutterassets noch keinen gibt, erstelle einen neuen wie folgt:

Code: Beispiel
script-include-table
{
    0                                     <kuid:388413:439002>
}

(2. <kuid:388413:439002> dem kuid-table hinzufügen. Der Eintrag muss "mathplus" heißen:) Dieser Schritt ist in der V2 nur noch optional!

Code: Beispiel
kuid-table
{
    mathplus                              <kuid:388413:439002>
}

3. include "mathplus.gs" am Anfang eures Skripts einfügen

4. MathPlus MathPlus; bei den globalen Variabledeklarationen hinzufügen

5. Nun noch diesen Code in der Init-Funktion hinzufügen, um die Library zu laden: MathPlus = cast<MathPlus>World.GetLibrary(me.GetAsset().LookupKUIDTable("mathplus"));  Diese Schritte werden in der V2 nicht mehr benötigt!

English Instructions

1. Add <kuid:388413:439002> to your script-include-table. Create a new script-include-table if you don't yet have one like:

Code
script-include-table
{
    0                                     <kuid:388413:439002>
}

(2. Add <kuid:388413:439002> to your kuid-table. Make sure you name the entry 'mathplus' like:) This is completely optional in V2

Code
kuid-table
{
    mathplus                              <kuid:388413:439002>
}

3. add include "mathplus.gs" to the top of your script file where the other includes are located

4. add MathPlus MathPlus; right after the beginning of your class where the other global variables are located

5. finally, add this line to your init method to actually load the MathPlus-Library: MathPlus = cast<MathPlus>World.GetLibrary(me.GetAsset().LookupKUIDTable("mathplus"));  In V2 do not do this. Including the scipt file will be enough.

6. Congratulations, you can now access functions like MathPlus.Round(5.62)!

Verfügbare Funktionen

public define float E = 2.7182818 (Eulersche Zahl, verfügbar via MathPlus.E)

public float Sqr(float x) (x²)

public float Pow(float base, float power) (Potenz zu beliebigem Exponent)

 public float Floor(float input) (Abrunden zur nächst kleineren Ganzzahl)

public int IntFloor(float input)

public float Ceil(float input) (Aufrunden zur nächst größeren Ganzzahl)

public int IntCeil(float input)

public float Round(float input) (ganz normales Auf/Abrunden basierend auf der ersten Nachkommastelle)

public int IntRound(float input)

public bool IsReal(float input) (Ist die Zahl eine Ganzzahl?)

public bool IsNatural(float input) (ist die Zahl natürlich?)

public int Fact(int input) (Fakultät einer Zahl)

 public float Sin(float x) (Trigonometrische Funktionen, standardmäßig mit Rad, alternativ mit Deg)

public float DegSin(float x)

public float Cos(float x)

public float DegCos(float x)

public float Tan(float x)

public float Exp(float x) (e^x)

Geplant

arcsin

arccos

arctan

Enthaltene KUIDs

<kuid:388413:439002>

Kritik, Wünsche, Verbesserungsvorschläge...

...sind gerne gesehen. Kürzere könnt ihr in die Kommentare des Downloads schreiben, längere bitte in den Thread, welchen ihr mit einem Klick auf den Button "Support-Thema" erreichen könnt :)

PS: Wer die Skriptdatei liest und den Kopf schüttelt: Die Funktionen sind so kompakt wie möglich gehalten, es wurde nicht viel ausgestaltet oder kommentiert. Das mache ich eigentlich nicht beim Programmieren, da hier aber viele Einzeiler vorkommen, welche man recht einfach verstehen kann und welche sich auch nicht kreuz und quer callen sondern schön von oben nach unten aufbauend, wurde an dieser Stelle auf große Pre-defs, Param-Erklärungen, usw verzichtet. Das meiste ist meiner Meinung nach selbsterklärend in diesem Fall.

  • Version v2 110120

    • Mika
    • January 11, 2020 at 10:15 PM
    • 7.48 kB
    • 507 Downloads

    V2 is now using a static class which heavily simplifies loading the library. You might need to make a slight change to existing scripts if you get errors.

  • Version 070719

    • Mika
    • July 7, 2019 at 8:19 PM
    • 7.54 kB
    • 532 Downloads
callavsg
July 7, 2019 at 9:01 PM

Die Funktionen in eine eigene static-Class und dann entfällt die Member Variable.... :)

Edit: Ich habe mich dazu auch nochmal im Support-Thread geäußert.

More Files by Mika

  • [1. Advent 2019] ÖBB 1044/1144 Pack

    Mika December 1, 2019 at 11:10 PM
  • NBS+ TSW2 Bakerloo Line Ansagenpack

    Mika December 9, 2020 at 12:21 PM
  • [TrainSimWorld2] NBS+ Zielanzeigen Upgrade

    Mika October 9, 2020 at 9:11 PM
  • NBS+ TSW2 Aachen - Köln Ansagenpack

    Mika September 7, 2020 at 10:58 PM
  • NBSPlus Road System

    Mika September 5, 2020 at 11:21 PM
All Files

Rechtliches

  1. Terms of use
  2. Data protection policy
  3. Imprint
Powered by WoltLab Suite™
Style: Inspire by cls-design
Stylename
Inspire
Manufacturer
cls-design
Licence
Commercial styles
Help
Supportforum
Visit cls-design