public void writeWithGuideBack(CPNSideEdge guide, int N, float step, OutputMesh mesh,
                                       CPNGuideEvaluator evaluator)
        {
            this.step = step;
            requestSize(N + 1);

            //We should have only one thickness on multisided edge, you know?
            this.thickness = 1;

            for (int i = 0; i <= N; i++)
            {
                //This is the eval-back
                evaluator.EvalAt(1.0f - i * step, guide);
                Vector3 dev = evaluator.EvalDev(guide);
                vertices[i] = evaluator.EvalVertex(guide);
                if (i == 0)
                {
                    devFirst = dev;
                }
                if (i == N)
                {
                    devLast = dev;
                }
                evaluator.EvalAt(i * step + DELTA, guide);
                verticesDplus[i] = evaluator.EvalVertex(guide);
                evaluator.EvalAt(i * step - DELTA, guide);
                verticesDminus[i] = evaluator.EvalVertex(guide);
                normals[i]        = evaluator.EvalNormal(guide, dev).normalized;
                uvs[i]            = evaluator.EvalUV(guide);
                for (int k = 0; k < countP; k++)
                {
                    properties[k][i] = evaluator.EvalProperty(guide, k);
                }
            }
        }
        public Vector3 evalUV(int sIndex, CPNSideEdge sidedEdge, float t)
        {
            int backSIndex = prev.N - sIndex;

            evaluator.EvalAt(t, sidedEdge);
            Vector3 A = evaluator.EvalUV(sidedEdge);
            Vector3 B = prev.uvs[backSIndex];
            Vector3 C = next.uvs[sIndex];

            Vector3 A0 = buffer.uvs[0];
            Vector3 AN = buffer.uvs[buffer.N];


            float sB = 1 - prev.ts[backSIndex];
            float sC = prev.ts[sIndex];
            float s  = (1 - t) * sB + t * sC;

            float size = (1 - s) * (1 - s) * (1 - s) /* * s0[==1] */ +
                         (s1 * (1 - s) * (1 - s) + s2 * s * (1 - s) + s3 * s * s) * s;
            //float sB = 1 - prev.ts[backSIndex];
            //float sC = prev.ts[sIndex];
            //float s = (1 - t) * sB + t * sC;

            Vector3 At = (1 - t) * A0 + t * AN;
            //Vector3 PA = A - At;
            Vector3 PA  = (A - At) * size;
            Vector3 PBC = (1 - t) * B + t * C;

            return(PA + PBC);

            //return A + (1 - t) * (B - A0) + t * (C - AN);
        }
        private Vector3 evalUV(CPNSideEdge sidedEdgeA,
                               CPNSideEdge sidedEdgeB, float U, float V)
        {
            //int backBIndex = bufferPrev.N - Bindex;

            evaluator.EvalAt(0, sidedEdgeA);
            Vector3 v0 = evaluator.EvalUV(sidedEdgeA);

            evaluator.EvalAt(U, sidedEdgeA);
            Vector3 vA = evaluator.EvalUV(sidedEdgeA);

            evaluator.EvalAt(1 - V, sidedEdgeB);
            Vector3 vB = evaluator.EvalUV(sidedEdgeB);

            evaluator.EvalAt(1, sidedEdgeB);

            return(vB + vA - v0);
        }