BezierCurve.Get C# (CSharp) Method

Get() public method

public Get ( float t ) : Vector2
t float
return Vector2
    public Vector2 Get(float t)
    {
        int t2 = (int)Mathf.Round(t * (points.Length - 1));
        return points[t2];
    }

Usage Example

Example #1
0
    public static bool IsNearBezierTest(Vector2 p, BezierCurve c, float accuracy, float maxDist)
    {
        Vector2 prepoint = c.Get(0);

        for (float i = accuracy; i < 1; i += accuracy)
        {
            var   point = c.Get(i);
            float d     = (p - point).sqrMagnitude;
            float d2    = (prepoint - point + new Vector2(maxDist, maxDist)).sqrMagnitude;
            if (d <= d2 * 2)
            {
                return(true);
            }
        }

        return(false);
    }
All Usage Examples Of BezierCurve::Get