示例#1
0
        public static Mat4 RotToYZ(Vec4 p, MatrixLayout layout = MatrixLayout.Default)
        {
            E _2         = E.NumConst(2);
            E projPxyLen = E.Sqrt(E.Sum(E.Pow(p.x, _2),
                                        E.Pow(p.y, _2)));
            E cosA = E.Div(p.x, projPxyLen);
            E sinA = E.Div(p.y, projPxyLen);

            return(RotZ(cosA, sinA, layout));
        }
示例#2
0
        public static Mat4 RotToZ(Vec4 p, MatrixLayout layout = MatrixLayout.Default)
        {
            Mat4 rotToYZ = RotToYZ(p, layout);
            E    _2      = E.NumConst(2);
            E    vLen    = E.Sqrt(E.Sum(E.Pow(p.x, _2),
                                        E.Pow(p.y, _2),
                                        E.Pow(p.z, _2)));
            E projPxyLen = E.Sqrt(E.Sum(E.Pow(p.x, _2),
                                        E.Pow(p.y, _2)));
            E cosA = E.Div(p.z, vLen);
            E sinA = E.Div(projPxyLen, vLen);

            return((rotToYZ * RotX(cosA, sinA, layout)).Evaluate());
        }