public static FaceAngleEuler CalculateFaceAngle(CoordSys coordSys, bool withRelToCamera = true)
        {
            CameraSpacePoint transSide  = coordSys.Center.SubtractFrom(coordSys.Side);
            CameraSpacePoint transFront = coordSys.Center.SubtractFrom(coordSys.Front);
            CameraSpacePoint transTop   = coordSys.Center.SubtractFrom(coordSys.Top);


            CameraSpacePoint transSide2D  = transSide; transSide2D.Y = 0;
            CameraSpacePoint transFront2D = transFront; transFront2D.X = 0;
            CameraSpacePoint transTop2D   = transTop; transTop2D.Z = 0;


            transSide2D  = transSide2D.Norm();
            transFront2D = transFront2D.Norm();
            transTop2D   = transTop2D.Norm();

            FaceAngleEuler angles = new FaceAngleEuler()
            {
                R = (float)(Math.Asin(transTop2D.X) * 180 / Math.PI),
                Y = (float)(Math.Asin(transSide2D.Z) * 180 / Math.PI),
                P = (float)(Math.Asin(transFront2D.Y) * 180 / Math.PI)
            };

            return(angles);
        }
        public static FaceAngleEuler CalculateFaceAngleColor(CoordSys coordSys, CoordSys newCoord, CoordinateMapper mapper)
        {
            CameraSpacePoint transSide  = coordSys.Center.SubtractFrom(coordSys.Side);
            CameraSpacePoint transFront = coordSys.Center.SubtractFrom(coordSys.Front);
            CameraSpacePoint transTop   = coordSys.Center.SubtractFrom(coordSys.Top);

            CameraSpacePoint transSideN  = newCoord.Center.SubtractFrom(newCoord.Side);
            CameraSpacePoint transFrontN = newCoord.Center.SubtractFrom(newCoord.Front);
            CameraSpacePoint transTopN   = newCoord.Center.SubtractFrom(newCoord.Top);

            CameraSpacePoint transSide2D  = transSide; transSide2D.Y = 0;
            CameraSpacePoint transFront2D = transFront; transFront2D.X = 0;
            CameraSpacePoint transTop2D   = transTop; transTop2D.Z = 0;

            transSide2D  = transSide2D.Norm();
            transFront2D = transFront2D.Norm();
            transTop2D   = transTop2D.Norm();

            CameraSpacePoint transSideN2D  = transSideN; transSideN2D.Y = 0;
            CameraSpacePoint transFrontN2D = transFrontN; transFrontN2D.X = 0;
            CameraSpacePoint transTopN2D   = transTopN; transTopN2D.Z = 0;

            transSideN2D  = transSideN2D.Norm();
            transFrontN2D = transFrontN2D.Norm();
            transTopN2D   = transTopN2D.Norm();


            //FaceAngleEuler angles = new FaceAngleEuler()
            //{
            //    R = (float)(Math.Asin(transTop2D.X * transTopN2D.X) * 180 / Math.PI),
            //    Y = (float)(Math.Asin(transSide2D.Z * transSideN2D.Z) * 180 / Math.PI),
            //    P = (float)(Math.Asin(transFront2D.Y * transFrontN2D.Y) * 180 / Math.PI)
            //};



            FaceAngleEuler angles = new FaceAngleEuler()
            {
                R = (float)(Math.Acos(transTop2D.DotProduct(transTopN2D)) * 180 / Math.PI),
                Y = (float)(Math.Acos(transSide2D.DotProduct(transSideN2D)) * 180 / Math.PI),
                P = (float)(Math.Acos(transFront2D.DotProduct(transFrontN2D)) * 180 / Math.PI)
            };

            return(angles);
        }