View Full Version : Plotting 3D Coordinates onto a 2D Plane

05-29-2012, 04:03 PM
If I know the [x y z] coordinates of a star in space, with earth as the origin (units in light years to be specific), how can I transform that coordinate vector into an [x y] coordinate that I can plot with the centre of the constellation at the origin. I would like to be able to input the [x y z] coordinates of the stars to a program and have a automatically generate the image of what the constellation would look like from earth.

Once I know I don't have to physically draw the what the constellation would like from looking at others.

Any input will be accepted.


05-30-2012, 03:31 AM
For rendering you setup a worldview matrix with the eye point at the origin and the lookat point as the centre of the constellation. You will need to experiment with an up because depending on what you chose the consellation will look rotated.

gluLookAt(0.0,0.0,0.0,constellation_centre_x,,cons tellation_centre_y,constellation_centre_z,0.0,1.0, 0.0); // y axis as up

This assumes all your coordinates use earth as the origin.