I have data on nearby stars, including galactic coordinates and distance from Sun. And I have a dilemma.

In a story I'm writing, I have two starfaring alien civilisations. One originates from a planet orbiting Delta Pavonis and has a few settlements on nearby (to Delta Pavonis) stars. The second civilisation originates from a planet orbiting a star near Delta Pavonis as it is attacking the first civilisation.

But two stars that are at a similar distance from Sun, let's say, 12 light years, might be very far apart from each other as they are on opposite sides of the sky.

Thus my question is, knowing the galactic coordinates of stars and distances from the Sun, how to calculate distances between the two stars?


3 Answers 3


This can be done straightforwardly without even thinking about the geometry if you convert to Cartesian coordinates. Given a star at distance $d$, galactic latitude $b$, and galactic longitude $l$, you can define Cartesian coordinates such that $$ x = d\cos b \cos l$$ $$ y = d\cos b \sin l$$ $$ z = d\sin b.$$ If you evaluate these coordinates for both stars, you can then subtract them to get the separation.

Explicitly, suppose star 1 is at distance $d$, galactic latitude $b$, and galactic longitude $l$, and star 2 is at distance $d^\prime$, galactic latitude $b^\prime$, and galactic longitude $l^\prime$. Then the distance between them is

$$\sqrt{(d\cos b \cos l-d^\prime\cos b^\prime \cos l^\prime)^2+(d\cos b \sin l-d^\prime\cos b^\prime \sin l^\prime)^2+(d\sin b-d^\prime\sin b^\prime)^2}.$$

  • $\begingroup$ Could you please enlighten me on the difference between Cartesian and Galactic coordinates? Also, what actions exactly do you make in these calculations? Is it multiplication? At school, I had poor grades in mathematics and was stubbornly sure I wouldn't need math in life :-) $\endgroup$ Commented Mar 14, 2023 at 20:16
  • $\begingroup$ Galactic coordinates describe the angular position of an object on the two-dimensional sky, in a manner that's oriented with respect to the Milky Way galaxy. It's like latitude and longitude on the Earth, if the galaxy were to lie along the equator. Cartesian coordinates give the three-dimensional position of an object, in terms of three coordinates that can be viewed as "front/back position", "left/right position", and "up/down position". $\endgroup$
    – Sten
    Commented Mar 14, 2023 at 20:33
  • $\begingroup$ @KrišjānisLiepiņš I added the full explicit calculation $\endgroup$
    – Sten
    Commented Mar 14, 2023 at 22:26
  • $\begingroup$ Thank you, this is very helpful! $\endgroup$ Commented Mar 15, 2023 at 7:49
  • 1
    $\begingroup$ @AlexanderCska It sounds like $\nu$ is the fraction of stars that host such civilizations. Then the number density of stars (number per volume) is $D_0^{-3}$, so the number density of civilizations is $\nu D_0^{-3} = (D_0/\nu^{1/3})^{-3}$. $\endgroup$
    – Sten
    Commented Mar 20, 2023 at 17:26

Part Oe of Five: An Online Dsitance calculator.

Here is a link to an online calculator that calculates the distance between two stars.


I think it only works for the stars that are in it's data base.

Part Two: A Problem With Aliens From Delta Pavonis.

Here is a frame challenge.

Delta Pavonis might be too close to Earth to be the center of a realm colonizing other stars, if Earth is not already colonized at the beginning of the story. Because only a minority of stars would be expected to have (naturally) habitable planets, Earth might be one of a very few habitable planets closest to Data Pavonis, or even the closest habitable planet to Delta Pavonis.

Here is a link to Habitable Planets for Man, Stephen Dole, 1964.


There are many places within the biosphere of planet Earth which are filled with lifeforms, but where unwarned and unprotected humans would swiftly die. For example, a few kilometers high the atmosphere, or a few kilometers beneath the surface of the Sea, or a few kilometers deep in rock where microorganisms live. And even on the surface of the Earth, the majority of the surface is water too far from the nearest land for a human to swim.

So most parts of Earth's biosphere are habitable for liquid water using lifeforms, but not habitable for humans. So it is easy to imagine that there could be planets which are habitable for some liquid water using lifeforms, but don't have any places that are habitable for humans.

So planets habitable for humans in particular should be a smaller subset of planets habitable for liquid water using life in general.

And most discussions of planetary habitability discuss habitability for liquid water using life in general. The only discussion of planetary habitability for humans in particular (and thus for aliens who also need an oxygen rich atmosphere) is Habitable Planets for Man.

Dole calculates the probability that an individual star will have a human habitable planet, a figure which many science fiction fans will consider to be "Dole-fully" small.

Table 19 on page 105 lists the expected (by Dole) number of human habitable planets within spheres around Earth with different radii.

Within a radius of 27.2 light years there should be one habitable planet (beside Earth).

Within a radius of 34.3 light years there should be 2 habitable planets (beside Earth).

Within a radius of 46.5 light years there should be 5 habitable planets (beside Earth).

Within a radius of 25.5 light years there should be 10 habitable planets (beside Earth).

Within a radius of 100 light years there should be 50 habitable planets (beside Earth).

So if the Delta Pavonians made the same sort of calculations and got the same figures as Dole, they would be pleasantly surprised to find their first habitable planet as close to Delta Pavonis as Earth is. And Earth would be the first planet they conquered and colonized.

So every writer of a story where aliens colonize planets of other stars beside their home star has to decide on how many planets they have already colonized, and thus the radius of their sphere of colonization. And if Earth is not already colonized by them at the beginning of the story, their home planet must be at least a little bit, and possibly thousands of light years, farther from Earth than the radius of their sphere of colonization.

So if the Delta Pavonians have already colonized a bunch of different star systems at the star of the story, Earth will be within their sphere of colonization. And maybe the Delta Pavonians decided not to colonize Earth or interfere with humans, but only colonized planets with no native intelligent life. So stars colonized by the Delta Pavonians should be all around Earth in every direction. And the home star of the aliens who fight the Delta Pavonians could be in any direction as seen from Earth, since the Delta Pavonian border which those aliens come from beyond is in every direction as seen from Earth.

Part Three: A Solution.

Or the aliens could come from a star tens or hundreds of light years from Earth. At that distance a star capable of having a naturally human habitable planet would probably not be visible to the naked eye from Earth and would be known by its catalog numbers in various star catalogs.

Part Four: Another Solution.

Or you could say in your story that many more planets in the star systems around Earth are habitable than should naturally be habitable. The cause is that sometime in the past an advanced society terraformed the planets of many stars, including many stars which couldn't have naturally habitable planets, and so habitable planets are much more common than they would naturally be.

Thus the Delta Pavonians could have colonized at least a few planets around nearby stars without having discovered Earth yet.

Part Five: The Worldbuilding Stack Exchange.

You can also ask questions about creating fictional worlds and societies at the Worldbuilding Stack Exchange.



That can be done, using the cosine-rule in mathematics:

$$A^2 = B^2 + C^2 - 2BC\cos(\alpha)$$

enter image description here

$a$ is the location of the sun, $b$ and $c$ the location of your other stars.

  • 1
    $\begingroup$ It's little bit more involved than this, because you'll still have to calculate the angular separation of the two stars $\alpha$ from the coordinate system. $\endgroup$
    – notovny
    Commented Mar 14, 2023 at 15:13
  • $\begingroup$ I don't think it is that simple. It involves Celestial coordinates which is more than what Cosine rule can achieve. $\endgroup$ Commented Mar 15, 2023 at 5:02

You must log in to answer this question.

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