fixed polygon function