示例#1
0
 public void onChangePose()
 {
     current     = (TrainingUnit.Posture)dropDown.value;
     currentList = PostureDataHandler.instance.getSublist(current);
     index       = 0;
     Debug.Log("Got " + currentList.Count + " elements.");
 }
 public void saveCurrentAs(TrainingUnit.Posture posture)
 {
     if (gameObject.activeInHierarchy)
     {
         PostureDataHandler.instance.addTrainigData(new TrainingUnit(posture, hand));
         hand = new AngleBasedHandModel();
     }
     else
     {
         Debug.LogError("Tried to save hand, eventhough not active!");
     }
 }
示例#3
0
    void Start()
    {
        UserStudyData.instance.remainingIts--;
        overridePosture = UserStudyData.instance.posture;
        float targetdiscomfort = UnityEngine.Random.Range(0, 1000);

        StartCoroutine(getNewRandomHand(targetdiscomfort));
        if (UserStudyData.instance.right)
        {
            outputHand.transform.localScale = new Vector3(-outputHand.transform.localScale.x, outputHand.transform.localScale.y, outputHand.transform.localScale.z);
        }
        outputHand.visualizeHand(targethand);
    }
示例#4
0
    public List <TrainingUnit> getSublist(TrainingUnit.Posture current)
    {
        List <TrainingUnit> result = new List <TrainingUnit>();

        foreach (TrainingUnit tu in trainingData)
        {
            if (tu.posture == current)
            {
                result.Add(tu);
            }
        }
        return(result);
    }
    public static float getMinDistanceToPosture(TrainingUnit.Posture posture, AngleBasedHandModel hand)
    {
        if (comparePosture != posture || compareData == null || compareData.Count == 0)
        {
            comparePosture = posture;
            reload();
        }

        float result = float.PositiveInfinity;

        foreach (TrainingUnit tu in compareData)
        {
            if (result > hand.euclidianDistanceFingers(tu.hand))
            {
                result = hand.euclidianDistanceFingers(tu.hand);
            }
        }
        return(result);
    }
示例#6
0
 public TrainingUnit getRand(TrainingUnit.Posture post)
 {
     return(getSublist(post)[UnityEngine.Random.Range(0, getSublist(post).Count - 1)]);
 }
示例#7
0
 public void deleteAll(TrainingUnit.Posture current)
 {
     trainingData.RemoveAll(x => x.posture == current);
     Debug.Log("Deleted all " + current + " training data.");
     saveData();
 }
 public poseCompareObject(float dist, TrainingUnit.Posture post)
 {
     distance = dist;
     posture  = post;
 }
 public static bool isHolding(TrainingUnit.Posture posture, AngleBasedHandModel hand)
 {
     return(getMinDistanceToPosture(posture, hand) <= postureHoldingThresh);
 }