public void PointTouchConstraintSatisfiedDerivative() { var pointTouchConstraint = new JointConstraint(particle1, point1, particle2, point2); var derivative = pointTouchConstraint.Derivative(particle1); derivative.RespectToX.Should().BeApproximately(0, tolerance); derivative.RespectToY.Should().BeApproximately(0, tolerance); derivative.RespectToAngle.Should().BeApproximately(0, tolerance); derivative = pointTouchConstraint.Derivative(particle2); derivative.RespectToX.Should().BeApproximately(0, tolerance); derivative.RespectToY.Should().BeApproximately(0, tolerance); derivative.RespectToAngle.Should().BeApproximately(0, tolerance); }
public void PointTouchConstraintUnsatisfiedDerivative() { particle2.Position = new Vector2(20, 0); var pointTouchConstraint = new JointConstraint(particle1, point1, particle2, point2); var derivative = pointTouchConstraint.Derivative(particle1); derivative.RespectToX.Should().BeApproximately(0, tolerance); derivative.RespectToY.Should().BeApproximately(8, tolerance); derivative.RespectToAngle.Should().BeApproximately(-80, tolerance); derivative = pointTouchConstraint.Derivative(particle2); derivative.RespectToX.Should().BeApproximately(0, tolerance); derivative.RespectToY.Should().BeApproximately(-8, tolerance); derivative.RespectToAngle.Should().BeApproximately(-80, tolerance); }