Jump to content

Syntax

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by Syntax

  1. So pleased to see someone will get some use out of it other than me! Even I've fallen away from the game for the foreseeable future. Right now, it is late, and it's been a while since I've looked at my work. I will revisit this at some point this weekend and get back to you
  2. I found it very odd as well that the JS in the desktop application only worked when treating length as a function. But there it is. Looking forward to seeing how you fare with the model! Keep me posted.
  3. As suspected. Will look into the web app issue and report back. Edit: this is the same error you're getting? @Drew Kerman: Seems there is some discrepancy between the JS syntax accepted by the web app and desktop versions. I'm far from expert in JS, so I can't begin to imagine why that might be. Good news is, it's easily solved dealt with. Since you're going to be using the web app, you'll need to make your own copy so your changes will be saved (you might need to make a free GeoGebra account for that). In the top right corner menu of the web app's webpage, you can "copy worksheet." In your copy, head to the Object Properties for chNameTags (the checkbox labelled "Body Names") and chNodeTags (the checkbox labelled "Point & Node Labels"). Under the Scripting tab for each, change var arr = arrStr.substr(1,arrStr.length()-2).split(", "); to var arr = arrStr.substr(1,arrStr.length-2).split(", "); //(brackets after arrStr.length removed) An annoying inconsistency... If anyone has suggestions to keep the web app and desktop scripts consistent with each other I'm all ears
  4. Strange. What works on the desktop version doesn't work in the web app... or at least not the same way. I've never liked that web app. Did you try downloading the file anyway, installing GeoGebra, and opening the model there?
  5. I've actually been working away on further refining and optimizing the model in light of a small but compounding mathematical error which arose shortly after initial release. It's been challenging because in order to fix it, I've had to pretty much rebuild the model from the ground up, changing the way everything is calculated. I'm getting close though! What that means is that shortly (in a week or so, maybe), I will provide an updated, streamlined model. The backend (spreadsheet and algebra) will look rather different from the original. But I plan on providing lots of in-depth information on using and customizing the tool, so I'll definitely include the info you're asking for at that time And just to let you know, the algebra is not really separate from the spreadsheet. It displays every object of every type in the open GeoGebra file. So the spreadsheet actually creates algebra objects as you input data into it; you don't need to do everything twice. For example, if you input the definition for a point (say, a planet's location on its orbit) into cell C37, GeoGebra creates an algebra object (in this case, a point) with that definition, named "C37". I only use the algebra pane for formatting and customizing objects (colour, transparency, label, scripting events, etc.), as well as for defining values not contained in the spreadsheet, like the in-game time (UT) and the objects that make up the user interface. One thing to note: GeoGebra often classifies the algebra objects it creates from the spreadsheet as "auxiliary objects." These are not visible in the algebra pane by default, so if something seems like it's missing, that's probably why. Depending on whether you're using a web or desktop GeoGebra app, there are a few different ways to display auxiliary objects. I'll explain all this (and more) in greater depth when I post the updated model. In the meantime, though, don't hesitate to shoot any questions my way!
  6. Thanks! Got it! Here's my code. I guess I could have done a direct write to file, but I just copypasted from the output_log and used notedpad++ to remove any extraneous lines. Didn't end up using FlightGlobals. using UnityEngine; namespace ParamExtract { [KSPAddon(KSPAddon.Startup.TrackingStation, false)] public class ParamExtract : MonoBehaviour { public void Start() { // fires when focus changed in tracking station GameEvents.onPlanetariumTargetChanged.Add(TrackingStationTargetChanged); } // React to tracking station focus changing private void TrackingStationTargetChanged(MapObject target) { Debug.Log("Name: " + target.name); Debug.Log("Radius: " + target.celestialBody.Radius); Debug.Log("SMA: " + target.orbit.semiMajorAxis); Debug.Log("Eccentricity: " + target.orbit.eccentricity); Debug.Log("Inclination: " + target.orbit.inclination); Debug.Log("LAN: " + target.orbit.LAN); Debug.Log("APe: " + target.orbit.argumentOfPeriapsis); Debug.Log("Period: " + target.orbit.period); Debug.Log("Mean Motion: " + target.orbit.meanMotion); Debug.Log("Pe Radius: " + target.orbit.PeR); Debug.Log("Ap Radius: " + target.orbit.ApR); Debug.Log("Epoch: " + target.orbit.epoch); Debug.Log("MNA at UT=0: " + target.orbit.meanAnomalyAtEpoch); Debug.Log("SOI Radius: " + target.celestialBody.sphereOfInfluence); Debug.Log("Atmo Alt: " + target.celestialBody.atmosphereDepth); } } }
  7. I am attempting to write an extremely simple plugin to allow me to extract some information about the physical and orbital parameters of the stock celestial bodies. I am having some accuracy issues with a tool I created, and suspect the root of the problem might be that my raw data (taken from the wiki) is just slightly off. What I hoped to do was simply fetch the data I needed (eg, Pe and Ap radius, orbital eccentricity, inclination, etc.) and print it to the debug menu/output log. From there I would just copy it out and process it manually. Using the "Getting Started" thread, I've been able to put together a tiny "Hello World" add-on that starts when I enter the Tracking Station (). But I'm not sure where to go from there. I have no C# or Unity background, though I do have some experience with scripting and the like. Can someone provide some examples on how I can retrieve the information I'm after? I've found some instance fields and instance properties in the Orbit class that look like what I'm after, but I'm unsure of the *ahem* syntax *cough* that I need to use to fetch them. Thanks for any guidance!
  8. Hey @diomedea, made a couple changes per your suggestions. I addressed the crowding of AN/DNs & Pe/Aps by replacing the checkbox for each with a drop-down menu, allowing users finer control over what is shown/hidden. I also added an optional stats pane for the body in focus, displaying orbital and basic physical parameters, as well as time to AN and time to Pe. Time to DN and Ap can be easily calculated by the user by adding or subtracting half the orbital period, depending on the planet's current position in its orbit. I considered incorporating this in the stats pane but, given its simplicity, opted to leave it to the user to avoid crowding the view too much.
  9. Further to this, items like conics and a few variables defined for calculation and UI purposes were input directly, and so can be accessed in the algebra view. Users wanting to edit the model are encouraged to explore and experiment, but I'm happy to field questions and offer advice/insight.
  10. Thanks for the feedback, diomedea! The first item in the "Focus View" dropdown is Kerbol (though perhaps it should be "Sun"). Select that, and the focus moves to the origin point (0,0,0). Select again, and the zoom level adjusts way out to display the whole system. It's not a "double click," but a repeated action; speed is not a factor. Again, though, I'd like to find a way to do it in one click. I feel your pain about the crowding. A little scripting could likely go a long way to help this. I will look into it! In terms of editability, I wanted the released version to be as simple as possible, so there is actually a lot of functionality hidden away but easily uncovered. If a user wants to edit, it can be done by downloading the Geogebra desktop app and model source file. From there, open up the spreadsheet view and all the parameters I used to create the model are laid out. Most points on the model are actually tied directly to values in the spreadsheet, so changes in the spreadsheet yield immediate changes in the model itself, assuming valid input is given. This is all accessible on the web version too, but it's way more cumbersome and changes aren't saved. An info window for the focused body is a really cool idea though! I'll add that to the update list
  11. Thanks! And yep, that's the bug. Just select again and problem solved.
  12. Tagging for your interest in the original 2D model: @TheRagingIrishman @SpannerMonkey(smce) @Kartoffelkuchen @diomedea @Drew Kerman
  13. ^Model is not actually 8-bit After lots of research, lots more math, and lots more tinkering, I am proud to present this 3D model (version 2.0!) of the KSP solar system. This tool provides accurate visualization and measurement of KSP’s celestial bodies with respect to one another using GeoGebra, a free and open-source graphing software. Sure, it’s pretty to look at, but its real strength is that you, the user, can use it to model and/or measure just about anything in-game. All planets and moons are represented accurately in terms of scale, eccentricity, orientation, inclination... all of it. The base state of the model has all bodies located where they would be in-game at UT=0, and can be run forward from there to 1000 in-game years (and beyond if you really need). Scale is in megameters (1Mm = 1,000km = 1,000,000m). ^Applet screenshot All stock planets and moons are represented accurately on their orbits. Semimajor axis, eccentricity, inclination, longitude of ascending node, argument of periapsis, orbital period, phase angle, body size (including atmosphere), and sphere of influence are all modeled. All bodies start exactly where they would at the beginning of a game (UT=0), and can be run forward from there to 500 in-game years (and beyond if you really need). Scale is in megameters (1Mm = 1,000km = 1,000,000m). Some of the data have been extracted directly from KSP (v1.2). Everything else is calculated within the model using that raw data. See below for the code used for the extraction. To use: To use the base tool (a version that is not easily modified or customized), follow this link to view and use it in the GeoGebra web app. You can get the customizable version at this link. It is strongly recommended that users download and install GeoGebra to their computer, as it’s faster and more stable. You can download the source file for the model by navigating to the appropriate link above and clicking in the top right corner of the applet. Full Instructions on using/customizing the model are available at the wiki. This project was very much an adventure for me, so I would not be surprised if there are (still) things I've missed, inaccuracies, etc. Please don't hesitate to bring them to my attention, along with suggestions for how to fix them, if available. I'm also open to ideas about additional features. Licensing: Because I've published the model on geogebra.org, it is subject to the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. Keep in mind that Geogebra is something altogether different. I have had no part in developing it, and it is subject to its own licensing, terms, and conditions. Updates: 05/20/2017: Major update with updated/streamlined calculations, fixed mathematical errors, improved accuracy (thanks to a script for the direct extraction of data from the game), new basic/customizable versions, and a wiki! 04/08/2017: Addressed crowding of AN/DNs & Pe/Aps by replacing the checkbox for each with a drop-down menu, allowing users finer control over what is shown/hidden. Added hide-able stats pane for body in focus, displaying orbital/physical parameters and time to AN and Pe. Changed auto-zoom levels to depend on body in focus. Original 2D model updated/converted to 3D. Known Issues: Body in "Focus View" drop-down often needs to be selected twice in order to display the target body at intended zoom level. Suggestions welcome. When focusing view, viewVector should orient camera to particular angle. It does not. Commented out for now. Discrepancy between JS syntax accepted by the web app and desktop versions causing error in customizable version's web app at launch. Not sure of reason, no "proper fix" at this time. Works fine in desktop version. Simple workaround is here. ^Joolian system
  14. Hey folks. Just wanted to offer an update on my progress since I've been completely silent for a few weeks. I've been plugging away at a 3D model of the system and learning how to represent the planets' and moons' changing positions over time. What I have right now is a product that is very nearly done (80%) and more than anything else just in need of a bit more tidying and polishing. I've been a bit busy lately and haven't had the time to work on this that I'd have liked, and I'm not yet sure how the next couple weeks are going to play out for my schedule. But rest assured, the 3D model is coming. And @Drew Kerman, I think you'll be quite pleased with the results Not yet sure if I'll post the finished product as an update to this topic or a new one altogether; the 3D model is a much more substantial, and frankly significantly different piece of work from the initial file I posted. In either case, I'll place an update in the OP.
  15. I think MatLab is probably a lot more powerful than Geogebra, but also a lot less accessible, both in terms of learning curve and plain old availability. Geogebra makes sharing a lot easier and doesn't really have code... just the language of math and some rudimentary input syntax. That's what I appreciates about GeoGebra.
  16. Hey DK. You actually showed me something about GeoGebra on the web that I was completely unaware of. I had previously been limiting myself to the Windows desktop application, and was largely ignoring its web capabilities. Those worksheets are a game changer for me. I've been exploring your KSA project, as I hadn't heard of it before, and I have to applaud you for your passion and dedication! That's quite the undertaking you've... erm... undertaken... As for using GeoGebra for your purposes, it seems to me (from my limited understanding of what's going on in that macro) that it would/could be a good fit. Variable sliders for mean/true anomaly, elapsed time, focused planet, etc, might be the sorts of tools you'd want to leverage most. As my model evolves over the next few weeks/months, you can feel free to use/modify it for your own purposes (with acknowledgement, please), but you certainly seem capable of building your own should you wish. Long story short, I think exploring GeoGebra as a possible solution would be worth your while. Does that help?
  17. UPDATE: New thread created for 3D model that does everything this model does and more. Original post below: I've been exploring optimization solutions lately for my interplanetary communications network, and was having a hard time wrapping my head around some of the math and picturing the system in my head. So I did some research and learned some equations and relationships and found a nice free graphing software to bring it all together. I worked out the polar coordinate equation for each planet's elliptical orbit and plotted it. What came of the exercise was a scale model of the Kerbol System, viewed from the top down, with all planets' orbits represented accurately in terms of: major and minor axes foci (Kerbol in the correct position) eccentricity longitude of ascending node (how a planet's orbit is tilted relative to a reference direction) argument of periapsis (where the Pe is located; given relative to the longitude of the ascending node) (As far as I can tell, imgur album embedding is broken at the moment--please correct me if I'm wrong--so forgive the screen-captures.) ^Model overview ^Inner planets ^Tidied up a little (disabled grid-lines, too) ^Just Kerbin, Jool, and Eeloo nicely visualized The only thing this tool doesn't properly portray is orbital inclination, as that would be in a third dimension. I may look into that soon. We'll see. To use: Download and install GeoGebra on damn-near any platform, or use the web app Download the .gbb file I've l inked here from Dropbox Open, explore, modify... enjoy! At the moment, it's a fairly bare-bones item, with only the most essential information included, but it may just end up growing into something more substantial, whether for my own use, or at the request of the community. I don't know if any licensing is necessary here, but if it is, let's say.... MIT (referring only to the .gbb I've shared. GeoGebra has its own licensing policy). A few notes for clarity: Scale is in megameters (1Mm = 1,000km = 1,000,000m Visibility of elements can be turned on/off in the left pane. This can help with crowding when zoomed out past the inner planets. Π is used to denote the location of the ascending node (normally I would use ☊ but GeoGebra does not support it) Ω denotes the longitude of the ascending node (an angle) ω denotes the argument of periapsis (an angle) γ is used to denote the reference direction, along the x-axis (normally I would use ♈ but GeoGebra does not support it)
  18. I've looked into this. So sorry for mucking up your funds and rep I think the issue was that having two requirements (Orbit of body completed; Astronaut Complex: lvl 2) necessitated grouping the requirements under a parent -- a set requirement for "all" child requirements to be met. I had not done so in the last release. @NCommander can you confirm the updated pack is working for you? (I suggest making a backup, just to be safe.) For anyone interested in the code:
  19. And done! See Spacedock (and shortly CKAN) for updated version with new requirement: Astronaut Complex lvl 2! Thanks again, @Skalgrin
  20. This is an excellent suggestion and a definite oversight on my part. My apologies for your hiccup! I will update the pack to include that restriction hopefully within the week.
  21. Interesting idea! Although it would set a precedent for the rest of the celestial bodies that I'm not really prepared to follow-through with... unless I had a data-set like quietghost's I could use for all of them. I greatly admire the work that went into compiling that! Unfortunately, I'm not up to the task
  22. Holy cow! And what a pleasure to have you back in that saddle! Welcome back. Saw on the blog you've stepped back from squad to make room for life. It must have been a tough decision. Nevertheless, glad we-all in the community don't have to say goodbye altogether to your excellent work and support. Regarding the duplicate checking, something still seems off with v. 2.6.1 (see the images below). No duplicates in the list, but each custom waypoint seems to have a copy of itself behind it. Not sure if contract-generated waypoints are producing the same effect (edit: they are not). The effect is made more obvious in the second image, as the "shadow waypoint" is obscured by the game's UI, while the main one is not. Not a big deal... just triggered my OCD . Thought I'd bring it to your attention.
×
×
  • Create New...