예제 #1
0
 public virtual Posture PointingBackwards()
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.DifferenceDistanceRatio(
                                      body.ZDiff(To, From),
                                      body.DistanceBetween(To, From))));
 }
예제 #2
0
 public virtual Posture PointingForward()
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.DifferenceDistanceRatio(
                                      body.YDiff(From, To),
                                      body.DistanceBetween(To, From))));
 }
예제 #3
0
 public virtual Posture AtTheSameLengthOf(JointType other)
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.AbsoluteDifferenceDistanceRatio(
                                      body.XDiff(Joint, other),
                                      body.PathLengthBetween(Joint, other))));
 }
예제 #4
0
 public virtual Posture ToTheRightOf(JointType other)
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.DifferenceDistanceRatio(
                                      body.XDiff(Joint, other),
                                      body.PathLengthBetween(Joint, other))));
 }
예제 #5
0
 public virtual Posture Before(JointType other)
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.DifferenceDistanceRatio(
                                      body.ZDiff(other, Joint),
                                      body.PathLength(other, Joint))));
 }
예제 #6
0
        public void Test_ratio(decimal expectedRatio, params int[][] rawData)
        {
            var generator = new RatioCalculator();

            var records = rawData.Select(x => new Collection <int>(x) as ICollection <int>).ToList();

            var ratio = generator.GetRatio2sTo1s(records);

            Assert.Equal <decimal>(expectedRatio, ratio);
        }
예제 #7
0
        private Posture InAngleWith(JointType joint, double angle)
        {
            var jointNode = _bodyGraph.Graph.FirstOrDefault(x => x.Name == joint.ToString());

            if (jointNode.DistanceDict.Any(x => x.Key == From.ToString()))
            {
                return(new FunctionalPosture(body =>
                                             RatioCalculator.AngleDifference(angle, body.GetAngleBetween(To, From, joint))));
            }
            if (jointNode.DistanceDict.Any(x => x.Key == To.ToString()))
            {
                return(new FunctionalPosture(body =>
                                             RatioCalculator.AngleDifference(angle, body.GetAngleBetween(From, To, joint))));
            }
            return(new FunctionalPosture(body => 0));
        }
예제 #8
0
 public virtual Posture OverlapsWith(JointType other)
 {
     return(new FunctionalPosture(body =>
                                  RatioCalculator.DifferenceDistance(body.XDiff(Joint, other), body.YDiff(Joint, other), body.ZDiff(Joint, other))));
 }