Exemple #1
0
        internal override VertexCollection GetVertices(PointF origin)
        {
            if (_cachedVerts != null)
            {
                return(_cachedVerts);
            }

            VertexCollection result = new VertexCollection()
            {
                Mode = BeginMode.LineStrip
            };

            float deltaValue = 1f / (float)Resolution;

            for (int i = 0; i < Resolution; i++)
            {
                float value = (float)i * deltaValue;

                PointF interpolated01 = P0.LerpTo(P1, value);
                PointF interpolated12 = P1.LerpTo(P2, value);
                PointF interpolated23 = P2.LerpTo(P3, value);

                PointF interpolated01_12 = interpolated01.LerpTo(interpolated12, value);
                PointF interpolated12_23 = interpolated12.LerpTo(interpolated23, value);

                PointF interpolatedFinal = interpolated01_12.LerpTo(interpolated12_23, value);
                result.Add(interpolatedFinal.Add(Position));
            }

            result = base.RotateVerts(result);

            _cachedVerts = result;
            return(_cachedVerts);
        }