StarSim

StarSim.git
git clone git://git.lenczewski.org/StarSim.git
Log | Files | Refs | README | LICENSE

commit 3c3da8156e4d48abd7396db9bb92b73b68fbe157
parent 506a0bbae85e9a13c09190908c317476c734f49e
Author: Mikolaj Lenczewski <33129490+EnderRifter@users.noreply.github.com>
Date:   Wed, 19 Jun 2019 22:35:46 +0100

Added initial GUI framework, as well as database context and initial simulator database.

Diffstat:
MStarSim/StarSim.sln | 10++++++++--
AStarSim/StarSim/Contexts/SimulatorContextFactory.cs | 36++++++++++++++++++++++++++++++++++++
AStarSim/StarSim/Migrations/20190619213251_InitialMigration.Designer.cs | 23+++++++++++++++++++++++
AStarSim/StarSim/Migrations/20190619213251_InitialMigration.cs | 17+++++++++++++++++
AStarSim/StarSim/Migrations/SimulatorContextModelSnapshot.cs | 21+++++++++++++++++++++
MStarSim/StarSim/Program.cs | 4+++-
AStarSim/StarSim/Simulator.db | 0
MStarSim/StarSim/StarSim.csproj | 15++++++++++++---
AStarSim/StarSimGui/App.config | 43+++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/App.xaml | 9+++++++++
AStarSim/StarSimGui/App.xaml.cs | 17+++++++++++++++++
AStarSim/StarSimGui/Contexts/SimulatorContextFactory.cs | 36++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/MainWindow.xaml | 12++++++++++++
AStarSim/StarSimGui/MainWindow.xaml.cs | 28++++++++++++++++++++++++++++
AStarSim/StarSimGui/Migrations/20190619213346_InitialMigration.Designer.cs | 23+++++++++++++++++++++++
AStarSim/StarSimGui/Migrations/20190619213346_InitialMigration.cs | 17+++++++++++++++++
AStarSim/StarSimGui/Migrations/SimulatorContextModelSnapshot.cs | 21+++++++++++++++++++++
AStarSim/StarSimGui/Properties/AssemblyInfo.cs | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/Properties/Resources.Designer.cs | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/Properties/Resources.resx | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/Properties/Settings.Designer.cs | 30++++++++++++++++++++++++++++++
AStarSim/StarSimGui/Properties/Settings.settings | 8++++++++
AStarSim/StarSimGui/Simulator.db | 0
AStarSim/StarSimGui/StarSimGui.csproj | 246+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimGui/packages.config | 46++++++++++++++++++++++++++++++++++++++++++++++
DStarSim/StarSimLib/Body.cs | 129-------------------------------------------------------------------------------
MStarSim/StarSimLib/Constants.cs | 1+
AStarSim/StarSimLib/Contexts/SimulatorContext.cs | 48++++++++++++++++++++++++++++++++++++++++++++++++
DStarSim/StarSimLib/Examples/ExampleBody.cs | 69---------------------------------------------------------------------
MStarSim/StarSimLib/Extensions/Vector3fExtensions.cs | 5+++++
DStarSim/StarSimLib/OrbitGenerator.cs | 65-----------------------------------------------------------------
AStarSim/StarSimLib/Physics/Body.cs | 127+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AStarSim/StarSimLib/Physics/OrbitGenerator.cs | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MStarSim/StarSimLib/StarSimLib.csproj | 22++++++++++++++++++++++
AStarSim/StarSimLib/StarSimLib.xml | 444+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 files changed, 1610 insertions(+), 269 deletions(-)

diff --git a/StarSim/StarSim.sln b/StarSim/StarSim.sln @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.202 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarSimLib", "StarSimLib\StarSimLib.csproj", "{0FA6CC2D-C2B7-461B-AADC-4E3AECD2C05C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StarSimLib", "StarSimLib\StarSimLib.csproj", "{0FA6CC2D-C2B7-461B-AADC-4E3AECD2C05C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarSim", "StarSim\StarSim.csproj", "{E7DA74EF-E69A-4165-BF3D-5B641D991D75}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StarSim", "StarSim\StarSim.csproj", "{E7DA74EF-E69A-4165-BF3D-5B641D991D75}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarSimGui", "StarSimGui\StarSimGui.csproj", "{83F04A74-D9DB-4C8C-ABDC-3610099BCC51}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {E7DA74EF-E69A-4165-BF3D-5B641D991D75}.Debug|Any CPU.Build.0 = Debug|Any CPU {E7DA74EF-E69A-4165-BF3D-5B641D991D75}.Release|Any CPU.ActiveCfg = Release|Any CPU {E7DA74EF-E69A-4165-BF3D-5B641D991D75}.Release|Any CPU.Build.0 = Release|Any CPU + {83F04A74-D9DB-4C8C-ABDC-3610099BCC51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83F04A74-D9DB-4C8C-ABDC-3610099BCC51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83F04A74-D9DB-4C8C-ABDC-3610099BCC51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83F04A74-D9DB-4C8C-ABDC-3610099BCC51}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/StarSim/StarSim/Contexts/SimulatorContextFactory.cs b/StarSim/StarSim/Contexts/SimulatorContextFactory.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using StarSimLib.Contexts; + +namespace StarSim.Contexts +{ + /// <summary> + /// Factory class for creating <see cref="SimulatorContext"/> instances. + /// </summary> + /// <remarks> + /// This solves the problem of having the database context class in a common library, and trying to push migrations + /// to a specific user of the library. + /// SO question: https://stackoverflow.com/questions/46394494/ef-core-dbcontext-in-net-standard-2-0-library + /// Solution 1 : https://docs.microsoft.com/en-gb/ef/core/miscellaneous/cli/dbcontext-creation + /// Solution 2 : https://codingblast.com/entityframework-core-idesigntimedbcontextfactory/ + /// </remarks> + public class SimulatorContextFactory : IDesignTimeDbContextFactory<SimulatorContext> + { + #region Implementation of IDesignTimeDbContextFactory<out TaxiContext> + + /// <inheritdoc /> + public SimulatorContext CreateDbContext(string[] args) + { + DbContextOptionsBuilder<SimulatorContext> optionsBuilder = new DbContextOptionsBuilder<SimulatorContext>(); + + // we use SQLite due to the low overhead, ease of use, and great tooling (e.g. DB Browser for SQLite). + optionsBuilder.UseSqlite(SimulatorContext.ConnectionString, + builder => builder.MigrationsAssembly(nameof(StarSim))); + + return new SimulatorContext(optionsBuilder.Options); + } + + #endregion Implementation of IDesignTimeDbContextFactory<out TaxiContext> + } +} +\ No newline at end of file diff --git a/StarSim/StarSim/Migrations/20190619213251_InitialMigration.Designer.cs b/StarSim/StarSim/Migrations/20190619213251_InitialMigration.Designer.cs @@ -0,0 +1,23 @@ +// <auto-generated /> +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using StarSimLib.Contexts; + +namespace StarSim.Migrations +{ + [DbContext(typeof(SimulatorContext))] + [Migration("20190619213251_InitialMigration")] + partial class InitialMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ChangeDetector.SkipDetectChanges", "true") + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); +#pragma warning restore 612, 618 + } + } +} diff --git a/StarSim/StarSim/Migrations/20190619213251_InitialMigration.cs b/StarSim/StarSim/Migrations/20190619213251_InitialMigration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace StarSim.Migrations +{ + public partial class InitialMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/StarSim/StarSim/Migrations/SimulatorContextModelSnapshot.cs b/StarSim/StarSim/Migrations/SimulatorContextModelSnapshot.cs @@ -0,0 +1,21 @@ +// <auto-generated /> +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using StarSimLib.Contexts; + +namespace StarSim.Migrations +{ + [DbContext(typeof(SimulatorContext))] + partial class SimulatorContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ChangeDetector.SkipDetectChanges", "true") + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); +#pragma warning restore 612, 618 + } + } +} diff --git a/StarSim/StarSim/Program.cs b/StarSim/StarSim/Program.cs @@ -5,6 +5,7 @@ using SFML.Graphics; using SFML.System; using SFML.Window; using StarSimLib; +using StarSimLib.Physics; namespace StarSim { @@ -75,7 +76,7 @@ namespace StarSim Vector3d velocity = OrbitGenerator.RandomOrbit(position); //new Vector3d(); _bodies[i] = new Body(position, velocity, mass, _generation, id); - BodyShapeMap.Add(_bodies[i], new CircleShape(4) { FillColor = Color.White }); + BodyShapeMap.Add(_bodies[i], new CircleShape(1) { FillColor = Color.White }); Console.WriteLine(_bodies[i]); id++; @@ -117,6 +118,7 @@ namespace StarSim GenerateBodies(Constants.BodyCount, true); + Console.WriteLine("Press 'enter' to continue..."); Console.ReadLine(); RenderWindow window = new RenderWindow(VideoMode.DesktopMode, "N-Body Simulator", Styles.Default); diff --git a/StarSim/StarSim/Simulator.db b/StarSim/StarSim/Simulator.db Binary files differ. diff --git a/StarSim/StarSim/StarSim.csproj b/StarSim/StarSim/StarSim.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> @@ -6,11 +6,19 @@ </PropertyGroup> <ItemGroup> + <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4"> + <PrivateAssets>all</PrivateAssets> + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> + </PackageReference> <PackageReference Include="SFML.Net" Version="2.5.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\StarSimLib\StarSimLib.csproj" /> </ItemGroup> - -</Project> +</Project> +\ No newline at end of file diff --git a/StarSim/StarSimGui/App.config b/StarSim/StarSimGui/App.config @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> + </startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.1.14.520" newVersion="1.1.14.520" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> +\ No newline at end of file diff --git a/StarSim/StarSimGui/App.xaml b/StarSim/StarSimGui/App.xaml @@ -0,0 +1,9 @@ +<Application x:Class="StarSimGui.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:StarSimGui" + StartupUri="MainWindow.xaml"> + <Application.Resources> + + </Application.Resources> +</Application> diff --git a/StarSim/StarSimGui/App.xaml.cs b/StarSim/StarSimGui/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace StarSimGui +{ + /// <summary> + /// Logika interakcji dla klasy App.xaml + /// </summary> + public partial class App : Application + { + } +} diff --git a/StarSim/StarSimGui/Contexts/SimulatorContextFactory.cs b/StarSim/StarSimGui/Contexts/SimulatorContextFactory.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using StarSimLib.Contexts; + +namespace StarSimGui.Contexts +{ + /// <summary> + /// Factory class for creating <see cref="SimulatorContext"/> instances. + /// </summary> + /// <remarks> + /// This solves the problem of having the database context class in a common library, and trying to push migrations + /// to a specific user of the library. + /// SO question: https://stackoverflow.com/questions/46394494/ef-core-dbcontext-in-net-standard-2-0-library + /// Solution 1 : https://docs.microsoft.com/en-gb/ef/core/miscellaneous/cli/dbcontext-creation + /// Solution 2 : https://codingblast.com/entityframework-core-idesigntimedbcontextfactory/ + /// </remarks> + public class SimulatorContextFactory : IDesignTimeDbContextFactory<SimulatorContext> + { + #region Implementation of IDesignTimeDbContextFactory<out TaxiContext> + + /// <inheritdoc /> + public SimulatorContext CreateDbContext(string[] args) + { + DbContextOptionsBuilder<SimulatorContext> optionsBuilder = new DbContextOptionsBuilder<SimulatorContext>(); + + // we use SQLite due to the low overhead, ease of use, and great tooling (e.g. DB Browser for SQLite). + optionsBuilder.UseSqlite(SimulatorContext.ConnectionString, + builder => builder.MigrationsAssembly(nameof(StarSimGui))); + + return new SimulatorContext(optionsBuilder.Options); + } + + #endregion Implementation of IDesignTimeDbContextFactory<out TaxiContext> + } +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/MainWindow.xaml b/StarSim/StarSimGui/MainWindow.xaml @@ -0,0 +1,12 @@ +<Window x:Class="StarSimGui.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:StarSimGui" + mc:Ignorable="d" + Title="MainWindow" Height="450" Width="800"> + <Grid> + + </Grid> +</Window> diff --git a/StarSim/StarSimGui/MainWindow.xaml.cs b/StarSim/StarSimGui/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace StarSimGui +{ + /// <summary> + /// Logika interakcji dla klasy MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/StarSim/StarSimGui/Migrations/20190619213346_InitialMigration.Designer.cs b/StarSim/StarSimGui/Migrations/20190619213346_InitialMigration.Designer.cs @@ -0,0 +1,23 @@ +// <auto-generated /> +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using StarSimLib.Contexts; + +namespace StarSimGui.Migrations +{ + [DbContext(typeof(SimulatorContext))] + [Migration("20190619213346_InitialMigration")] + partial class InitialMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ChangeDetector.SkipDetectChanges", "true") + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); +#pragma warning restore 612, 618 + } + } +} diff --git a/StarSim/StarSimGui/Migrations/20190619213346_InitialMigration.cs b/StarSim/StarSimGui/Migrations/20190619213346_InitialMigration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace StarSimGui.Migrations +{ + public partial class InitialMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/StarSim/StarSimGui/Migrations/SimulatorContextModelSnapshot.cs b/StarSim/StarSimGui/Migrations/SimulatorContextModelSnapshot.cs @@ -0,0 +1,21 @@ +// <auto-generated /> +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using StarSimLib.Contexts; + +namespace StarSimGui.Migrations +{ + [DbContext(typeof(SimulatorContext))] + partial class SimulatorContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ChangeDetector.SkipDetectChanges", "true") + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); +#pragma warning restore 612, 618 + } + } +} diff --git a/StarSim/StarSimGui/Properties/AssemblyInfo.cs b/StarSim/StarSimGui/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// Ogólne informacje o zestawie są kontrolowane poprzez następujący +// zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje +// powiązane z zestawem. +[assembly: AssemblyTitle("StarSimGui")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("StarSimGui")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne +// dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z +// COM, ustaw wartość true dla atrybutu ComVisible tego typu. +[assembly: ComVisible(false)] + +//Aby rozpocząć kompilację aplikacji możliwych do zlokalizowania, ustaw +//<UICulture>Kultura_używana_podczas_kodowania</UICulture> w pliku csproj +//w grupie <PropertyGroup>. Jeśli na przykład jest używany język angielski (USA) +//w plikach źródłowych ustaw dla elementu <UICulture> wartość en-US. Następnie usuń komentarz dla +//poniższego atrybutu NeutralResourceLanguage. Zaktualizuj wartość „en-US” w +//poniższej linii tak, aby dopasować ustawienie UICulture w pliku projektu. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //gdzie znajdują się słowniki zasobów specyficznych dla motywów + //(używane, jeśli nie można odnaleźć zasobu na stronie, + // lub słowniki zasobów aplikacji) + ResourceDictionaryLocation.SourceAssembly //gdzie znajduje się słownik zasobów ogólnych + //(używane, jeśli nie można odnaleźć zasobu na stronie, + // aplikacji lub słowników zasobów specyficznych dla motywów) +)] + + +// Informacje o wersji zestawu zawierają następujące cztery wartości: +// +// Wersja główna +// Wersja pomocnicza +// Numer kompilacji +// Poprawka +// +// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki +// przy użyciu symbolu „*”, tak jak pokazano poniżej: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StarSim/StarSimGui/Properties/Resources.Designer.cs b/StarSim/StarSimGui/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// Ten kod został wygenerowany przez narzędzie. +// Wersja środowiska uruchomieniowego: 4.0.30319.42000 +// +// Modyfikacje tego pliku mogą spowodować niewłaściwe zachowanie i zostaną utracone +// w przypadku ponownego wygenerowania kodu. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace StarSimGui.Properties +{ + + + /// <summary> + /// Silnie typizowana klasa zasobów do wyszukiwania zlokalizowanych ciągów itd. + /// </summary> + // Ta klasa została automatycznie wygenerowana za pomocą klasy StronglyTypedResourceBuilder + // przez narzędzie, takie jak ResGen lub Visual Studio. + // Aby dodać lub usunąć składowe, edytuj plik ResX, a następnie ponownie uruchom narzędzie ResGen + // z opcją /str lub ponownie skompiluj projekt programu VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// <summary> + /// Zwraca buforowane wystąpienie składnika ResourceManager używane przez tę klasę. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StarSimGui.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Przesłania właściwość CurrentUICulture bieżącego wątku dla wszystkich + /// przypadków przeszukiwania zasobów za pomocą tej silnie typizowanej klasy zasobów. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/StarSim/StarSimGui/Properties/Resources.resx b/StarSim/StarSimGui/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> +\ No newline at end of file diff --git a/StarSim/StarSimGui/Properties/Settings.Designer.cs b/StarSim/StarSimGui/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace StarSimGui.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/StarSim/StarSimGui/Properties/Settings.settings b/StarSim/StarSimGui/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> +\ No newline at end of file diff --git a/StarSim/StarSimGui/Simulator.db b/StarSim/StarSimGui/Simulator.db Binary files differ. diff --git a/StarSim/StarSimGui/StarSimGui.csproj b/StarSim/StarSimGui/StarSimGui.csproj @@ -0,0 +1,245 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\packages\Microsoft.EntityFrameworkCore.Design.2.2.4\build\net461\Microsoft.EntityFrameworkCore.Design.props" Condition="Exists('..\packages\Microsoft.EntityFrameworkCore.Design.2.2.4\build\net461\Microsoft.EntityFrameworkCore.Design.props')" /> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{83F04A74-D9DB-4C8C-ABDC-3610099BCC51}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>StarSimGui</RootNamespace> + <AssemblyName>StarSimGui</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Data.Sqlite, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath> + </Reference> + <Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.2.2.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore.Abstractions, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.Abstractions.2.2.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore.Design, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.Design.2.2.4\lib\net461\Microsoft.EntityFrameworkCore.Design.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore.Proxies, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.Proxies.2.2.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Proxies.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore.Relational, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.Relational.2.2.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Relational.dll</HintPath> + </Reference> + <Reference Include="Microsoft.EntityFrameworkCore.Sqlite, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.EntityFrameworkCore.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Sqlite.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Caching.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Caching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Caching.Memory, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Caching.Memory.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Configuration.Binder, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Logging.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL"> + <HintPath>..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.14.520, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL"> + <HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.batteries_v2, Version=1.1.14.520, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL"> + <HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.core, Version=1.1.14.520, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL"> + <HintPath>..\packages\SQLitePCLRaw.core.1.1.14\lib\net45\SQLitePCLRaw.core.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.1.14.520, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL"> + <HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.14\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath> + </Reference> + <Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath> + </Reference> + <Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath> + </Reference> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Data" /> + <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath> + </Reference> + <Reference Include="System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Interactive.Async.3.2.0\lib\net46\System.Interactive.Async.dll</HintPath> + </Reference> + <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath> + </Reference> + <Reference Include="System.Numerics" /> + <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> + </Reference> + <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> + </Reference> + <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> + <Private>True</Private> + <Private>True</Private> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="Contexts\SimulatorContextFactory.cs" /> + <Compile Include="MainWindow.xaml.cs"> + <DependentUpon>MainWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Migrations\20190619213346_InitialMigration.cs" /> + <Compile Include="Migrations\20190619213346_InitialMigration.designer.cs"> + <DependentUpon>20190619213346_InitialMigration.cs</DependentUpon> + </Compile> + <Compile Include="Migrations\SimulatorContextModelSnapshot.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\StarSimLib\StarSimLib.csproj"> + <Project>{0fa6cc2d-c2b7-461b-aadc-4e3aecd2c05c}</Project> + <Name>StarSimLib</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Folder Include="Commands\" /> + <Folder Include="Models\" /> + <Folder Include="ViewModels\" /> + <Folder Include="Views\" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>Ten projekt zawiera odwołania do pakietów NuGet, których nie ma na tym komputerze. Użyj przywracania pakietów NuGet, aby je pobrać. Aby uzyskać więcej informacji, zobacz http://go.microsoft.com/fwlink/?LinkID=322105. Brakujący plik: {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Microsoft.EntityFrameworkCore.Design.2.2.4\build\net461\Microsoft.EntityFrameworkCore.Design.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.EntityFrameworkCore.Design.2.2.4\build\net461\Microsoft.EntityFrameworkCore.Design.props'))" /> + <Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" /> + <Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" /> + <Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" /> + </Target> + <Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" /> + <Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" /> + <Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" /> +</Project> +\ No newline at end of file diff --git a/StarSim/StarSimGui/packages.config b/StarSim/StarSimGui/packages.config @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Castle.Core" version="4.4.0" targetFramework="net472" /> + <package id="Microsoft.CSharp" version="4.5.0" targetFramework="net472" /> + <package id="Microsoft.Data.Sqlite.Core" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Abstractions" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Analyzers" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Design" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Proxies" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Relational" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Sqlite" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.EntityFrameworkCore.Tools" version="2.2.4" targetFramework="net472" developmentDependency="true" /> + <package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Configuration.Binder" version="2.2.4" targetFramework="net472" /> + <package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net472" /> + <package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net472" /> + <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" /> + <package id="Remotion.Linq" version="2.2.0" targetFramework="net472" /> + <package id="SQLitePCLRaw.bundle_green" version="1.1.14" targetFramework="net472" /> + <package id="SQLitePCLRaw.core" version="1.1.14" targetFramework="net472" /> + <package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.14" targetFramework="net472" /> + <package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.14" targetFramework="net472" /> + <package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.14" targetFramework="net472" /> + <package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.14" targetFramework="net472" /> + <package id="System.Buffers" version="4.5.0" targetFramework="net472" /> + <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net472" /> + <package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net472" /> + <package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net472" /> + <package id="System.Interactive.Async" version="3.2.0" targetFramework="net472" /> + <package id="System.Memory" version="4.5.3" targetFramework="net472" /> + <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" /> + <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" /> + <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" /> +</packages> +\ No newline at end of file diff --git a/StarSim/StarSimLib/Body.cs b/StarSim/StarSimLib/Body.cs @@ -1,128 +0,0 @@ -using SFML.System; -using System; -using StarSimLib.Extensions; - -namespace StarSimLib -{ - /// <summary> - /// Represents a stellar body. - /// </summary> - public class Body - { - /// <summary> - /// Describes how the <see cref="Body"/> instance should be formatted as a <see cref="string"/>. - /// </summary> - private const string BodyFormatString = - "Body {0,2}.{1,-4}: Pos-({2:D,-3}, {3:D,-3}, {4:D,-3}), Vel-({5:D,-3}, {6:D,-3}, {7:D,-3}), Mass-{8:D,3}"; - - /// <summary> - /// The generation that this body belongs to. - /// </summary> - public readonly uint Generation; - - /// <summary> - /// The unique id for this body. - /// </summary> - public readonly uint Id; - - /// <summary> - /// Initialises a new instance of the <see cref="Body"/> class. - /// </summary> - /// <param name="position">The starting position of the <see cref="Body"/>.</param> - /// <param name="velocity">The starting velocity of the <see cref="Body"/>.</param> - /// <param name="mass">The starting mass of the <see cref="Body"/>.</param> - /// <param name="generation">The generation that this <see cref="Body"/> belongs to.</param> - /// <param name="id">The unique id for this body.</param> - public Body(Vector3d position, Vector3d velocity, double mass, uint generation = 1, uint id = 1) - { - Generation = generation; - Id = id; - - Position = position; - Velocity = velocity; - Mass = mass; - } - - /// <summary> - /// The mass of the <see cref="Body"/>. - /// </summary> - public double Mass { get; private set; } - - /// <summary> - /// The current position of the <see cref="Body"/> in 3D space. - /// </summary> - public Vector3d Position { get; private set; } - - /// <summary> - /// The current velocity of the <see cref="Body"/> in 3D space. - /// </summary> - public Vector3d Velocity { get; private set; } - - /// <summary> - /// Gets the force vector for the attraction between <see cref="Body"/> A and <see cref="Body"/> B. - /// </summary> - /// <param name="a">The first <see cref="Body"/> instance.</param> - /// <param name="b">The second <see cref="Body"/> instance.</param> - /// <returns></returns> - public static Vector3d GetForceBetween(Body a, Body b) - { - // Inlines the Body.DistanceTo(Body) as the position deltas need to be cached for later, - // as well as to gain a small performance increase - double dx = b.Position.X - a.Position.X, - dy = b.Position.Y - a.Position.Y, - dz = b.Position.Z - a.Position.Z; - - // The distance between two bodies can be found via taking the magnitude of their displacements, - // as shown here via pythagoras - double distance = Math.Sqrt(dx * dx + dy * dy + dz * dz); - - double numerator = Constants.G * a.Mass * b.Mass; - double denominator = distance * distance + Constants.SofteningFactor2; - - // Using the equation Force = Gravitational Constant * Mass(a) * Mass(b) / distance(a, b)^2 - // with a softening factor, we get the attraction force vector between the 2 bodies - double force = numerator / denominator; - - return new Vector3d(force * dx / distance, force * dy / distance, force * dz / distance); - } - - /// <summary> - /// Finds and returns the distance between the current <see cref="Body"/> instance and the given <see cref="Body"/>. - /// In other words, it finds the magnitude of the translation vector between the two <see cref="Body"/> instances. - /// </summary> - /// <param name="body">The other <see cref="Body"/> instance to which to calculate the distance.</param> - /// <param name="displacement">The vector showing the displacement of the current body from the given one.</param> - /// <returns>The distance to the other <see cref="Body"/> as a <see cref="float"/>.</returns> - public double DistanceTo(Body body, out Vector3d displacement) - { - double dpx = body.Position.X - Position.X, - dpy = body.Position.Y - Position.Y, - dpz = body.Position.Z - Position.Z; - - displacement = new Vector3d(dpx, dpy, dpz); - - return Math.Sqrt(dpx * dpx + dpy * dpy + dpz * dpz); - } - - /// <summary> - /// Updates the <see cref="Position"/> of the current body using the given force vector and time step. - /// </summary> - /// <param name="forceVector">The sum vector of all forces due to other <see cref="Body"/>s.</param> - /// <param name="deltaTime">The time step.</param> - public void Update(Vector3d forceVector, double deltaTime) - { - Velocity += deltaTime * forceVector / Mass; - Position += deltaTime * Velocity; - } - - #region Overrides of Object - - /// <inheritdoc /> - public override string ToString() - { - return string.Format(BodyFormatString, Generation, Id, Position.X, Position.Y, Position.Z, Velocity.X, Velocity.Y, Velocity.Z, Mass); - } - - #endregion Overrides of Object - } -} -\ No newline at end of file diff --git a/StarSim/StarSimLib/Constants.cs b/StarSim/StarSimLib/Constants.cs @@ -1,4 +1,5 @@ using SFML.Graphics; +using StarSimLib.Physics; namespace StarSimLib { diff --git a/StarSim/StarSimLib/Contexts/SimulatorContext.cs b/StarSim/StarSimLib/Contexts/SimulatorContext.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore; + +namespace StarSimLib.Contexts +{ + /// <summary> + /// Represents the solar simulation database. + /// </summary> + public class SimulatorContext : DbContext + { + /// <summary> + /// The connection string used to access the simulator database. + /// </summary> + public const string ConnectionString = @"Data Source=Simulator.db"; + + /// <summary> + /// Constructs a new instance of the <see cref="SimulatorContext"/> class. + /// </summary> + public SimulatorContext() : base(new DbContextOptionsBuilder<SimulatorContext>().Options) + { + } + + /// <summary> + /// Constructs a new instance of the <see cref="SimulatorContext"/> class. + /// </summary> + /// <param name="options">Any <see cref="DbContextOptions"/> that should be set on this instance.</param> + public SimulatorContext(DbContextOptions options) : base(options) + { + } + + #region Overrides of DbContext + + /// <inheritdoc /> + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + // we use SQLite due to the low overhead, ease of use, and great tooling (e.g. DB Browser for SQLite). + optionsBuilder.UseSqlite(ConnectionString); + } + + /// <inheritdoc /> + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + } + + #endregion Overrides of DbContext + } +} +\ No newline at end of file diff --git a/StarSim/StarSimLib/Examples/ExampleBody.cs b/StarSim/StarSimLib/Examples/ExampleBody.cs @@ -1,68 +0,0 @@ -using System; - -namespace StarSimLib.Examples -{ - public class ExampleBody - { - private static readonly double G = 6.673e-11; // gravitational constant - private static readonly double solarmass = 1.98892e30; - - public double force_x, force_y; - public double mass; - public double pos_x, pos_y; - public double vel_x, vel_y; - - public ExampleBody(double px, double py, double vx, double vy, double mass) - { - pos_x = px; - pos_y = py; - vel_x = vx; - vel_y = vy; - this.mass = mass; - } - - public void addForce(ExampleBody b) - { - ExampleBody a = this; - double softening_factor = 3E4; - double dx = b.pos_x - a.pos_x; - double dy = b.pos_y - a.pos_y; - double dist = Math.Sqrt(dx * dx + dy * dy); - double force = (G * a.mass * b.mass) / (dist * dist + softening_factor * softening_factor); - - a.force_x += force * dx / dist; - a.force_y += force * dy / dist; - } - - public double distanceTo(ExampleBody b) - { - double dx = pos_x - b.pos_x; - double dy = pos_y - b.pos_y; - return Math.Sqrt(dx * dx + dy * dy); - } - - public void resetForce() - { - force_x = 0.0; - force_y = 0.0; - } - - public void update(double delta_time) - { - vel_x += delta_time * force_x / mass; - vel_y += delta_time * force_y / mass; - pos_x += delta_time * vel_x; - pos_y += delta_time * vel_y; - } - - #region Overrides of Object - - /// <inheritdoc /> - public override string ToString() - { - return $"Body @ ({pos_x}, {pos_y}) with velocity ({vel_x}, {vel_y})"; - } - - #endregion Overrides of Object - } -} -\ No newline at end of file diff --git a/StarSim/StarSimLib/Extensions/Vector3fExtensions.cs b/StarSim/StarSimLib/Extensions/Vector3fExtensions.cs @@ -8,6 +8,11 @@ namespace StarSimLib.Extensions /// </summary> public static class Vector3fExtensions { + /// <summary> + /// Returns the magnitude of the given <see cref="Vector3f"/>. + /// </summary> + /// <param name="vector">The vector whose magnitude to return.</param> + /// <returns>The magnitude of the given <see cref="Vector3f"/>.</returns> public static float Magnitude(this Vector3f vector) { // returns the magnitude of the vector, via pythagoras diff --git a/StarSim/StarSimLib/OrbitGenerator.cs b/StarSim/StarSimLib/OrbitGenerator.cs @@ -1,64 +0,0 @@ -using System; -using SFML.System; -using StarSimLib.Extensions; - -namespace StarSimLib -{ - /// <summary> - /// Initialises positions, velocities, and orbits for bodies. - /// </summary> - public static class OrbitGenerator - { - /// <summary> - /// Random number generator. - /// </summary> - private static readonly Random Rng = new Random(); - - /// <summary> - /// Returns a randomised orbit around a central, heavy mass. - /// </summary> - /// <param name="positionVector">The position vector for the body for which to generate the orbit.</param> - /// <returns>The magnitude of the velocity of the orbit.</returns> - public static Vector3d RandomOrbit(Vector3d positionVector) - { - Vector3d position = positionVector; - - // F = G m1 - m2 / distance - double distanceToCentralBody = position.Magnitude(); - double numerator = Constants.G * Constants.CentralBodyMass; - double velocityMagnitude = Math.Sqrt(numerator / distanceToCentralBody); - - double absAngle = Math.Atan(Math.Abs(position.X / position.Y)); - double velocityTheta = Math.PI / 2 - absAngle; - double velocityPhi = Rng.NextDouble() * Math.PI; - - double vertical = Math.Min(2e8 / distanceToCentralBody, 2e4); - - double vx = -1 * Math.Sign(position.Y) * Math.Cos(velocityTheta) * velocityMagnitude; - double vy = (Rng.NextDouble() - 0.5) * vertical; - double vz = Math.Sign(position.X) * Math.Sin(velocityTheta) * velocityMagnitude; - - // TODO: Implement 3d velocities and rendering - // mapping of the 3d values to 2d values - vy = vz; - vz = 0; - - // Randomly orient the orbit - return !(Rng.NextDouble() <= 0.5f) ? new Vector3d(vx, vy, vz) : new Vector3d(-vx, -vy, -vz); - } - - /// <summary> - /// Returns a random position within the universe sphere (see <see cref="Constants.UniverseSize"/>). - /// </summary> - /// <returns>A 3D position vector.</returns> - public static Vector3d RandomPosition() - { - double RandomPos() - { - return Constants.UniverseSize * Math.Exp(-1.8) * (.5 - Rng.NextDouble()); - } - - return new Vector3d(RandomPos(), RandomPos(), RandomPos()); - } - } -} -\ No newline at end of file diff --git a/StarSim/StarSimLib/Physics/Body.cs b/StarSim/StarSimLib/Physics/Body.cs @@ -0,0 +1,126 @@ +using System; + +namespace StarSimLib.Physics +{ + /// <summary> + /// Represents a stellar body. + /// </summary> + public class Body + { + /// <summary> + /// Describes how the <see cref="Body"/> instance should be formatted as a <see cref="string"/>. + /// </summary> + private const string BodyFormatString = + "Body {0,2}.{1,-4}: Pos-({2:D,-3}, {3:D,-3}, {4:D,-3}), Vel-({5:D,-3}, {6:D,-3}, {7:D,-3}), Mass-{8:D,3}"; + + /// <summary> + /// The generation that this body belongs to. + /// </summary> + public readonly uint Generation; + + /// <summary> + /// The unique id for this body. + /// </summary> + public readonly uint Id; + + /// <summary> + /// Initialises a new instance of the <see cref="Body"/> class. + /// </summary> + /// <param name="position">The starting position of the <see cref="Body"/>.</param> + /// <param name="velocity">The starting velocity of the <see cref="Body"/>.</param> + /// <param name="mass">The starting mass of the <see cref="Body"/>.</param> + /// <param name="generation">The generation that this <see cref="Body"/> belongs to.</param> + /// <param name="id">The unique id for this body.</param> + public Body(Vector3d position, Vector3d velocity, double mass, uint generation = 1, uint id = 1) + { + Generation = generation; + Id = id; + + Position = position; + Velocity = velocity; + Mass = mass; + } + + /// <summary> + /// The mass of the <see cref="Body"/>. + /// </summary> + public double Mass { get; private set; } + + /// <summary> + /// The current position of the <see cref="Body"/> in 3D space. + /// </summary> + public Vector3d Position { get; private set; } + + /// <summary> + /// The current velocity of the <see cref="Body"/> in 3D space. + /// </summary> + public Vector3d Velocity { get; private set; } + + /// <summary> + /// Gets the force vector for the attraction between <see cref="Body"/> A and <see cref="Body"/> B. + /// </summary> + /// <param name="a">The first <see cref="Body"/> instance.</param> + /// <param name="b">The second <see cref="Body"/> instance.</param> + /// <returns></returns> + public static Vector3d GetForceBetween(Body a, Body b) + { + // Inlines the Body.DistanceTo(Body) as the position deltas need to be cached for later, + // as well as to gain a small performance increase + double dx = b.Position.X - a.Position.X, + dy = b.Position.Y - a.Position.Y, + dz = b.Position.Z - a.Position.Z; + + // The distance between two bodies can be found via taking the magnitude of their displacements, + // as shown here via pythagoras + double distance = Math.Sqrt(dx * dx + dy * dy + dz * dz); + + double numerator = Constants.G * a.Mass * b.Mass; + double denominator = distance * distance + Constants.SofteningFactor2; + + // Using the equation Force = Gravitational Constant * Mass(a) * Mass(b) / distance(a, b)^2 + // with a softening factor, we get the attraction force vector between the 2 bodies + double force = numerator / denominator; + + return new Vector3d(force * dx / distance, force * dy / distance, force * dz / distance); + } + + /// <summary> + /// Finds and returns the distance between the current <see cref="Body"/> instance and the given <see cref="Body"/>. + /// In other words, it finds the magnitude of the translation vector between the two <see cref="Body"/> instances. + /// </summary> + /// <param name="body">The other <see cref="Body"/> instance to which to calculate the distance.</param> + /// <param name="displacement">The vector showing the displacement of the current body from the given one.</param> + /// <returns>The distance to the other <see cref="Body"/> as a <see cref="float"/>.</returns> + public double DistanceTo(Body body, out Vector3d displacement) + { + double dpx = body.Position.X - Position.X, + dpy = body.Position.Y - Position.Y, + dpz = body.Position.Z - Position.Z; + + displacement = new Vector3d(dpx, dpy, dpz); + + return Math.Sqrt(dpx * dpx + dpy * dpy + dpz * dpz); + } + + /// <summary> + /// Updates the <see cref="Position"/> of the current body using the given force vector and time step. + /// </summary> + /// <param name="forceVector">The sum vector of all forces due to other <see cref="Body"/>s.</param> + /// <param name="deltaTime">The time step.</param> + public void Update(Vector3d forceVector, double deltaTime) + { + Velocity += deltaTime * forceVector / Mass; + Position += deltaTime * Velocity; + } + + #region Overrides of Object + + /// <inheritdoc /> + public override string ToString() + { + return string.Format(BodyFormatString, Generation, Id, Position.X, Position.Y, Position.Z, Velocity.X, Velocity.Y, Velocity.Z, Mass); + } + + #endregion Overrides of Object + } +} +\ No newline at end of file diff --git a/StarSim/StarSimLib/Physics/OrbitGenerator.cs b/StarSim/StarSimLib/Physics/OrbitGenerator.cs @@ -0,0 +1,62 @@ +using System; + +namespace StarSimLib.Physics +{ + /// <summary> + /// Initialises positions, velocities, and orbits for bodies. + /// </summary> + public static class OrbitGenerator + { + /// <summary> + /// Random number generator. + /// </summary> + private static readonly Random Rng = new Random(); + + /// <summary> + /// Returns a randomised orbit around a central, heavy mass. + /// </summary> + /// <param name="positionVector">The position vector for the body for which to generate the orbit.</param> + /// <returns>The magnitude of the velocity of the orbit.</returns> + public static Vector3d RandomOrbit(Vector3d positionVector) + { + Vector3d position = positionVector; + + // F = G m1 - m2 / distance + double distanceToCentralBody = position.Magnitude(); + double numerator = Constants.G * Constants.CentralBodyMass; + double velocityMagnitude = Math.Sqrt(numerator / distanceToCentralBody); + + double absAngle = Math.Atan(Math.Abs(position.X / position.Y)); + double velocityTheta = Math.PI / 2 - absAngle; + double velocityPhi = Rng.NextDouble() * Math.PI; + + double vertical = Math.Min(2e8 / distanceToCentralBody, 2e4); + + double vx = -1 * Math.Sign(position.Y) * Math.Cos(velocityTheta) * velocityMagnitude; + double vy = (Rng.NextDouble() - 0.5) * vertical; + double vz = Math.Sign(position.X) * Math.Sin(velocityTheta) * velocityMagnitude; + + // TODO: Implement 3d velocities and rendering + // mapping of the 3d values to 2d values + vy = vz; + vz = 0; + + // Randomly orient the orbit + return !(Rng.NextDouble() <= 0.5f) ? new Vector3d(vx, vy, vz) : new Vector3d(-vx, -vy, -vz); + } + + /// <summary> + /// Returns a random position within the universe sphere (see <see cref="Constants.UniverseSize"/>). + /// </summary> + /// <returns>A 3D position vector.</returns> + public static Vector3d RandomPosition() + { + double RandomPos() + { + return Constants.UniverseSize * Math.Exp(-1.8) * (.5 - Rng.NextDouble()); + } + + return new Vector3d(RandomPos(), RandomPos(), RandomPos()); + } + } +} +\ No newline at end of file diff --git a/StarSim/StarSimLib/StarSimLib.csproj b/StarSim/StarSimLib/StarSimLib.csproj @@ -4,7 +4,29 @@ <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> + <DocumentationFile>StarSimLib.xml</DocumentationFile> + </PropertyGroup> + + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <DocumentationFile>StarSimLib.xml</DocumentationFile> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4"> + <PrivateAssets>all</PrivateAssets> + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> + </PackageReference> <PackageReference Include="SFML.Net" Version="2.5.0" /> </ItemGroup> + + <ItemGroup> + <Folder Include="Models\" /> + <Folder Include="Graphics\" /> + </ItemGroup> </Project> \ No newline at end of file diff --git a/StarSim/StarSimLib/StarSimLib.xml b/StarSim/StarSimLib/StarSimLib.xml @@ -0,0 +1,444 @@ +<?xml version="1.0"?> +<doc> + <assembly> + <name>StarSimLib</name> + </assembly> + <members> + <member name="T:StarSimLib.Constants"> + <summary> + Holds common constants and helper functions. + </summary> + </member> + <member name="F:StarSimLib.Constants.BodyCount"> + <summary> + The amount of bodies that are rendered by default. + </summary> + </member> + <member name="F:StarSimLib.Constants.CentralBodyMass"> + <summary> + The mass of the central body, if it is included. + </summary> + </member> + <member name="F:StarSimLib.Constants.FrameRate"> + <summary> + The frame rate limit for the simulation. + </summary> + </member> + <member name="F:StarSimLib.Constants.G"> + <summary> + The gravitational constant (m^3 kg^-1 s^-2). + </summary> + </member> + <member name="F:StarSimLib.Constants.SecondsPerFrame"> + <summary> + The number of seconds that each frame represents. + </summary> + </member> + <member name="F:StarSimLib.Constants.SofteningFactor"> + <summary> + Softens the force between <see cref="T:StarSimLib.Body"/>s to avoid infinities. + </summary> + </member> + <member name="F:StarSimLib.Constants.SofteningFactor2"> + <summary> + The square of the <see cref="F:StarSimLib.Constants.SofteningFactor"/>. + </summary> + </member> + <member name="F:StarSimLib.Constants.SolarMass"> + <summary> + The mass of the sun (1.98892e30f). + </summary> + </member> + <member name="F:StarSimLib.Constants.TimeStep"> + <summary> + The default time step for the simulation. + </summary> + </member> + <member name="F:StarSimLib.Constants.UniverseScalingFactor"> + <summary> + Factor by which to multiply the position of <see cref="T:StarSimLib.Body"/>s to scale them to the screen for displaying. + </summary> + </member> + <member name="F:StarSimLib.Constants.UniverseSize"> + <summary> + The maximum radius within which <see cref="T:StarSimLib.Body"/>s will be placed (1e18f). + </summary> + </member> + <member name="T:StarSimLib.Contexts.SimulatorContext"> + <summary> + Represents the solar simulation database. + </summary> + </member> + <member name="F:StarSimLib.Contexts.SimulatorContext.ConnectionString"> + <summary> + The connection string used to access the simulator database. + </summary> + </member> + <member name="M:StarSimLib.Contexts.SimulatorContext.#ctor"> + <summary> + Constructs a new instance of the <see cref="T:StarSimLib.Contexts.SimulatorContext"/> class. + </summary> + </member> + <member name="M:StarSimLib.Contexts.SimulatorContext.#ctor(Microsoft.EntityFrameworkCore.DbContextOptions)"> + <summary> + Constructs a new instance of the <see cref="T:StarSimLib.Contexts.SimulatorContext"/> class. + </summary> + <param name="options">Any <see cref="T:Microsoft.EntityFrameworkCore.DbContextOptions"/> that should be set on this instance.</param> + </member> + <member name="M:StarSimLib.Contexts.SimulatorContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)"> + <inheritdoc /> + </member> + <member name="M:StarSimLib.Contexts.SimulatorContext.OnModelCreating(Microsoft.EntityFrameworkCore.ModelBuilder)"> + <inheritdoc /> + </member> + <member name="T:StarSimLib.Extensions.Vector3fExtensions"> + <summary> + Provides additional functionality to the <see cref="T:SFML.System.Vector3f"/> struct. + </summary> + </member> + <member name="M:StarSimLib.Extensions.Vector3fExtensions.Magnitude(SFML.System.Vector3f)"> + <summary> + Returns the magnitude of the given <see cref="T:SFML.System.Vector3f"/>. + </summary> + <param name="vector">The vector whose magnitude to return.</param> + <returns>The magnitude of the given <see cref="T:SFML.System.Vector3f"/>.</returns> + </member> + <member name="T:StarSimLib.Body"> + <summary> + Represents a stellar body. + </summary> + </member> + <member name="F:StarSimLib.Body.BodyFormatString"> + <summary> + Describes how the <see cref="T:StarSimLib.Body"/> instance should be formatted as a <see cref="T:System.String"/>. + </summary> + </member> + <member name="F:StarSimLib.Body.Generation"> + <summary> + The generation that this body belongs to. + </summary> + </member> + <member name="F:StarSimLib.Body.Id"> + <summary> + The unique id for this body. + </summary> + </member> + <member name="M:StarSimLib.Body.#ctor(StarSimLib.Vector3d,StarSimLib.Vector3d,System.Double,System.UInt32,System.UInt32)"> + <summary> + Initialises a new instance of the <see cref="T:StarSimLib.Body"/> class. + </summary> + <param name="position">The starting position of the <see cref="T:StarSimLib.Body"/>.</param> + <param name="velocity">The starting velocity of the <see cref="T:StarSimLib.Body"/>.</param> + <param name="mass">The starting mass of the <see cref="T:StarSimLib.Body"/>.</param> + <param name="generation">The generation that this <see cref="T:StarSimLib.Body"/> belongs to.</param> + <param name="id">The unique id for this body.</param> + </member> + <member name="P:StarSimLib.Body.Mass"> + <summary> + The mass of the <see cref="T:StarSimLib.Body"/>. + </summary> + </member> + <member name="P:StarSimLib.Body.Position"> + <summary> + The current position of the <see cref="T:StarSimLib.Body"/> in 3D space. + </summary> + </member> + <member name="P:StarSimLib.Body.Velocity"> + <summary> + The current velocity of the <see cref="T:StarSimLib.Body"/> in 3D space. + </summary> + </member> + <member name="M:StarSimLib.Body.GetForceBetween(StarSimLib.Body,StarSimLib.Body)"> + <summary> + Gets the force vector for the attraction between <see cref="T:StarSimLib.Body"/> A and <see cref="T:StarSimLib.Body"/> B. + </summary> + <param name="a">The first <see cref="T:StarSimLib.Body"/> instance.</param> + <param name="b">The second <see cref="T:StarSimLib.Body"/> instance.</param> + <returns></returns> + </member> + <member name="M:StarSimLib.Body.DistanceTo(StarSimLib.Body,StarSimLib.Vector3d@)"> + <summary> + Finds and returns the distance between the current <see cref="T:StarSimLib.Body"/> instance and the given <see cref="T:StarSimLib.Body"/>. + In other words, it finds the magnitude of the translation vector between the two <see cref="T:StarSimLib.Body"/> instances. + </summary> + <param name="body">The other <see cref="T:StarSimLib.Body"/> instance to which to calculate the distance.</param> + <param name="displacement">The vector showing the displacement of the current body from the given one.</param> + <returns>The distance to the other <see cref="T:StarSimLib.Body"/> as a <see cref="T:System.Single"/>.</returns> + </member> + <member name="M:StarSimLib.Body.Update(StarSimLib.Vector3d,System.Double)"> + <summary> + Updates the <see cref="P:StarSimLib.Body.Position"/> of the current body using the given force vector and time step. + </summary> + <param name="forceVector">The sum vector of all forces due to other <see cref="T:StarSimLib.Body"/>s.</param> + <param name="deltaTime">The time step.</param> + </member> + <member name="M:StarSimLib.Body.ToString"> + <inheritdoc /> + </member> + <member name="T:StarSimLib.OrbitGenerator"> + <summary> + Initialises positions, velocities, and orbits for bodies. + </summary> + </member> + <member name="F:StarSimLib.OrbitGenerator.Rng"> + <summary> + Random number generator. + </summary> + </member> + <member name="M:StarSimLib.OrbitGenerator.RandomOrbit(StarSimLib.Vector3d)"> + <summary> + Returns a randomised orbit around a central, heavy mass. + </summary> + <param name="positionVector">The position vector for the body for which to generate the orbit.</param> + <returns>The magnitude of the velocity of the orbit.</returns> + </member> + <member name="M:StarSimLib.OrbitGenerator.RandomPosition"> + <summary> + Returns a random position within the universe sphere (see <see cref="F:StarSimLib.Constants.UniverseSize"/>). + </summary> + <returns>A 3D position vector.</returns> + </member> + <member name="T:StarSimLib.Vector3d"> + <summary> + A 3D vector with <see cref="T:System.Double"/> components. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.X"> + <summary> + The x component of the vector. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.Y"> + <summary> + The y component of the vector. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.Z"> + <summary> + The z component of the vector. + </summary> + </member> + <member name="M:StarSimLib.Vector3d.#ctor(System.Double,System.Double)"> + <summary> + Initialises a new instance of the <see cref="T:StarSimLib.Vector3d"/> struct. Sets Z to 0. + </summary> + <param name="x">The x component.</param> + <param name="y">The y component.</param> + </member> + <member name="M:StarSimLib.Vector3d.#ctor(System.Double,System.Double,System.Double)"> + <summary> + Initialises a new instance of the <see cref="T:StarSimLib.Vector3d"/> struct. + </summary> + <param name="x">The x component.</param> + <param name="y">The y component.</param> + <param name="z">The z component.</param> + </member> + <member name="M:StarSimLib.Vector3d.op_Subtraction(StarSimLib.Vector3d,StarSimLib.Vector3d)"> + <summary> + Implements the subtraction operator for 2 <see cref="T:StarSimLib.Vector3d"/>s. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The other <see cref="T:StarSimLib.Vector3d"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Subtraction(StarSimLib.Vector3d,System.ValueTuple{System.Double,System.Double,System.Double})"> + <summary> + Implements the subtraction operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Subtraction(System.ValueTuple{System.Double,System.Double,System.Double},StarSimLib.Vector3d)"> + <summary> + Implements the subtraction operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Subtraction(StarSimLib.Vector3d,System.Double)"> + <summary> + Implements the subtraction operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Subtraction(System.Double,StarSimLib.Vector3d)"> + <summary> + Implements the subtraction operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Multiply(StarSimLib.Vector3d,StarSimLib.Vector3d)"> + <summary> + Implements the multiplication operator for 2 <see cref="T:StarSimLib.Vector3d"/>s. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The other <see cref="T:StarSimLib.Vector3d"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Multiply(StarSimLib.Vector3d,System.ValueTuple{System.Double,System.Double,System.Double})"> + <summary> + Implements the multiplication operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Multiply(System.ValueTuple{System.Double,System.Double,System.Double},StarSimLib.Vector3d)"> + <summary> + Implements the multiplication operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Multiply(StarSimLib.Vector3d,System.Double)"> + <summary> + Implements the multiplication operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Multiply(System.Double,StarSimLib.Vector3d)"> + <summary> + Implements the multiplication operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Division(StarSimLib.Vector3d,StarSimLib.Vector3d)"> + <summary> + Implements the division operator for 2 <see cref="T:StarSimLib.Vector3d"/>s. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The other <see cref="T:StarSimLib.Vector3d"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Division(StarSimLib.Vector3d,System.ValueTuple{System.Double,System.Double,System.Double})"> + <summary> + Implements the division operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Division(System.ValueTuple{System.Double,System.Double,System.Double},StarSimLib.Vector3d)"> + <summary> + Implements the division operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Division(StarSimLib.Vector3d,System.Double)"> + <summary> + Implements the division operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Division(System.Double,StarSimLib.Vector3d)"> + <summary> + Implements the division operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Addition(StarSimLib.Vector3d,StarSimLib.Vector3d)"> + <summary> + Implements the addition operator for 2 <see cref="T:StarSimLib.Vector3d"/>s. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The other <see cref="T:StarSimLib.Vector3d"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Addition(StarSimLib.Vector3d,System.ValueTuple{System.Double,System.Double,System.Double})"> + <summary> + Implements the addition operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Addition(System.ValueTuple{System.Double,System.Double,System.Double},StarSimLib.Vector3d)"> + <summary> + Implements the addition operator for a <see cref="T:StarSimLib.Vector3d"/> and a (X, Y, Z) tuple. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="vector2">The 3D tuple.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Addition(StarSimLib.Vector3d,System.Double)"> + <summary> + Implements the addition operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.op_Addition(System.Double,StarSimLib.Vector3d)"> + <summary> + Implements the addition operator for a <see cref="T:StarSimLib.Vector3d"/> and a scalar <see cref="T:System.Double"/> value. + </summary> + <param name="vector">The original <see cref="T:StarSimLib.Vector3d"/>.</param> + <param name="scalar">The scalar <see cref="T:System.Double"/>.</param> + <returns>The new <see cref="T:StarSimLib.Vector3d"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.Abs"> + <summary> + Returns the absolute value of this <see cref="T:StarSimLib.Vector3d"/>. + </summary> + <returns>The absolute value (magnitude) of this <see cref="T:StarSimLib.Vector3d"/>, as a <see cref="T:System.Double"/>.</returns> + </member> + <member name="M:StarSimLib.Vector3d.Magnitude"> + <summary> + Returns the magnitude of this <see cref="T:StarSimLib.Vector3d"/>. + </summary> + <returns>The magnitude (absolute value) of this <see cref="T:StarSimLib.Vector3d"/>, as a <see cref="T:System.Double"/>.</returns> + </member> + <member name="T:StarSimLib.Vector3d.UnitVectors"> + <summary> + Holds unit vectors. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Backwards"> + <summary> + The negative unit vector for the Z axis. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Down"> + <summary> + The negative unit vector for the Y axis. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Forwards"> + <summary> + The positive unit vector for the Z axis. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Left"> + <summary> + The positive unit vector for the X axis. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Right"> + <summary> + The negative unit vector for the X axis. + </summary> + </member> + <member name="F:StarSimLib.Vector3d.UnitVectors.Up"> + <summary> + The positive unit vector for the Y axis. + </summary> + </member> + </members> +</doc>