Пример #1
0
        public static void GetSphericalDistribution(
            out float xAngle,
            out float yAngle,
            ref Random32 random)
        {
            yAngle = random.GetFloat(-Mathf.PI, Mathf.PI);
            var r = random.GetFloat();

            xAngle = Mathf.Asin((2f * r) - 1f);
        }
Пример #2
0
        public static void GetHemisphericalDistribution(
            out float xAngle,
            out float yAngle,
            ref Random32 random)
        {
            yAngle = random.GetFloat(-Mathf.PI, Mathf.PI);
            var r = random.GetFloat();

            xAngle = Mathf.Acos(r);
        }
Пример #3
0
        public static void GetHemisphericalCosPoweredDistribution(
            out float xAngle,
            out float yAngle,
            float power,
            ref Random32 random)
        {
            yAngle = random.GetFloat(-Mathf.PI, Mathf.PI);
            var r       = random.GetFloat();
            var powered = Mathf.Pow(r, 1f / (power + 1f));

            xAngle = Mathf.Acos(powered);
        }