Пример #1
0
 public Joints zeroJoints() => new Joints(
     dg.newZeroVectors(5),
     dg.newZeroVectors(5),
     dg.newZeroVectors(5),
     dg.newZeroVectors(5),
     dg.newZeroVectors(5),
     dg.newVector(),
     0
     );
Пример #2
0
    [Fact] public void MinMax()
    {
        Data_Generator dg = new Data_Generator();
        Hand_Generator hg = new Hand_Generator(dg);

        (Joints min, Joints max, Joints j)dat;
        dat.j   = hg.newJoints();
        dat.min = new Joints(dg.newMinVectors(5), dg.newMinVectors(5), dg.newMinVectors(5), dg.newMinVectors(5),
                             dg.newMinVectors(5), dg.newMinVector(), dg.newFloat(100));
        dat.max = new Joints(dg.newZeroVectors(5), dg.newZeroVectors(5), dg.newZeroVectors(5), dg.newZeroVectors(5),
                             dg.newZeroVectors(5), dg.newZeroVector(), dg.newFloat(100));

        (Joints min, Joints max)exp;
        exp.min = dat.min;
        exp.max = dat.j;

        var vH = new VectorHelper();
        var jH = new JointsHelper(vH);

        var act = jH.minMax(dat.min, dat.max, dat.j);

        test.jointsEqual(exp.min, act.min);
        test.jointsEqual(exp.max, act.max);
    }
Пример #3
0
    [Fact] public void PowList()
    {
        Data_Generator dg     = new Data_Generator();
        int            length = dg.newInt(100);
        float          f      = dg.newFloat(100);

        Vector[] v1  = dg.newVectors(length);
        Vector[] exp = dg.newZeroVectors(length);
        for (int i = 0; i < length; i++)
        {
            exp[i].x = (float)Math.Pow(v1[i].x, f);
            exp[i].y = (float)Math.Pow(v1[i].y, f);
            exp[i].z = (float)Math.Pow(v1[i].z, f);
        }
        VectorHelper v = new VectorHelper();

        Vector[] act = v.powList(v1, f);
        test.vectorsEqual(act, exp);
    }
Пример #4
0
    [Fact] public void AddList()
    {
        Data_Generator dg     = new Data_Generator();
        int            length = dg.newInt(100);

        Vector[] v1  = dg.newVectors(length);
        Vector[] v2  = dg.newVectors(length);
        Vector[] exp = dg.newZeroVectors(length);

        for (int i = 0; i < length; i++)
        {
            exp[i].x = v1[i].x + v2[i].x;
            exp[i].y = v1[i].y + v2[i].y;
            exp[i].z = v1[i].z + v2[i].z;
        }
        VectorHelper v = new VectorHelper();

        Vector[] act = v.addList(v1, v2);
        test.vectorsEqual(exp, act);
    }
Пример #5
0
    [Fact] public void MinMaxList()
    {
        var dg = new Data_Generator();
        //var dat_i = 0;
        var dat_len = dg.newInt(100);

        var dat_vA  = dg.newVectors(dat_len);
        var dat_min = dg.newMinVectors(dat_len);
        var dat_max = dg.newZeroVectors(dat_len);

        (Vector[] min, Vector[] max)exp = (new Vector[dat_len], new Vector[dat_len]);
        exp.min = dat_min;
        exp.max = dat_vA;

        var vh = new VectorHelper();

        (Vector[] min, Vector[] max)act = vh.minMaxList(dat_min, dat_max, dat_vA);

        test.vectorsEqual(exp.min, act.min);
        test.vectorsEqual(exp.max, act.max);
    }
Пример #6
0
    [Fact] public void DivList()
    {
        Data_Generator dg     = new Data_Generator();
        int            length = dg.newInt(100);

        Vector[] v1 = dg.newVectors(length);
        float    v2 = dg.newFloat(100);

        Vector[] exp = dg.newZeroVectors(length);

        for (int i = 0; i < length; i++)
        {
            exp[i].x = v1[i].x / v2;
            exp[i].y = v1[i].y / v2;
            exp[i].z = v1[i].z / v2;
        }
        VectorHelper v = new VectorHelper();

        Vector[] act = v.divList(v1, v2);
        test.vectorsEqual(exp, act);
    }