Free-form meshes with planar hexagonal faces, to be called P-Hex meshes, provide a useful surface representation in discrete differential geometry and are demanded in architectural design for representing surfaces built with planar glass/metal panels. We study the geometry of P-Hex meshes and present an algorithm for computing a free-form P-Hex mesh of a specified shape. Our algorithm first computes a regular triangulation of a given surface and then turns it into a P-Hex mesh approximating the surface. A novel local duality transformation, called Dupin duality, is introduced for studying relationship between triangular meshes and for controlling the face shapes of P-Hex meshes.