private void getjoinsAnalize() { foreach (int _angle in this.HeaderView.Trainer.functionalMovement.anglesOfMovement) { List <JointType> joints = DetailsOfStepFunctionalMovement.translateAngles(_angle); foreach (JointType joint in joints) { if (!this.joinsAnalize.ContainsKey(joint)) { this.joinsAnalize.Add(joint, null); } } } }
public void getAngle(List <int> _angles, int i) { List <List <StepFunctionalMovement> > _series = this.stepsByMovement[i]; for (int x = 0; x < _series.Count; x++) { List <StepFunctionalMovement> _repetitions = _series[x]; bool isOut = false; int ii = 0; foreach (StepFunctionalMovement step in _repetitions) { if (step != null) { if (ii == 0) { step.time = 0; } else { step.time = _repetitions[ii].accumulate - _repetitions[ii - 1].accumulate; } foreach (int _angle in _angles) { List <JointType> joints = DetailsOfStepFunctionalMovement.translateAngles(_angle); List <DetailsOfStepFunctionalMovement> vectorialPoints = step.detailsOfStepFunctionalMovement.FindAll(e => joints.Contains((JointType)e.join)); if (vectorialPoints.Count != 3) { isOut = true; break; } DetailsOfStepFunctionalMovement origen = vectorialPoints.Find(e => e.join == (int)joints[0]); if (origen == null) { isOut = true; break; } vectorialPoints.RemoveAll(e => (int)e.join == (int)joints[0]); if (vectorialPoints.Count != 2) { isOut = true; break; } if ((vectorialPoints[0] == null) || (vectorialPoints[1] == null)) { isOut = true; break; } Point po = new Point(origen.x, origen.y); Point p1 = new Point(vectorialPoints[0].x, vectorialPoints[0].y); Point p2 = new Point(vectorialPoints[1].x, vectorialPoints[1].y); origen.angle = KinectAngleBody.getAngleBody(po, p1, p2); } Predicate <DetailsOfStepFunctionalMovement> predicate = detail => { return(!_angles.Contains(detail.join)); }; step.detailsOfStepFunctionalMovement.RemoveAll(predicate); } else { isOut = true; } if (isOut == true) { break; } ii++; } if (isOut == true) { _series.RemoveAt(x); x--; } } }