ezocher / gravity-toy Goto Github PK
View Code? Open in Web Editor NEWVery old XAML/UWP app. Porting to various platforms to test and learn.
License: MIT License
Very old XAML/UWP app. Porting to various platforms to test and learn.
License: MIT License
I was originally using the Windows.Foundation.Point class for the simulation values because I saw the the constructor signature was Point(double, double) and assumed X and Y were doubles internally. It turns out they are currently floats (see FoundationPointIssue.sln). Need to implement a (double, double) point class and change the simulation to use it.
Will leave behind numeric-investigations branch in case it's needed again.
Clean ups after creating new branch:
Look holistically at distance minimums and acceleration limits and clean up and centralize.
Need to keep at least some minimum value for r to avoid divide by zero.
This is work to finish the fix for issue #2
Trying different values for the number of calculations per frame in the toy orbit scenario is producing unexpected results. For example, 2000 calcs/frame produces a nearly stable orbit, 5000 produces a slowly shifting orbit, and 10000 produces some unexpected "flat spots" in the orbit.
Seeing e.g. 1907 seconds is not helpful, implement auto scaling of time units, investigate D:H:M:S.ss or decimal of largest appropriate unit.
The lower the orbit is, the faster it grows.
Before clearing or modifying sim it would be nice to have a clean way to ensure that no rendering is in progress (exclusive lock?). See especially SimRenderer.ClearSim().
Fixed before opening issues. Moved here from README.md.
Talk about animating orbits along perfect paths for games or visualizations, versus making a highly accurate and stable gravity simulation.
Things learned about precision
Reference issue #31
Could also consider mouse click, hold and drag in window for scrolling
Replaces final step of Issue #1
Fixed prior to opening issues. Moved here from README.md.
Suspend/Resume caused many problems including crashes that were mostly masked by Visual Studio not allowing Suspend of applications attached to the debugger.
Fix was to handle Suspending events and stop UI updates while suspended.
In numeric-investigations branch
Requires new mission capability with delta-v's added at specific locations and/or times
Create new SimSpace using parsecs and years. Use some random varied star sizes. Make these mini-galaxies with proper rotation.
Generalize approach from issue #18 to be able to generate rotating discs of bodies with no central body (or with one).
In UWP Windows.Foundation.Point is publicly (double, double) but is (float, float) internally.
Start with this page: https://docs.microsoft.com/en-us/dotnet/api/windows.foundation.point?view=dotnet-plat-ext-3.1 and also address the pages for the X and Y fields.
Tried a toy orbital simulation and was unable to get a body moving in a circular or near-circular orbit.
Definitely need to change to have much finer granularity calculation steps (multiple calculation steps per render step).
For 20000+ km/h we don't need thousandths for example. Also add commas for thousands.
Also capture complete and elapsed time captured
Low earth orbits are working in the scenario using SimSpace.LEOSpace, but medium earth orbits (GPS) and geosynchronous orbits are behaving strangely. The first geosynchronous orbit I tried in this scale traced out a polygon rather than an ellipse. Looks like numeric overflow somewhere.
In the 9 bodies scenario the central body should never move. Because of cumulative numerical errors (confirm) it eventually does.
Even when there are errors, the simulation runs should give identical results since the exact same calculations are run in the exact same order with no randomness introduced. I ran three runs of the 9 bodies scenario and got three totally different paths for the central body which diverged from 0, 0 at different iterations. WTF?
Screenshots are here: https://github.com/ezocher/Gravity-Sandbox/blob/master/Images/
NineBodies-NumericalInstability1.PNG (and 2 and 3)
Rename all versions of CheckAdditionPrecision() and make V3 the primary one
See EarthFromISS.jpg and EarthFromLunarOrbit.jpg files in Images folder for reference colors
There are many in GravitySim.cs that need cleanup
Given only an orbital altitude, pick a random angle around the primary body and then calculate the starting position and the starting velocity vector to provide a circular orbit.
Completed prior to opening issues. Moved here from README.md.
Added messaging area above control strip.
Done prior to opening issues. Moved here from README.md.
XAML modifications run async but they take time proportional to number of bodies involved.
In LoadXRandomBodies() and LoadXBodiesCircularCluster() add calls to sim.SetCalculationSettings() based on number of bodies requested. May overlap with work in issue #7
Fixed prior to opening issues. Moved here from README.md.
Bug: Had runaway explosion of number of UI threads when simulation didn't complete in per frame time and XAML was falling further and further behind. (Was formerly: Figure out the animation/memory problem that started ~2016).
Fix was to drop frames when calculations hadn't completed in time. Will also implement issue #6 for large scenarios on multi-core machines.
First create a scenario based on the issue #19 work and then get the mini-galaxy properly moving while it rotates. Next, create two of those and set them on a collision course.
Do a pencil and graph paper and spreadsheet analysis of one minute of the actual ISS orbit versus a single linear step of the current algorithm to understand the nature of the error in the approximation.
Render key bodies using bitmaps with transparency. Views need to be from above the north (or south) pole of each body.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.