IsNearBezier() public static method

public static IsNearBezier ( Vector2 p, BezierPoint point1, BezierPoint point2, float rad ) : bool
p Vector2
point1 BezierPoint
point2 BezierPoint
rad float
return bool
示例#1
0
    public void test()
    {
        float startTime = Time.realtimeSinceStartup;
        float w         = 100;
        float h         = 100;

        Drawing.BezierPoint p1 = new Drawing.BezierPoint(new Vector2(10, 0), new Vector2(5, 20), new Vector2(20, 0));
        Drawing.BezierPoint p2 = new Drawing.BezierPoint(new Vector2(50, 10), new Vector2(40, 20), new Vector2(60, -10));
        Drawing.BezierCurve c  = new Drawing.BezierCurve(p1.main, p1.control2, p2.control1, p2.main);
        p1.curve2 = c;
        p2.curve1 = c;
        Vector2 elapsedTime = new Vector2((Time.realtimeSinceStartup - startTime) * 10, 0);
        float   startTime2  = Time.realtimeSinceStartup;

        for (int i = 0; i < w * h; i++)
        {
            Mathfx.IsNearBezier(new Vector2(Random.value * 80, Random.value * 30), p1, p2, 10);
        }

        Vector2 elapsedTime2 = new Vector2((Time.realtimeSinceStartup - startTime2) * 10, 0);

        Debug.Log("Drawing took " + elapsedTime.ToString() + "  " + elapsedTime2.ToString());
    }