public static Edge SupportEdgeForPoly(cpPolyShape poly, cpVect n)
            {
                ulong count = (ulong)poly.Count;

                ulong i1 = cpCollision.PolySupportPointIndex(poly.Count, poly.planes, n);

                // TODO get rid of mod eventually, very expensive on ARM
                ulong i0 = (ulong)((i1 - 1 + count) % count);
                ulong i2 = (ulong)((i1 + 1) % count);

                cpSplittingPlane[] planes = poly.planes;
                ulong hashid = poly.hashid;

                if (cpVect.cpvdot(n, planes[i1].n) > cpVect.cpvdot(n, planes[i2].n))
                {
                    Edge edge = new Edge(

                        new EdgePoint(planes[i0].v0, cp.CP_HASH_PAIR(hashid, i0)),
                        new EdgePoint(planes[i1].v0, cp.CP_HASH_PAIR(hashid, i1)),

                        poly.r, poly.planes[i1].n);

                    return(edge);
                }
                else
                {
                    Edge edge = new Edge(

                        new EdgePoint(planes[i1].v0, cp.CP_HASH_PAIR(hashid, i1)),
                        new EdgePoint(planes[i2].v0, cp.CP_HASH_PAIR(hashid, i2)),
                        poly.r, poly.planes[i2].n);

                    return(edge);
                }
            }
            public static SupportPoint PolySupportPoint(cpPolyShape poly, cpVect n)
            {
                ulong i = PolySupportPointIndex(poly.Count, poly.planes, n);

                return(new SupportPoint(poly.planes[i].v0, i));
            }