示例#1
0
        /// <summary>
        /// Uniform vector inside the open unit sphere (i.e. no vector
        /// ends on the surface of the sphere).
        /// </summary>
        public static V3d UniformV3dOpenSphere(this IRandomUniform rnd)
        {
            double r2;
            V3d    p;

            do
            {
                p  = (rnd.UniformV3dOpen() + c_shift) * 2.0;
                r2 = p.LengthSquared;
            }while (r2 >= 1.0);
            return(p);
        }