refactoring of polygon and cylinder class