Ejemplo n.º 1
0
 public BonePair(Bone boneX, Bone boneY, BonePairType type)
 {
     BoneX = boneX;
     BoneY = boneY;
     Type = type;
     BoneX.Edges.Add(this);
     BoneY.Edges.Add(this);
 }
Ejemplo n.º 2
0
 private string VisitBones(Bone bone, bool isFirst, char lastNum)
 {
     var pair = bone.Edges.FirstOrDefault(p => !p.Visited);
     if (pair == null) {
         return lastNum.ToString();
     }
     pair.Visited = true;
     var nextBone = bone == pair.BoneX ? pair.BoneY : pair.BoneX;
     var pairType = pair.Type;
     if (pair.BoneY == bone) {
         pairType = pairType ^ BonePairType.InvertMask;
     }
     switch (pairType) {
         case BonePairType.AA:
             return (isFirst ? bone.B.ToString() : string.Empty) + bone.A.ToString() + " " + nextBone.A.ToString() + VisitBones(nextBone, false, nextBone.B);
         case BonePairType.BB:
             return (isFirst ? bone.A.ToString() : string.Empty) + bone.B.ToString() + " " + nextBone.B.ToString() + VisitBones(nextBone, false, nextBone.A);
         case BonePairType.AB:
             return (isFirst ? bone.B.ToString() : string.Empty) + bone.A.ToString() + " " + nextBone.B.ToString() + VisitBones(nextBone, false, nextBone.A);
         case BonePairType.BA:
             return (isFirst ? bone.A.ToString() : string.Empty) + bone.B.ToString() + " " + nextBone.A.ToString() + VisitBones(nextBone, false, nextBone.B);
         default:
             return string.Empty;
     }
 }