Ejemplo n.º 1
0
        /// <summary>
        /// 初始化 匀速
        /// </summary>
        public BezierPath InitAverage()
        {
            if (paths == null || paths.Count == 0)
            {
                return(this);
            }

            if (isInitAverage)
            {
                return(this);
            }
            isInitAverage = true;

            Init();

            if (averagePath.points == null)
            {
                averagePath.points = new System.Collections.Generic.List <Vector3>();
            }
            else
            {
                averagePath.points.Clear();
            }

            int SmoothAmount = nodeCount * averageAccuracy;

            for (int i = 0; i <= SmoothAmount; i++)
            {
                float pm = (float)i / SmoothAmount;
                averagePath.points.Add(Get(pm));
            }

            averagePath.Reset();
            return(this);
        }