Skip to content

Instantly share code, notes, and snippets.

public class BorderGroup
{
private static Vector2 _startPos;
private static Vector2 _labelSize;
private static uint _colour;
public static void BeginBorder(string label, uint colour)
{
ImGui.PushID(label);
_colour = colour;
_startPos = ImGui.GetCursorScreenPos();
@se5a
se5a / gist:c748bcc44a8faeb1aeb6b2e85d443de1
Last active May 12, 2019 03:22
Creating a point array for drawing a Hyperbola
internal void CreatePointArray()
{
Vector4 vel = Distance.KmToAU(_newtonMoveDB.CurrentVector_kms);
Vector4 pos = myPosDB.RelativePosition_AU;
Vector4 eccentVector = OrbitMath.EccentricityVector(_sgp, pos, vel);
double e = eccentVector.Length();
double r = pos.Length();
double v = vel.Length();
double a = 1 / (2 / r - Math.Pow(v, 2) / _sgp); //semiMajor Axis
@se5a
se5a / gist:1ee40c0e6a80b1cddbf324cda857b458
Created January 16, 2019 19:58
Multithread Data read/write
public class XThreadData<T>
{
List<ConcurrentQueue<T>> _subscribers = new List<ConcurrentQueue<T>>();
public void Write(T data)
{
foreach (var sub in _subscribers)
{
sub.Enqueue(data);
}
/// <summary>
/// 2d! vector.
/// </summary>
/// <returns>The orbital vector ralitive to the parent</returns>
/// <param name="sgp">Standard Grav Perameter. in AU</param>
/// <param name="position">Ralitive Position.</param>
/// <param name="sma">SemiMajorAxis</param>
/// <param name="loP">Longditude of Periapsis (LoAN+ AoP) </param>
public static Vector4 PreciseOrbitalVector(double sgp, Vector4 position, double sma, double eccentricity, double loP)
{
Starting log.
User is on Linux, because apparently life isn't hard enough already.
Initialising SDL video subsystem
Loading XML files
Texture Level 0
Multisampling Level 1
Text Clarity Level 1
Dyslexic 1
Resolutions Supported:
1920:1080
System.NullReferenceException: Object reference not set to an instance of an object
at at (wrapper managed-to-native) SDL2.SDL.SDL_CreateTextureFromSurface(intptr,intptr)
at Pulsar4X.SDL2UI.GlobalUIState..ctor (ImGuiSDL2CS.ImGuiSDL2CSWindow viewport) [0x0009b] in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/Pulsar4X/Pulsar4x/Pulsar4X/Pulsar4X.ImGuiNetUI/GlobalUIState.cs:74
at Pulsar4X.SDL2UI.PulsarMainWindow..ctor () [0x0003d] in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/Pulsar4X/Pulsar4x/Pulsar4X/Pulsar4X.ImGuiNetUI/Program.cs:47
at Pulsar4X.SDL2UI.Program.Main () [0x00001] in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/Pulsar4X/Pulsar4x/Pulsar4X/Pulsar4X.ImGuiNetUI/Program.cs:19
/// <summary>
/// An experimental distance value struct.
/// idea here was to simply define what a distance value was and handle very small or very large numbers equaly well.
/// </summary>
public struct DistanceValue
{
public enum ValueTypeEnum : sbyte//number of zeros.
{
NanoMeters = -9,
MicroMeters = -6,
@se5a
se5a / gist:5e754b8f137a79c7e53859e4b3ce4b6d
Created March 7, 2018 07:59
monodevelop make install fail
se5a@se5aMint ~/Desktop/monodevelop-7.4 $ make install
Making install in external
make[1]: Entering directory '/home/se5a/Desktop/monodevelop-7.4/external'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/se5a/Desktop/monodevelop-7.4/external'
Making install in .
make[1]: Entering directory '/home/se5a/Desktop/monodevelop-7.4'
touch vcrevision
MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
All packages listed in packages.config are already installed.
Stacktrace:
at <unknown> <0xffffffff>
* Assertion at metadata.c:1042, condition `index < meta->heap_strings.size' not met
at (wrapper managed-to-native) System.Reflection.Assembly.InternalGetReferencedAssemblies (System.Reflection.Assembly) [0x0001a] in <62f5937022004555807e6c57c33f6684>:0
at System.Reflection.Assembly.GetReferencedAssemblies (System.Reflection.Assembly) [0x00000] in <62f5937022004555807e6c57c33f6684>:0
at System.Reflection.MonoAssembly.GetReferencedAssemblies () [0x00000] in <62f5937022004555807e6c57c33f6684>:0
at Microsoft.NET.Build.Tasks.GetDependsOnNETStandard.GetFileDependsOnNETStandard (string) [0x00020] in <4f5fb896e349410580f8a3f8f63ac807>:0
at Microsoft.NET.Build.Tasks.GetDependsOnNETStandard.AnyReferenceDependsOnNETStandard () [0x00020] in <4f5fb896e349410580f8a3f8f63ac807>:0
@se5a
se5a / gist:4ec9a353b3349e45b094421f3c36393e
Created November 12, 2017 21:24
AS crash while building AS in AS.
Unhandled Exception: System.AggregateException: One or more errors occurred. (The method or operation is not implemented.) ---> System.NotImplementedException: The method or operation is not implemented.
at Microsoft.Samples.Debugging.CorDebug.CoreClrShimUtil.CreateCorDebugImpl(DbgShimInterop dbgShimInterop, UInt32 processId, TimeSpan runtimeLoadTimeout, Void* resumeHandle, Action`2 onSetup) in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/AvalonStudio/debugger-libs/CorApi2/debug/CoreClrShimUtil.cs:line 114
at Microsoft.Samples.Debugging.CorDebug.CoreClrShimUtil.CreateCorDebugForCommand(DbgShimInterop dbgShimInterop, String command, String workingDir, IDictionary`2 env, TimeSpan runtimeLoadTimeout, Action`2 onSetup, Int32& procId) in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/AvalonStudio/debugger-libs/CorApi2/debug/CoreClrShimUtil.cs:line 51
at Mono.Debugging.Win32.CoreClrDebuggerSession.<>c__DisplayClass3_0.<OnRun>b__0() in /mnt/98448323-4372-4c8a-904a-30b587cc3685/Programing/Avalo