We are struggling to generate a surface from Planar Closed Polyline. Currently, for more than 4 edges shape is not correct. How should we improve it? Any help really appreciated

```
//Create surfaace from planar polyline points
public static Rhino.Geometry.Brep ToBrep(this IEnumerable<Rhino.Geometry.Point3d> points)
{
List<Rhino.Geometry.Point3d> pointList = new List<Rhino.Geometry.Point3d>(points);
//---Not necessary---
Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(pointList[0], pointList[1], pointList[2]);
points = pointList.ConvertAll(x => plane.ClosestPoint(x));
//-------------------
List<Rhino.Geometry.LineCurve> lineCurves = new List<Rhino.Geometry.LineCurve>();
// Create Line Curve
for (int i = 1; i < pointList.Count; i++)
lineCurves.Add(new Rhino.Geometry.LineCurve(pointList[i - 1], pointList[i]));
lineCurves.Add(new Rhino.Geometry.LineCurve(pointList.Last(), points.First()));
//Ceate Surface
return Rhino.Geometry.Brep.CreateEdgeSurface(lineCurves);
}
```

GH approach

Our approach