Height is the measurement of an object in the vertical direction and distance is the measurement of an object from a particular point in the horizontal direction. The calculation of the height of an object is achieved by the measurement of its distance from the object. This includes the angle of elevation at the top of the object while calculating the height. The tangent of the angle is considered as the height of the object, which is divided by the distance from the object.
It is definitely not possible to measure it directly. Trigonometry helps do that. You can use angle of elevation and depression to measure heights and distances easily which are otherwise complicated to measure.