polygon implementation, spline refactoring