Пример #1
0
    }     // End of ConstructControlPoints

    private void GenerateSpline(int n, List <Vector3> vertices)
    {
        int     ui;
        float   u;
        Vector3 v1;         // original Processing code includes a v0 that is never used

        v1 = Vector3.zero;

        if (n == 0)
        {
            splineSide1.Feval(0f, out v1);
        }
        else
        if (n == 1)
        {
            splineCenter.Feval(0f, out v1);
        }
        else
        {
            splineSide2.Feval(0f, out v1);
        }
        vertices.Add(new Vector3(v1.x, v1.y, v1.z));

        for (ui = 1; ui <= 10; ui++)
        {
            if (ui % uspacing == 0)
            {
                u = 0.1f * ui;

                if (n == 0)
                {
                    splineSide1.Feval(u, out v1);
                }
                else
                if (n == 1)
                {
                    splineCenter.Feval(u, out v1);
                }
                else
                {
                    splineSide2.Feval(u, out v1);
                }

                vertices.Add(new Vector3(v1.x, v1.y, v1.z));
            }
        }
    }     // End of GenerateSpline