Example #1
0
    public void MoveTowards()
    {
        for (int i = 0; i < count; i++)
        {
            float ax, ay, az, aw;
            float bx, by, bz, bw;
            float p = UnityEngine.Random.Range(-20F, 20F);

            ax = UnityEngine.Random.Range(-10F, 10F);
            ay = UnityEngine.Random.Range(-10F, 10F);
            az = UnityEngine.Random.Range(-10F, 10F);
            aw = UnityEngine.Random.Range(-10F, 10F);

            bx = UnityEngine.Random.Range(-10F, 10F);
            by = UnityEngine.Random.Range(-10F, 10F);
            bz = UnityEngine.Random.Range(-10F, 10F);
            bw = UnityEngine.Random.Range(-10F, 10F);

            Vector4 a = new Vector4(ax, ay, az, aw);
            Vector4 b = new Vector4(bx, by, bz, bw);

            Vector4d ad = new Vector4d(ax, ay, az, aw);
            Vector4d bd = new Vector4d(bx, by, bz, bw);

            Vector4  value  = Vector4.MoveTowards(a, b, p);
            Vector4d valued = Vector4d.MoveTowards(ad, bd, p);

            Assert.True(Approximate(value, valued));
        }
    }