Exemplo n.º 1
0
    public Vector3 GetPoint(float t)
    {
        int num  = linearPoints.Length - ((!spline.closed) ? 3 : 0);
        int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1);
        int num3 = linearPoints.Length;

        if (num2 < 0)
        {
            num2 += num3;
        }
        float   u = t * (float)num - (float)num2;
        Vector3 a = linearPoints[num2 % num3];
        Vector3 b = linearPoints[(num2 + 1) % num3];
        Vector3 c = linearPoints[(num2 + 2) % num3];
        Vector3 d = linearPoints[(num2 + 3) % num3];

        return(SplineComponent.Interpolate(a, b, c, d, u));
    }
Exemplo n.º 2
0
    public Vector3 GetPoint(float t)
    {
        var sections = linearPoints.Length - (spline.closed ? 0 : 3);
        var i        = Mathf.Min(Mathf.FloorToInt(t * (float)sections), sections - 1);
        var count    = linearPoints.Length;

        if (i < 0)
        {
            i += count;
        }
        var u = t * (float)sections - (float)i;
        var a = linearPoints[(i + 0) % count];
        var b = linearPoints[(i + 1) % count];
        var c = linearPoints[(i + 2) % count];
        var d = linearPoints[(i + 3) % count];

        return(SplineComponent.Interpolate(a, b, c, d, u));
    }
Exemplo n.º 3
0
    public Vector3 GetPoint(float t)            //takes a float & converts it into an int, why not just take an int?
    {
        int sections = linearPoints.Length - 3; //should never be closed, if I f****d up, swap 3 with 0
        int i        = Mathf.Min(Mathf.FloorToInt(t * (float)sections), sections - 1);
        int count    = linearPoints.Length;

        if (i < 0)
        {
            i += count;
        }
        float   u = t * sections - i;              //Interpolation Position (?)
        Vector3 a = linearPoints[(i + 0) % count]; //Control Point (?)
        Vector3 b = linearPoints[(i + 1) % count]; //Control Point (?)
        Vector3 c = linearPoints[(i + 2) % count]; //Start Point (?)
        Vector3 d = linearPoints[(i + 3) % count]; //End Point (?)

        return(SplineComponent.Interpolate(a, b, c, d, u));
    }