Optimize the generating method of polygon.

Signed-off-by: RyeYao <rye.y.cn@gmail.com>