A compass is a navigational instrument that measures directions in a frame of reference that is stationary relative to the surface of the earth. The frame of reference defines the four cardinal directions (or points) – north, south, east, and west. Intermediate directions are also defined. Usually, a diagram called a compass rose, which shows the directions (with their names usually abbreviated to initials), is marked on the compass. When the compass is in use, the rose is aligned with the real directions in the frame of reference, so, for example, the "N" mark on the rose really points to the north. Frequently, in addition to the rose or sometimes instead of it, angle markings in degrees are shown on the compass. North corresponds to zero degrees, and the angles increase clockwise, so east is 90 degrees, south is 180, and west is 270. These numbers allow the compass to show azimuths or bearings, which are commonly stated in this notation.
There are two widely used and radically different types of compass. The magnetic compass contains a magnet that interacts with the earth's magnetic field and aligns itself to point to the magnetic poles. The gyro compass (sometimes spelled with a hyphen, or as one word) contains a rapidly spinning wheel whose rotation interacts dynamically with the rotation of the earth so as to make the wheel precess, losing energy to friction until its axis of rotation is parallel with the earth's.
The magnetic compass was invented during the Chinese Han Dynasty between the 2nd century BC and 1st century AD, and was used for navigation by the 11th century. The compass was introduced to medieval Europe 150 years later, where the dry compass was invented around 1300. This was supplanted in the early 20th century by the liquid-filled magnetic compass.