How to calculate Convex hull?

Discussion created by zghan2002 on Sep 24, 2010
Latest reply on Sep 24, 2010 by zghan2002
Hi, I want to calucate the convex hull of the point set and get the points of the convex hull polygon. The code is as follows:
public ArrayList ConvexHull(ArrayList pts)
            IGeometryCollection geomCol = null;
            object missing = Type.Missing;
            IPoint geom;

            geom = new PointClass();
            geomCol = new MultipointClass();

            for (int i = 0; i < pts.Count; i++)
                geom.X = ((MyPoint)pts[i]).x;
                geom.Y = ((MyPoint)pts[i]).z;
                geomCol.AddGeometry(geom as IGeometry, ref missing, ref missing);
            ITopologicalOperator topoOP =geomCol as ITopologicalOperator;
            if (!topoOP.IsSimple) topoOP.Simplify();
            IGeometry convexHull = topoOP.ConvexHull();
            IPointCollection ps = (convexHull as IPolygon) as IPointCollection;
            ArrayList c=new ArrayList();
            for (int i = 0; i < ps.PointCount; i++)
            return c;
But I didn't get right result. Why? Thank you very much.