implement polygon gate