public static void CrossAxesX(PhysicalVector3 nml, ref PhysicalVector3 xi, ref PhysicalVector3 eta) { double nn = nml.L2norm(); double n0 = nml[0] / nn, n1 = nml[1] / nn, n2 = nml[2] / nn; double scaling = 1.0 / (1.0 + n0); xi.Set(-n1, 1 - n1 * n1 * scaling, -n1 * n2 * scaling); eta.Set(-n2, -n1 * n2 * scaling, 1 - n2 * n2 * scaling); }
// Consistently find orthonormal unit vectors <xi,eta> // in the plane defined by normal nml // by rotating <i,j,k> into <xi,eta,nml> public static void CrossAxesZ(PhysicalVector3 nml, ref PhysicalVector3 xi, ref PhysicalVector3 eta) { float nn = nml.L2norm(); float n0 = nml[0] / nn, n1 = nml[1] / nn, n2 = nml[2] / nn; float scaling = 1.0 / (1.0 + n2); xi.Set(1 - n0 * n0 * scaling, -n0 * n1 * scaling, -n0); eta.Set(-n0 * n1 * scaling, 1 - n1 * n1 * scaling, -n1); }