public virtual Posture PointingBackwards() { return(new FunctionalPosture(body => RatioCalculator.DifferenceDistanceRatio( body.ZDiff(To, From), body.DistanceBetween(To, From)))); }
public virtual Posture PointingForward() { return(new FunctionalPosture(body => RatioCalculator.DifferenceDistanceRatio( body.YDiff(From, To), body.DistanceBetween(To, From)))); }
public virtual Posture AtTheSameLengthOf(JointType other) { return(new FunctionalPosture(body => RatioCalculator.AbsoluteDifferenceDistanceRatio( body.XDiff(Joint, other), body.PathLengthBetween(Joint, other)))); }
public virtual Posture ToTheRightOf(JointType other) { return(new FunctionalPosture(body => RatioCalculator.DifferenceDistanceRatio( body.XDiff(Joint, other), body.PathLengthBetween(Joint, other)))); }
public virtual Posture Before(JointType other) { return(new FunctionalPosture(body => RatioCalculator.DifferenceDistanceRatio( body.ZDiff(other, Joint), body.PathLength(other, Joint)))); }
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); }
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)); }
public virtual Posture OverlapsWith(JointType other) { return(new FunctionalPosture(body => RatioCalculator.DifferenceDistance(body.XDiff(Joint, other), body.YDiff(Joint, other), body.ZDiff(Joint, other)))); }