Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Cartesian or Polar Coordinates to store intergalactic objects in DB?

  1. Jun 18, 2014 #1
    So I'm wondering, should I use Cartesian or Polar Coordinates to store intergalactic objects in DB?

    I'm currently prototyping a game idea that can be oversimplified as a space ship simulator in infinite space. I'm considering grouping objects together so that they have a "parent super-space" as follows:

    A cluster would be an object where the parent space is the universe.
    A galaxy's parent space is a cluster.
    A solar system's parent space is a galaxy.
    A star/planet's parent space is a solar system.
    Any other smaller object would occupy the sub space of any of the above.

    For example, if a planet left a solar system, then it would be in the galaxy's subspace. The user will be able to fly their ship anywhere they feel like.

    My reasoning for this is that I think it would be a lot harder to maintain the illusion of "real enough gravity" if things were stored in Cartesian coordinates.

    I think there would be a draw back in calculating distances between 2 game objects, but if they are not in the same subspace then I could probably just estimate with the distances between their subspaces.

    Would you pick Cartesian or Polar coordinates for this kind of project?
     
  2. jcsd
  3. Jun 18, 2014 #2
    I presume you are talking about 3D, right? In which case, Polar coordinates do not apply.

    I personally prefer Cartesian as they are the first ones I learned from before I knew anything...I have been measuring width, height, and depth of stuff for a while now...it just seems a lot more natural and straight forward and easily relate-able to the physical world.

    X,Y,Z is always X,Y,Z...spherical/cylindrical coordinates have more than one way to be represented and their values have periodicity which may add complexity to handling values.

    But that is just me...

    ...then again, if you are going to be keeping track of planets orbiting about their suns, and solar systems about their galaxy's center...maybe polar is good enough for that alone and then keep track of the orientation of the respective local coordinate systems and be prepare to do transformation, etc.

    bla, bla, bla
     
  4. Jun 19, 2014 #3
    The best way to store data is 100% based on how you will use the data.
    If you are going to be traveling among these objects and rendering them to the GUI from different locations, then that would strongly favor Cartesian.
     
  5. Jul 1, 2014 #4

    Baluncore

    User Avatar
    Science Advisor

    The data should be stored in 3D Cartesian coordinates, that is really the only sensible solution.

    Real data observed from our solar system is available as RA, Dec and red shift.
    That will be converted only once from polar to rectangular with heavy use of trig functions.
    The computation then becomes matrix or vector arithmetic, trig functions can be avoided.

    The database would have a hierarchical structure where the position of objects would be the sum of a few 3D vectors from an origin. Entire clusters could be moved by changing one 3D vector.

    Velocity and rotation can also be implemented in the 3D space.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Cartesian or Polar Coordinates to store intergalactic objects in DB?
  1. Storing data in fortran (Replies: 10)

Loading...