Geometry: formula calculating