public void ARRPH() { // Arrange Spline2D one = new Spline2D(new List <Vector2> { new Vector2(0, 0), new Vector2(0, 1), new Vector2(0, 2) }); Spline2D two = new Spline2D(new List <Vector2> { new Vector2(0, 0), new Vector2(1, 1), new Vector2(2, 2) }); // Act Vector2 positionOne = one.Interpolate(0.75f); Vector2 positionTwo = two.Interpolate(0.75f); // Assert Assert.Multiple(() => { Assert.AreEqual(new Vector2(0, 1.5625f), positionOne); Assert.AreEqual(new Vector2(1.5625f, 1.5625f), positionTwo); }); }
/// Interpolate a position on the entire curve. Note that if the control /// points are not evenly spaced, this may result in varying speeds. public Vector2 Interpolate(float t) { InitSpline(); return(spline.Interpolate(t)); }