Пример #1
0
        /// <summary>
        /// Create a derived frame system where the derived frame is the reciprocal of the base frame
        /// </summary>
        /// <param name="baseFrame"></param>
        /// <returns></returns>
        public static DerivedFrameSystem CreateReciprocalCbmFrameSystem(GaFrame baseFrame)
        {
            if (baseFrame.IsOrthogonal)
            {
                var cbmat = baseFrame.Ipm.Inverse();

                var b2DOm = GaOuterMorphismFull.Create(baseFrame.Ipm);
                var d2BOm = GaOuterMorphismFull.Create(cbmat);

                var derivedFrame = CreateOrthogonal(cbmat.GetDiagonal());
                return(new DerivedFrameSystem(baseFrame, derivedFrame, d2BOm, b2DOm));
            }

            var cbmArray = new MathematicaScalar[baseFrame.VSpaceDimension, baseFrame.VSpaceDimension];

            var mv2 = baseFrame.CreateInverseUnitPseudoScalar();

            for (var i = 0; i < baseFrame.VSpaceDimension; i++)
            {
                var id  = (1 << i) ^ baseFrame.MaxBasisBladeId;
                var mv1 = GaMultivector.CreateTerm(baseFrame.GaSpaceDimension, id, SymbolicUtils.Constants.One);

                var mv = baseFrame.Lcp(mv1, mv2);

                foreach (var term in mv)
                {
                    var j = term.Key.BasisBladeIndex();

                    if ((i & 1) == 1)
                    {
                        cbmArray[i, j] = term.Value;
                    }
                    else
                    {
                        cbmArray[i, j] = -term.Value;
                    }
                }
            }

            var cbm = MathematicaMatrix.CreateFullMatrix(SymbolicUtils.Cas, cbmArray);

            return(CreateDerivedCbmFrameSystem(baseFrame, cbm));
        }
Пример #2
0
 public GaMultivector CreateInverseUnitPseudoScalar()
 {
     //TODO: Review this computation
     return(GaMultivector.CreateTerm(GaSpaceDimension, MaxBasisBladeId, UnitPseudoScalarCoef));
 }
Пример #3
0
        internal static GMacValueMultivector CreateTerm(GMacFrameMultivector mvType, int id, MathematicaScalar coef)
        {
            var mvCoefs = GaMultivector.CreateTerm(mvType.ParentFrame.GaSpaceDimension, id, coef);

            return(new GMacValueMultivector(mvType, mvCoefs));
        }