Ejemplo n.º 1
0
        internal double[,] GetBestMatrix(int f0, double[] p0, int f1, double[] p1)
        {
            // move from (f0,p0) to (f1,p1); point p is on the cell surface.
            PFace F0 = Faces[f0], F1 = Faces[f1];

            if (F0.Base.Id != F1.Base.Id)
            {
                return(null);
            }
            double[] q0    = PGeom.ApplyInvMatrix(F0.Matrix, p0);
            double[] q1    = PGeom.ApplyInvMatrix(F1.Matrix, p1);
            double   dbest = double.MaxValue;

            double[,] mr = null;
            foreach (double[,] m in F0.Base.SMatrices)
            {
                double[] qq = PGeom.ApplyMatrix(m, q0);
                double   v  = PGeom.Dist2(qq, q1);
                if (v < dbest)
                {
                    dbest = v; mr = m;
                }
            }
            return(PGeom.MatrixMulInv2(F0.Matrix, PGeom.MatrixMul(mr, F1.Matrix)));
        }
Ejemplo n.º 2
0
 private int FindAxisInv(double[] dir, double[,] matr)
 {
     dir = PGeom.ApplyInvMatrix(matr, dir);
     return(FindAxis(dir));
 }