Esempio n. 1
0
 public void WalkTriangles(IntermediateOutline intermediateOutline)
 {
     Stop = false;
     foreach (AnalyzedTriangle tri in intermediateOutline.GetTriangles())
     {
         if (Stop)
         {
             //user can cancel this walking session
             break;
         }
         OnTriangle(tri);
     }
     Stop = true;
 }
Esempio n. 2
0
        public void WalkCentroidLine(IntermediateOutline intermediateOutline)
        {
            Stop = false;

            List <CentroidLineHub> centroidLineHubs = intermediateOutline.GetCentroidLineHubs();

            foreach (CentroidLineHub lineHub in centroidLineHubs)
            {
                Dictionary <AnalyzedTriangle, CentroidLine> lines = lineHub.GetAllCentroidLines();
                Vector2f hubCenter = lineHub.CalculateAvgHeadPosition();
                //on each line hub
                OnStartLineHub(hubCenter.X, hubCenter.Y);
                foreach (CentroidLine line in lines.Values)
                {
                    List <Joint> joints    = line._joints;
                    int          pairCount = joints.Count;

                    for (int i = 0; i < pairCount; ++i)
                    {
                        OnJoint(joints[i]);
                    }

                    List <Bone> bones   = line.bones;
                    int         startAt = 0;
                    int         endAt   = startAt + bones.Count;
                    OnBeginBoneLinks(line.GetHeadPosition(), startAt, endAt);
                    int nn = 0;
                    for (int i = startAt; i < endAt; ++i)
                    {
                        //draw line
                        OnBone(bones[i], nn);
                        nn++;
                    }
                    OnEndBoneLinks();
                }
                //
                OnEndLineHub(hubCenter.X, hubCenter.Y, lineHub.GetHeadConnectedJoint());
                if (Stop)
                {
                    break;
                }
            }

            Stop = true;
        }
Esempio n. 3
0
        //
        public DynamicOutline(IntermediateOutline intermediateOutline)
        {
            //setup default values
            _needRefreshBoneGroup    = true; //first time
            _needAdjustGridFitValues = true; //first time
            this.GridBoxWidth        = 32;   //pixels
            this.GridBoxHeight       = 50;   //pixels
            _groupingHelper          = BoneGroupingHelper.CreateBoneGroupingHelper();
#if DEBUG
            this.GridBoxHeight           = dbugGridHeight; //pixels
            _dbugTempIntermediateOutline = intermediateOutline;
#endif

            //we convert data from GlyphIntermediateOutline to newform (lightweight form).
            //and save it here.
            //1. joints and its bones
            //2. bones and its controlled edge
            _contours = intermediateOutline.GetContours(); //original contours
            //3.
            CollectAllCentroidLines(intermediateOutline.GetCentroidLineHubs());
        }
Esempio n. 4
0
        public void WalkContour(IntermediateOutline intermediateOutline)
        {
            Stop = false;
            List <Contour> cnts = intermediateOutline.GetContours();
            int            j    = cnts.Count;

            for (int i = 0; i < j; ++i)
            {
                Contour       cnt    = cnts[i];
                List <Vertex> points = cnt.flattenPoints;
                int           n      = points.Count;
                for (int m = 0; m < n; ++m)
                {
                    if (Stop)
                    {
                        //user can cancel this walking session
                        break;
                    }
                    OnEdgeN(points[m].E0);
                }
            }
            Stop = true;
        }