Beispiel #1
0
        public CPoint getGreaterCPoint(CPoint lessP)
        {
            int i = pl.FindIndex(item =>
            {
                CPoint seed = item as CPoint;
                if (seed == lessP)
                {
                    return(true);
                }
                return(false);
            });

            if (i < 0)
            {
                throw new System.Exception("CBoundary 45");
            }
            else if (i >= pl.Count)
            {
                throw new System.Exception("CBoundary 49");
            }
            int j = i + 1;

            if (j >= pl.Count)
            {
                return(null);
            }
            else
            {
                if (pl[j].param > lessP.param)
                {
                    return(pl[j]);
                }
            }
            j = i - 1;
            if (j < 0)
            {
                return(null);
            }
            else
            {
                if (pl[j].param > lessP.param)
                {
                    return(pl[j]);
                }
            }

            return(null);
        }
        List <object> calcOuterBoundary(CContour ccontour)
        {
            if (ccontour.isClosed)
            {
                return(null);
            }
            int           loopCount      = 0;
            List <object> resultBoundary = new List <object>();
            CPoint        startp         = ccontour.StartP;
            CBoundary     cb             = startp.Boundary;
            CContour      ccontour2      = ccontour;

            while (loopCount++ > 10)
            {
                CPoint greaterCPoint = cb.getGreaterCPoint(startp);
                if (greaterCPoint == null)
                {
                    return(null);
                }
                resultBoundary.Add(ccontour2);
                resultBoundary.Add(startp);
                resultBoundary.Add(greaterCPoint);
                if (greaterCPoint == ccontour.endP)
                {
                    return(resultBoundary);
                }
                ccontour2 = greaterCPoint.contour;
                if (ccontour2.StartP == greaterCPoint)
                {
                    startp = ccontour2.endP;
                }
                else if (ccontour2.endP == greaterCPoint)
                {
                    startp = ccontour2.StartP;
                }
                else
                {
                    throw new System.Exception("ContourColorize 116");
                }

                cb = startp.Boundary;
            }
            return(null);
        }
Beispiel #3
0
 public void add(CPoint p)
 {
     pl.Add(p);
 }