Ejemplo n.º 1
0
    private void DrawNJLine()
    {
        Gizmos.color = Color.black;
        Vector3 prev = posList[0];

        for (float dist = 0; dist <= 1; dist += tDelta)
        {
            Vector3 next = BezierUtils.DrawNJBezierCurve(posList.ToArray(), dist);
            Gizmos.DrawLine(prev, next);
            prev = next;
        }

        Gizmos.DrawLine(prev, BezierUtils.DrawNJBezierCurve(posList.ToArray(), 1));
    }
Ejemplo n.º 2
0
    private void OnGUI()
    {
        if (GUI.Button(new Rect(50, 0, 100, 20), "测试1"))
        {
            //new CombinationUtils().test();
            Debug.Log(BezierUtils.Draw4JBezierCurve(posList[0], posList[1], posList[2], posList[3], 0.2f));
            Debug.Log(BezierUtils.DrawNJBezierCurve(posList.GetRange(0, 4).ToArray(), 0.2f));
            Debug.Log(BezierUtils.DrawCatmullRomByBezier(posList[0], posList[1], posList[2], posList[3], 0.2f));
            Debug.Log(BezierUtils.DrawCatmullRom(posList[0], posList[1], posList[2], posList[3], 0.2f));
        }
        if (GUI.Button(new Rect(50, 30, 100, 20), "测试2"))
        {
            new CombinationUtils().test2();
        }

        if (GUI.Button(new Rect(50, 60, 100, 20), "划线"))
        {
            LR.positionCount = 2;
            LR.SetPosition(0, posList[0]);
            LR.SetPosition(1, posList[posList.Count - 1]);
        }
    }