Example #1
0
        /// <summary>
        /// Returns a random point inside a circle.
        /// The Y component is always 0.0.
        /// </summary>
        /// <param name="distance">
        /// This distance from the center of the circle to the point.
        /// </param>
        /// <returns>
        /// The random vector.
        /// </returns>
        public static Vector3 Vector3XZ(float distance)
        {
            var vector = RandomEx.Vector3XZ();

            vector *= distance;
            return(vector);
        }
Example #2
0
        /// <summary>
        /// Returns a random position around the specified center <paramref name="position"/>.
        ///
        /// The Y component of the random position will always be the same as the center position.
        /// </summary>
        /// <param name="position">
        /// The center position to generate a random position around.
        /// </param>
        /// <param name="distance">
        /// The distance from the center position to the generated random position.
        /// </param>
        /// <returns>
        /// The generated random position.
        /// </returns>
        /// <example>
        /// public void Example()
        /// {
        ///     var center = Vector3(100.0f, 100.0f, 100.0f);
        ///     var around = center.Around(20.0f);
        /// }
        /// </example>
        public static Vector3 Around(this Vector3 position, float distance)
        {
            var vector = RandomEx.Vector3XZ() * distance + position;

            return(vector);
        }