I have a point shape file in attachment. I want to calcute the convex hull polygon of the points in that file. But when I use the code as follows, It only return a blank PointCollection. Why? The shape file is right in Arcmap or ArcCatalog. I use the arcgis 9.3.
The pts is the arraylist that I read the shape file in attachment.
public ArrayList ConvexHull(ArrayList pts)
{
IGeometryCollection geomCol = null;
object missing = Type.Missing;
IPoint geom;
geomCol = new MultipointClass();
for (int i = 0; i < pts.Count; i++)
{
geom = new PointClass();
geom.X = Convert.ToDouble(((MyPoint)pts).x);
geom.Y = Convert.ToDouble(((MyPoint)pts).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++)
{
c.Add(ps.get_Point(i));
}
return c;
}
The ps object is a blank pointCollection after run the code.
Thank you.