Now close that eye and open the other one, and look at the background. This is because your eyes are a few centimeters apart from each other and have a different point of view. This is what gives you Stereo vision that lets you judge the distance of an object. The angle the object appears to move from eye to eye gives a measure of its distance. You are automatically triangulating its position.
Astronomers use the same principle to calculate the distances to the nearer stars.
Their method is called Trigonometric Parallax. Most stars are so far away that they never appear to move when viewed from the Earth. Astronomers use these far stars as a fixed background. Repeat the thumb experiment, but move if closer to your face. Notice that the closer your thumb is to your eyes, the farther it appears to shift in the background.