Ejemplo n.º 1
0
        /// <returns>true if the basis blade scales of A and B match. Blades which are not present in both A and B are ignored</returns>
        public static bool BasisBladeScalesMatch(MV A, MV B)
        {
            if (A == null)
            {
                Console.WriteLine("Arrr!");
            }
            if (B == null)
            {
                Console.WriteLine("Arrr!");
            }
            Dictionary <Tuple <int, int>, Tuple <int, int> > D = GetCoordMap(A, B);

            foreach (KeyValuePair <Tuple <int, int>, Tuple <int, int> > kvp in D)
            {
                BasisBlade a = A.Group(kvp.Key.Value1)[kvp.Key.Value2];
                BasisBlade b = B.Group(kvp.Value.Value1)[kvp.Value.Value2];

                if (a.scale != b.scale)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates a map. For each coordinate in 'src', tells you where it is found in 'dst',
        /// or that it is not present.
        /// </summary>
        /// <param name="src">Src multivector (can be SMV or GMV).</param>
        /// <param name="dst">Dst multivector (can be SMV or GMV).</param>
        /// <returns>The first entry of each pair is the group, the second entry is the entry.</returns>
        public static Dictionary <Tuple <int, int>, Tuple <int, int> > GetCoordMap(MV src, MV dst)
        {
            Dictionary <Tuple <int, int>, Tuple <int, int> > D = new Dictionary <Tuple <int, int>, Tuple <int, int> >();

            for (int g = 0; g < src.m_basisBlades.Length; g++)
            {
                for (int e = 0; e < src.m_basisBlades[g].Length; e++)
                {
                    RefGA.BasisBlade srcB = src.m_basisBlades[g][e];
                    int groupIdx          = dst.GetGroupIdx(srcB);
                    if (groupIdx >= 0)
                    {
                        int elementIdx = dst.GetElementIdx(srcB);
                        D[new Tuple <int, int>(g, e)] = new Tuple <int, int>(groupIdx, elementIdx);
                    }
                }
            }
            return(D);
        }
Ejemplo n.º 3
0
Archivo: mv.cs Proyecto: Sciumo/gaigen
 /// <summary>
 /// Generates a map. For each coordinate in 'src', tells you where it is found in 'dst',
 /// or that it is not present.
 /// </summary>
 /// <param name="src">Src multivector (can be SMV or GMV).</param>
 /// <param name="dst">Dst multivector (can be SMV or GMV).</param>
 /// <returns>The first entry of each pair is the group, the second entry is the entry.</returns>
 public static Dictionary<Tuple<int, int>, Tuple<int, int>> GetCoordMap(MV src, MV dst)
 {
     Dictionary<Tuple<int, int>, Tuple<int, int>> D = new Dictionary<Tuple<int, int>, Tuple<int, int>>();
     for (int g = 0; g < src.m_basisBlades.Length; g++)
     {
         for (int e = 0; e < src.m_basisBlades[g].Length; e++)
         {
             RefGA.BasisBlade srcB = src.m_basisBlades[g][e];
             int groupIdx = dst.GetGroupIdx(srcB);
             if (groupIdx >= 0)
             {
                 int elementIdx = dst.GetElementIdx(srcB);
                 D[new Tuple<int, int>(g, e)] = new Tuple<int, int>(groupIdx, elementIdx);
             }
         }
     }
     return D;
 }
Ejemplo n.º 4
0
Archivo: mv.cs Proyecto: Sciumo/gaigen
        /// <returns>true if the basis blade scales of A and B match. Blades which are not present in both A and B are ignored</returns>
        public static bool BasisBladeScalesMatch(MV A, MV B)
        {
            if (A == null)
            {
                Console.WriteLine("Arrr!");
            }
            if (B == null)
            {
                Console.WriteLine("Arrr!");
            }
            Dictionary<Tuple<int, int>, Tuple<int, int>> D = GetCoordMap(A, B);
            foreach (KeyValuePair<Tuple<int, int>, Tuple<int, int>> kvp in D)
            {
                BasisBlade a = A.Group(kvp.Key.Value1)[kvp.Key.Value2];
                BasisBlade b = B.Group(kvp.Value.Value1)[kvp.Value.Value2];

                if (a.scale != b.scale) return false;
            }

            return true;
        }