This app calculates the center of gravity of a given rocket, and eventually, probably, a portion of that rocket.
You can use this to optimally place RCS engines.
That's...pretty much it.
This calculator is a Python webapp on the backend, which mostly just loads and parses the ship files and handles downloading the ships and such. The frontend is a jQuery-based Javascript app that does all of the analysis and rendering, using Canvas for the rendering.
A Python webapp using the Bottle framework.
Bottle is a very basic framework with minimal requirements. To get
up and running, you just need Python installed, with the bottle
package installed. For this app, you will also need requests
in
order to handle getting the ship files. Everything else should be
included in a standard Python install.
To set these up, just install via your favorite Python package installer, such as:
pip install bottle
pip install requests
And then to get started, just use the included debug server:
python rocketcenter.py
The server should start up, and you should be able to access the app on your computer at http://localhost:54321
A quick overview of the structure of things: rocketcenter.py
is
the web app that handles the requests and the actual app
interaction. simplerockets.py
contains all the logic for
parsing and handling the ship files and their data. It in turn
uses the included polyfunc.py
in order to handle some polygon
calculations.
The frontend is a jQuery-based Javascript app that is similarly
divided: evaluate.js
handles the interaction and UI setup,
and then rocket.js
has the logic specific to the rocket logic.
It also uses transform-tracker.js
as a wrapper around the
Canvas Transform to keep track of transforms in a cross-platform
compatible way.
The CSS uses the Sass pre-processor. If you're working with the CSS, you should use the Sass processor of your choice.
I used Bottle becuase I try to use a new framework whenever I make a little app like this, I'm currently on a Python kick, and have heard good things. It was this or Flask, and I liked Bottle's docs better. Flask will get its day I'm sure.
Suggestions and especially pull requests are welcome!