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; }
// 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()); }