I am currently running into some problems with plotting some stars locations in a Cartesian coordinate system. The stars aren't in the right order and I'm not sure where I am going wrong.

I first use the equation (where S is a vector)

S = [cos(ra)*cos(dec), sin(ra)*cos(dec), sin(dec)]

to obtain a vector S of the star. I now want to obtain the x and y positions of the stars In terms of a 2d coordinate system so I use

c * sx = S * px / S* pz
c * sy = S * py / S* pz

where C is the scale ratio of pixels to tangent of the angle of the camera and P is the vector center of the camera.(Im using this because I'm trying to find the distance between each pair of stars when a photo of the stars is taken by a camera)

px = unit vector X
py = unit vector Y
pz = unit vector Z

and I solve for sx and sy. When I plot the stars location with sx and sy however I do not get the right locations of the stars. Any guidance?

  • $\begingroup$ S is a scalar in this example. Is the code correct? $\endgroup$
    – James K
    Aug 13, 2016 at 8:18
  • 1
    $\begingroup$ could you please clarify what is a vector, scalar, dot product etc. in your writing? This is extremely confusing and inconsistent $\endgroup$ Aug 13, 2016 at 9:53
  • $\begingroup$ in this example S is a vector! My apologies I wasn't sure how to add the notations for vectors and dot products $\endgroup$
    – Continuum
    Aug 14, 2016 at 17:48
  • $\begingroup$ This MathJax tutorial may help.If $\hat{\mathrm p}_z= \vec P$, then your $\hat{\mathrm p}_x$ and $\hat{\mathrm p}_y$ look like my $\hat{\mathrm u}$ and $\hat{\mathrm v}$. $\endgroup$
    – Mike G
    Aug 14, 2016 at 18:36

1 Answer 1


A photograph of stars is essentially a gnomonic projection of part of the celestial sphere. If $\vec P$ is computed for the photograph center (RA, Dec) in the same way as $\vec S$, and the north celestial pole is $\hat{\mathrm k} = (0, 0, 1)^{\mathrm T}$, then the photograph has basis vectors perpendicular to $\vec P$ and each other, $$\hat{\mathrm u} = \frac{\vec P \times \hat{\mathrm k}}{\| \vec P \times \hat{\mathrm k} \|}, \hat{\mathrm v} = \frac{\hat{\mathrm u} \times \vec P}{\| \hat{\mathrm u} \times \vec P \|}$$ and you can project $\vec S$ onto the photograph as $$\left( \frac{\vec S \cdot \hat{\mathrm u}}{\vec S \cdot \vec P}, \frac{\vec S \cdot \hat{\mathrm v}}{\vec S \cdot \vec P} \right)$$ scaling as needed.

  • $\begingroup$ Thank you for your assistance! In my case, I am using vector P as (1, 1, 1) however im not sure if I should be doing this. Would k hat be apart of the vector P or is a seperate value on its own where I should be using its value as the center? Would you also be able to provide any links to where I might be able to learn more about this concept. $\endgroup$
    – Continuum
    Aug 13, 2016 at 2:00
  • $\begingroup$ $\vec P$ depends on the region of interest, e.g. for the Big Dipper you might center the photo at RA 12 h, Dec +55 deg and use $\vec P$ = (-0.57, 0.0, 0.82). To make $\hat{\mathrm u}$ and $\hat{\mathrm v}$ point west and north in the photo, I used a cross product with standard basis vector $\hat{\mathrm k}$ (aligned with +Z axis, north celestial pole). $\endgroup$
    – Mike G
    Aug 13, 2016 at 3:44
  • $\begingroup$ so if I were to have kept my P vector as (1 , 1 , 1), this would have given me incorrect results for finding the coordinates of the stars in the big dipper? $\endgroup$
    – Continuum
    Aug 13, 2016 at 4:03
  • $\begingroup$ You might still be able to plot them, but the constellation would be severely distorted. $\endgroup$
    – Mike G
    Aug 13, 2016 at 4:55

You must log in to answer this question.

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