Exemplo n.º 1
0
        private static List <TVertex> RecurseSmoothLine <TVertex>(List <TVertex> vv, CatmullCurve <TVertex> cc, float t1, float t2, TVertex vt1, TVertex vt2, float accuracy) where TVertex : IRenderVertex
        {
            var tMid = (t1 + t2) * 0.5f;

            var vMid = cc.GetPointAt(tMid);

            vMid.Smooth         = true;     // Generated points must always be smooth, because they are part of the curve
            vMid.IsSlingshot    = false;    // Slingshots can"t be along curves
            vMid.IsControlPoint = false;    // We created this point, so it can"t be a control point

            if (FlatWithAccuracy(vt1, vt2, vMid, accuracy))
            {
                // Add first segment point to array.
                // Last point never gets added by this recursive loop,
                // but that"s where it wraps around to the next curve.
                vv.Add(vt1);
            }
            else
            {
                vv = RecurseSmoothLine(vv, cc, t1, tMid, vt1, vMid, accuracy);
                vv = RecurseSmoothLine(vv, cc, tMid, t2, vMid, vt2, accuracy);
            }
            return(vv);
        }