You are correct, calculating any of those is easy, and I already have writing all the code. I was just looking for the best way to organize the code for re-use so I could easily share it or develop new scripts with similar functionality.
Not sure what you mean by "store all the 'properties' as custom attributes on each entity"
Can you give me an example for reference?