Beispiel #1
0
    {  //utils
        public static Vector2f GetHeadPosition(this CentroidLine line)
        {
            //after create bone process
            List <Bone> bones = line.bones;

            if (bones.Count == 0)
            {
                return(Vector2f.Zero);
            }
            else
            {
                //TODO: review here
                //use jointA of bone of join B of bone
                return(bones[0].JointA.OriginalJointPos);
            }
        }
Beispiel #2
0
 public bool FindBoneJoint(AnalyzedTriangle tri,
                           out CentroidLine foundOnBranch,
                           out Joint foundOnJoint)
 {
     foreach (CentroidLine line in _lines.Values)
     {
         if ((foundOnJoint = line.FindNearestJoint(tri)) != null)
         {
             foundOnBranch = line;
             return(true);
         }
     }
     foundOnBranch = null;
     foundOnJoint  = null;
     return(false);
 }
Beispiel #3
0
        /// <summary>
        /// set current centroid line to a centroid line that starts with triangle of centroid-line-head
        /// </summary>
        /// <param name="triOfCentroidLineHead"></param>
        public void SetCurrentCentroidLine(AnalyzedTriangle triOfCentroidLineHead)
        {
            //this method is used during centroid line hub creation
            if (_currentBranchTri != triOfCentroidLineHead)
            {
                //check if we have already create it
                if (!_lines.TryGetValue(triOfCentroidLineHead, out _currentLine))
                {
                    //if not found then create new
                    _currentLine = new CentroidLine();
#if  DEBUG
                    _currentLine.dbugStartTri = triOfCentroidLineHead;
#endif
                    _lines.Add(triOfCentroidLineHead, _currentLine);
                }
                _currentBranchTri = triOfCentroidLineHead;
            }
        }
Beispiel #4
0
        public void CollectBoneGroups(CentroidLine line)
        {
            //
            _tmpBoneGroups.Clear();
            line.ApplyGridBox(_tmpBoneGroups, _gridBoxW, _gridBoxH);
            //
            for (int i = _tmpBoneGroups.Count - 1; i >= 0; --i)
            {
                //this version, we focus on horizontal bone group
                BoneGroup boneGroup = _tmpBoneGroups[i];
                switch (boneGroup.slopeKind)
                {
                case LineSlopeKind.Horizontal:
                    _selectedHorizontalBoneGroups.Add(boneGroup);
                    break;

                case LineSlopeKind.Vertical:
                    _selectedVerticalBoneGroups.Add(boneGroup);
                    break;
                }
            }
            _tmpBoneGroups.Clear();
        }
Beispiel #5
0
 public void SetHeadConnnection(CentroidLine anotherCentroidLine, Joint foundOnJoint)
 {
     _anotherCentroidLine = anotherCentroidLine;
     _foundOnJoint        = foundOnJoint;
 }
Beispiel #6
0
 public BoneGroup(CentroidLine ownerCentroidLine)
 {
     _ownerCentroidLine = ownerCentroidLine;
 }