コード例 #1
0
        /// <summary>
        /// Get the VectorUv along the curve
        /// </summary>
        /// <param name="leftStart">The left most point</param>
        /// <param name="rightStart">The right most point</param>
        /// <param name="far">The far corner</param>
        /// <param name="percentage">The percentage along the line to get</param>
        /// <returns>The vectorUV point along the line</returns>
        private VectorUvs GetBezierCurvePoint(VectorUvs leftStart, VectorUvs rightStart, VectorUvs far, float percentage)
        {
            VectorUvs partA  = VectorUvs.Lerp(leftStart, far, percentage);
            VectorUvs partB  = VectorUvs.Lerp(far, rightStart, percentage);
            VectorUvs target = VectorUvs.Lerp(partA, partB, percentage);

            return(target);
        }
コード例 #2
0
        /// <summary>
        /// Creates a fan list from a smotherCornerContext
        /// </summary>
        /// <param name="scc">The smother corner context</param>
        /// <param name="startingPercent">The starting point along the first lines</param>
        /// <param name="sections">The number of sections to use</param>
        /// <returns>The list of tris, as a fan list</returns>
        protected List <VectorUvs> CreateFanfrom(SmotherCornerContext scc, float startingPercent, int sections)
        {
            List <VectorUvs> l = new List <VectorUvs>();

            // TODO: When starting percent is 0 - are we adding the first poly twice?
            l.Add(scc.Main);
            l.Add(scc.Leading);
            VectorUvs leftStartUV  = VectorUvs.Lerp(scc.Leading, scc.Far, startingPercent);
            VectorUvs rightStartUV = VectorUvs.Lerp(scc.Ending, scc.Far, startingPercent);

            l.Add(leftStartUV);

            float sectionsGap = 1.0f / sections;

            for (int i = 0; i < sections + 1; i++)
            {
                l.Add(GetBezierCurvePoint(leftStartUV, rightStartUV, scc.Far, (i * sectionsGap)));
            }

            l.Add(scc.Ending);
            return(l);
        }