public void TestCubicPoint3() { Point3 a = new Point3(0.0f, 0.0f, 0.0f); Point3 b = new Point3(1.0f, 1.0f, 1.0f); Point3 c = new Point3(1.0f, 1.0f, 2.0f); Point3 d = new Point3(0.0f, 2.0f, 3.0f); Assert.AreEqual(b, Interpolations.Cubic(a, b, c, d, 0.0f)); Assert.AreEqual(new Point3(1.09375f, 1.046875f, 1.25f), Interpolations.Cubic(a, b, c, d, 0.25f)); Assert.AreEqual(new Point3(1.125f, 1.0f, 1.5f), Interpolations.Cubic(a, b, c, d, 0.5f)); Assert.AreEqual(new Point3(1.09375f, 0.953125f, 1.75f), Interpolations.Cubic(a, b, c, d, 0.75f)); Assert.AreEqual(c, Interpolations.Cubic(a, b, c, d, 1.0f)); }
public void TestCubicFloat1() { float a = 0.0f; float b = 1.0f; float c = 1.0f; float d = 0.0f; Assert.AreEqual(b, Interpolations.Cubic(a, b, c, d, 0.0f)); Assert.AreEqual(1.09375f, Interpolations.Cubic(a, b, c, d, 0.25f)); Assert.AreEqual(1.125f, Interpolations.Cubic(a, b, c, d, 0.5f)); Assert.AreEqual(1.09375f, Interpolations.Cubic(a, b, c, d, 0.75f)); Assert.AreEqual(c, Interpolations.Cubic(a, b, c, d, 1.0f)); }
public void TestCubicFloat2() { float a = 0.0f; float b = 1.0f; float c = 1.0f; float d = 2.0f; Assert.AreEqual(b, Interpolations.Cubic(a, b, c, d, 0.0f)); Assert.AreEqual(1.046875f, Interpolations.Cubic(a, b, c, d, 0.25f)); Assert.AreEqual(1.0f, Interpolations.Cubic(a, b, c, d, 0.5f)); Assert.AreEqual(0.953125f, Interpolations.Cubic(a, b, c, d, 0.75f)); Assert.AreEqual(c, Interpolations.Cubic(a, b, c, d, 1.0f)); }
private TrackingEntry GetDataCubicAtTime(int index, double time) { int[] quad = GetIndexQuadFromIndex(index); TrackingEntry entry1 = m_entries[quad[0]]; TrackingEntry entry2 = m_entries[quad[1]]; TrackingEntry entry3 = m_entries[quad[2]]; TrackingEntry entry4 = m_entries[quad[3]]; float t = NormalizeTimeAtRange(time, entry2.TimeStamp, entry3.TimeStamp); return(new TrackingEntry( time, Interpolations.Cubic(entry1.Position, entry2.Position, entry3.Position, entry4.Position, t), Interpolations.Cubic(entry1.Rotation, entry2.Rotation, entry3.Rotation, entry4.Rotation, t) )); }