示例#1
0
        // カーブ上の点を求める.
        public ControlVertex    calcVertex(float t)
        {
            ControlVertex cv = null;

            int segment_index = Mathf.FloorToInt(t);

            if (segment_index < 0)
            {
                cv = this.cvs[0];
            }
            else if (this.cvs.Count - 1 <= segment_index)
            {
                cv = this.cvs[this.cvs.Count - 1];
            }
            else
            {
                float[] pos_k = new float[4];
                float[] tan_k = new float[4];

                ControlVertex cv0 = this.cvs[segment_index];
                ControlVertex cv1 = this.cvs[segment_index + 1];

                float local_param = t - (float)segment_index;

                Curve.calc_konst(pos_k, tan_k, local_param);

                cv = Curve.lerp(cv0, cv1, pos_k, tan_k);
            }

            return(cv);
        }