Calculating the Distance between Two Inaccessible Points

Suppose that you can measure the distance between A and B and the angles from A and B to two inaccessible points C and D. For example, A and B might be on a straight road in a valley and C and D might be two visible mountain peaks. Then you can calculate the distance between C and D using the law of sines and the law of cosines.