Exemplo n.º 1
0
        /// <summary>
        /// Uniform vector in the closed unit sphere (i.e vectors to
        /// the surface of the sphere may be generated).
        /// </summary>
        public static V3d UniformV3dClosedSphere(this IRandomUniform rnd)
        {
            double r2;
            V3d    p;

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