Geometrical aspects of soft matter and optical systems