Exemple #1
0
        /// <summary>sets this coordinates in 'arr'.
        /// </summary>
        /// <param name="gu">bitwise or of the GROUPs and GRADEs which are present in 'arr'.
        /// </param>
        /// <param name="arr">compressed coordinates.
        /// </param>
        public void Set(GroupBitmap gu, float[] arr)
        {
            AllocateGroups(gu);
            int idx = 0;

            if ((gu & GroupBitmap.GROUP_0) != 0)
            {
                for (int i = 0; i < 1; i++)
                {
                    m_c[0][i] = arr[idx + i];
                }
                idx += 1;
            }
            if ((gu & GroupBitmap.GROUP_1) != 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    m_c[1][i] = arr[idx + i];
                }
                idx += 5;
            }
            if ((gu & GroupBitmap.GROUP_2) != 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    m_c[2][i] = arr[idx + i];
                }
                idx += 10;
            }
            if ((gu & GroupBitmap.GROUP_3) != 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    m_c[3][i] = arr[idx + i];
                }
                idx += 10;
            }
            if ((gu & GroupBitmap.GROUP_4) != 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    m_c[4][i] = arr[idx + i];
                }
                idx += 5;
            }
            if ((gu & GroupBitmap.GROUP_5) != 0)
            {
                for (int i = 0; i < 1; i++)
                {
                    m_c[5][i] = arr[idx + i];
                }
                idx += 1;
            }
        }
Exemple #2
0
 /// <summary>
 /// Reserves memory for the groups specified by 'gu'.
 /// Keeps old memory (and values) when possible.
 /// </summary>
 private void AllocateGroups(GroupBitmap gu)
 {
     for (int i = 0; (1 << i) <= (int)gu; i++)
     {
         if (((1 << i) & (int)gu) != 0)
         {
             if (m_c[i] == null)
             {
                 m_c[i] = new float[c3ga.MvSize[1 << i]];
             }
         }
         else
         {
             m_c[i] = null;
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Constructs a new mv from compressed 'coordinates'.
 /// <param name="gu">bitwise OR of the GRADEs or GROUPs that are non-zero.</param>
 /// <param name="coordinates"> compressed coordinates.</param>
 /// </summary>
 public mv(GroupBitmap gu, float[] coordinates)
 {
     Set(gu, coordinates);
 }
Exemple #4
0
 /// <summary>sets this coordinates in 'arr'.
 /// </summary>
 /// <param name="gu">bitwise or of the GROUPs and GRADEs which are present in 'arr'.
 /// </param>
 /// <param name="arr">compressed coordinates.
 /// </param>
 public void Set(GroupBitmap gu, float[] arr)
 {
     AllocateGroups(gu);
     int idx = 0;
     if ((gu & GroupBitmap.GROUP_0) != 0) {
     for (int i = 0; i < 1; i++)
         m_c[0][i] = arr[idx + i];
     idx += 1;
     }
     if ((gu & GroupBitmap.GROUP_1) != 0) {
     for (int i = 0; i < 5; i++)
         m_c[1][i] = arr[idx + i];
     idx += 5;
     }
     if ((gu & GroupBitmap.GROUP_2) != 0) {
     for (int i = 0; i < 10; i++)
         m_c[2][i] = arr[idx + i];
     idx += 10;
     }
     if ((gu & GroupBitmap.GROUP_3) != 0) {
     for (int i = 0; i < 10; i++)
         m_c[3][i] = arr[idx + i];
     idx += 10;
     }
     if ((gu & GroupBitmap.GROUP_4) != 0) {
     for (int i = 0; i < 5; i++)
         m_c[4][i] = arr[idx + i];
     idx += 5;
     }
     if ((gu & GroupBitmap.GROUP_5) != 0) {
     for (int i = 0; i < 1; i++)
         m_c[5][i] = arr[idx + i];
     idx += 1;
     }
 }
Exemple #5
0
 /// <summary>shortcut to c3ga.extractGrade(this, groupBitmap)
 /// </summary>
 public mv extractGrade(GroupBitmap groupBitmap)
 {
     return c3ga.extractGrade(this, groupBitmap);
 }
Exemple #6
0
 /// <summary>
 /// Reserves memory for the groups specified by 'gu'.
 /// Keeps old memory (and values) when possible.
 /// </summary>
 private void AllocateGroups(GroupBitmap gu)
 {
     for (int i = 0; (1 << i) <= (int)gu; i++) {
     if (((1 << i) & (int)gu) != 0) {
         if (m_c[i] == null)
             m_c[i] = new float[c3ga.MvSize[1 << i]];
     }
     else m_c[i] = null;
     }
 }
Exemple #7
0
        /// <summary>Returns grade groupBitmap of  mv.
        /// </summary>
        public static mv extractGrade(mv_if a, GroupBitmap groupBitmap)
        {
            GroupBitmap gu = a.to_mv().gu() & groupBitmap;
            float[][] ac = a.to_mv().c();
            float[][] cc = new float[6][];

            if ((gu & GroupBitmap.GROUP_0) != 0) {
            cc[0] = new float[1];
            copyGroup_0(ac[0], cc[0]);
            }

            if ((gu & GroupBitmap.GROUP_1) != 0) {
            cc[1] = new float[5];
            copyGroup_1(ac[1], cc[1]);
            }

            if ((gu & GroupBitmap.GROUP_2) != 0) {
            cc[2] = new float[10];
            copyGroup_2(ac[2], cc[2]);
            }

            if ((gu & GroupBitmap.GROUP_3) != 0) {
            cc[3] = new float[10];
            copyGroup_3(ac[3], cc[3]);
            }

            if ((gu & GroupBitmap.GROUP_4) != 0) {
            cc[4] = new float[5];
            copyGroup_4(ac[4], cc[4]);
            }

            if ((gu & GroupBitmap.GROUP_5) != 0) {
            cc[5] = new float[1];
            copyGroup_5(ac[5], cc[5]);
            }
            return new mv(cc);
        }
Exemple #8
0
 /// <summary>
 /// Constructs a new mv from compressed 'coordinates'.
 /// <param name="gu">bitwise OR of the GRADEs or GROUPs that are non-zero.</param>
 /// <param name="coordinates"> compressed coordinates.</param>
 /// </summary>
 public mv(GroupBitmap gu, float[] coordinates)
 {
     Set(gu, coordinates);
 }
Exemple #9
0
 /// <summary>shortcut to c3ga.extractGrade(this, groupBitmap)
 /// </summary>
 public mv extractGrade(GroupBitmap groupBitmap)
 {
     return(c3ga.extractGrade(this, groupBitmap));
 }