예제 #1
0
    public void Distance()
    {
        for (int i = 0; i < count; i++)
        {
            float ax, ay, az, aw;
            float bx, by, bz, bw;

            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);

            float  value  = Vector4.Distance(a, b);
            double valued = Vector4d.Distance(ad, bd);

            Assert.True(Approximate(value, valued));
        }
    }
예제 #2
0
 /// <summary>Get the closest distance between this <see cref="Box4d"/> and the <see cref="Vector4d"/>.</summary>
 public Double Distance( ref  Vector4d point)
 {
     Vector4d nearest;
         NearestPointTo(ref point, out nearest);
         return point.Distance(ref nearest);
 }