Пример #1
0
    public void TRS()
    {
        for (int i = 0; i < count; i++)
        {
            float ax, ay, az;
            float bx, by, bz;
            float cx, cy, cz;

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

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

            cx = UnityEngine.Random.Range(-10F, 10F);
            cy = UnityEngine.Random.Range(-10F, 10F);
            cz = UnityEngine.Random.Range(-10F, 10F);

            Matrix4x4  value  = Matrix4x4.TRS(new Vector3(ax, ay, az), Quaternion.Euler(new Vector3(bx, by, bz)), new Vector3(cx, cy, cz));
            Matrix4x4d valued = Matrix4x4d.TRS(new Vector3d(ax, ay, az), Quaterniond.Euler(new Vector3d(bx, by, bz)), new Vector3d(cx, cy, cz));

            Assert.True(Approximate(value, valued));
        }
    }
Пример #2
0
    private void RandomQuaternion(ref Quaternion quat, ref Quaterniond quatd)
    {
        float ax, ay, az;

        ax = UnityEngine.Random.Range(0, 360F);
        ay = UnityEngine.Random.Range(0, 360F);
        az = UnityEngine.Random.Range(0, 360F);

        quat  = Quaternion.Euler(new Vector3(ax, ay, az));
        quatd = Quaterniond.Euler(new Vector3d(ax, ay, az));
    }
Пример #3
0
    public void Euler()
    {
        for (int i = 0; i < count; i++)
        {
            float ax, ay, az;

            ax = UnityEngine.Random.Range(0, 360F);
            ay = UnityEngine.Random.Range(0, 360F);
            az = UnityEngine.Random.Range(0, 360F);

            Quaternion  value  = Quaternion.Euler(new Vector3(ax, ay, az));
            Quaterniond valued = Quaterniond.Euler(new Vector3d(ax, ay, az));

            Assert.True(Approximate(value, valued));
        }
    }
Пример #4
0
    void Start()
    {
        SoI = Mathd.Sqrt(Gravity.G * mass / .0001);

        double s = 1.41421356237 * radius;

        Vector3d[] v = new Vector3d[] {
            Vector3d.up,
            Vector3d.down,
            Vector3d.left,
            Vector3d.right,
            Vector3d.forward,
            Vector3d.back
        };
        Quaterniond[] q = new Quaterniond[] {
            Quaterniond.Euler(0, 0, 0),
            Quaterniond.Euler(180, 0, 0),
            Quaterniond.Euler(0, 0, 90),
            Quaterniond.Euler(0, 0, -90),
            Quaterniond.Euler(90, 0, 0),
            Quaterniond.Euler(-90, 0, 0)
        };

        groundNodes = new QuadNode[6];
        if (hasWater)
        {
            waterNodes = new QuadNode[6];
        }

        for (int i = 0; i < 6; i++)
        {
            groundNodes[i] = new QuadNode(this, QuadNode.SurfaceType.Ground, 0, s, 0, null, s * .5 * v[i], q[i]);
            if (hasWater)
            {
                waterNodes[i] = new QuadNode(this, QuadNode.SurfaceType.Water, 0, s, 0, null, s * .5 * v[i], q[i]);
            }
        }

        simplex = new Simplex()
        {
            seed = seed
        };

        InitPropertyBlock();

        started = true;
    }