In a sol system 2d simulation I have some problems in showing the entire system (ie: eaven planets far away than saturn ) letting distinguibles the nearest planet orbits.

enter image description here

Actualy a use a simple scaling logic like this

    double _x = W / 2.0 + ((x ) / maxW) * W;
    double _y = H / 2.0 + ((y ) / maxH) * H;

where x is real planet x position (assuming sun at origin (0,0)) y is real planet y position W is canvas width (i.e 512) H is canvas height (i.e 512)

maxW and maxH are the system real border (or the portion I decide to simulate) : in the example I put maxW = maxH = 20.0 * 149597870700.0; (20 times the sun earth distance)

What I ask : there's a methot to calculate a (non linear) scaling that let show a bigger portion of the system but keeping some distance between objects near the center ?

EDIT: Here what I get if I enlarge the system borders: maxW = maxH = 60.0 * 149597870700.0; (60 times the sun earth distance(UA) )

enter image description here


1 Answer 1


Use a logarithmic scale where drawnRadius = log(actualRadius).

You then end up with a spacing like this which shows all the planets quite neatly separated:

solar system logarithmic represenation (this representation appears to be using logarithm to base 4)

When you want to apply this to your planetary simulation, you first need to convert the carthesian coordinates (x, y) of each planet to polar coordinates (angle, distance) relative to the center, calculate the logarithm of the distance, convert back to carthesian and draw it.

  • \$\begingroup\$ I think you put me in the right direction (I missed the polar coordinates stuff..) , I'll give it a try \$\endgroup\$ Jul 28, 2015 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .