Open se5a opened 5 years ago
Changing to storing radians wasn't as painful as I initially thought, I was cleaver and changed the name of existing properties to make it obvious that it returned a value in degrees. I then added new properties to store the values in radians. I then changed the existing properties to convert on get/set from/to the new properties. I then checked the Angle.ToRadians conversion for usages and removed unnecessary conversions.
The constructor on OrbitDBs are still mostly using AU, that will need cleaning up at some point, but I got rid of 70 or so conversions, many of which happened N times a physics frame, and a couple that happened N times a graphics frame. (N being the number of orbiting entities).
I've done a similar thing for distances, but not yet checked the conversion and removed unnecessary conversions yet.
Some improvements that need doing to the current orbital code:
Store angles in radians, currently OrbitDB stores angles in degrees, but we're doing more Angle.ToRadians() conversions than what we'd be doing the other way around, and doing it in places that need to be lean and fast as possible.Need working and passing tests that we trust before we do this.Get rid of pointless to radian conversions.Check for and remove pointless conversions.Velocity needs to be stored in the same units.Change Vector4 to Vector3Clean up/3dize the InstantaniousOrbitalVector functions. currently it's kind of hacky due to half the math being 3d capable and then trying to flatten that to 2d orbits.Move all the orbital math to a completely new project. once everything is all working might as well release it as a library.See #224 for bugs/critical stuff.