Beispiel #1
0
        public Func <Vector4> DerivativeMiddle(UVDirection direction)
        {
            switch (direction)
            {
            case UVDirection.U0V01:
                return(() => Dv(0, 0.5f));

            case UVDirection.U0V10:
                return(() => Dv(0, 0.5f));

            case UVDirection.U1V01:
                return(() => Dv(1, 0.5f));

            case UVDirection.U1V10:
                return(() => Dv(1, 0.5f));

            case UVDirection.V0U01:
                return(() => Du(0.5f, 0));

            case UVDirection.V0U10:
                return(() => Du(0.5f, 0));

            case UVDirection.V1U01:
                return(() => Du(0.5f, 1));

            case UVDirection.V1U10:
                return(() => Du(0.5f, 1));
            }

            return(() => new Vector4());
        }
Beispiel #2
0
        public Tuple <Func <Vector4>, Func <Vector4> > GetSecondDerivativeFuncs
            (UVDirection direction, bool firstHalf)
        {
            switch (direction)
            {
            case UVDirection.U0V01:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 0), () => DuDv(0, 0.5f)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 0.5f), () => DuDv(0, 1)));
                }

            case UVDirection.U0V10:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 1), () => DuDv(0, 0.5f)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 0.5f), () => DuDv(0, 1)));
                }

            case UVDirection.U1V01:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 0), () => DuDv(0, 0.5f)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 0.5f), () => DuDv(1, 1)));
                }

            case UVDirection.U1V10:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 1), () => DuDv(1, 0.5f)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 0.5f), () => DuDv(1, 0)));
                }

            case UVDirection.V0U01:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 0), () => DuDv(0.5f, 0)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0.5f, 0), () => DuDv(1, 0)));
                }

            case UVDirection.V0U10:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 0), () => DuDv(0.5f, 0)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0.5f, 0), () => DuDv(0, 0)));
                }

            case UVDirection.V1U01:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0, 1), () => DuDv(0.5f, 1)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0.5f, 1), () => DuDv(1, 1)));
                }

            case UVDirection.V1U10:
                if (firstHalf)
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(1, 1), () => DuDv(0.5f, 1)));
                }
                else
                {
                    return(new Tuple <Func <Vector4>, Func <Vector4> >(() => DuDv(0.5f, 1), () => DuDv(0, 1)));
                }
            }

            return(new Tuple <Func <Vector4>, Func <Vector4> >(() => new Vector4(), () => new Vector4()));
        }
Beispiel #3
0
        public Func <float, Vector4> GetDerivativeFunc(UVDirection direction, bool firstHalf)
        {
            switch (direction)
            {
            case UVDirection.U0V01:
                if (firstHalf)
                {
                    return(f => Du(0, f / 2));
                }
                else
                {
                    return(f => Du(0, f / 2 + 0.5f));
                }

            case UVDirection.U0V10:
                if (firstHalf)
                {
                    return(f => Du(0, 1 - f / 2));
                }
                else
                {
                    return(f => Du(0, 0.5f - f / 2));
                }

            case UVDirection.U1V01:
                if (firstHalf)
                {
                    return(f => Du(1, f / 2));
                }
                else
                {
                    return(f => Du(1, f / 2 + 0.5f));
                }

            case UVDirection.U1V10:
                if (firstHalf)
                {
                    return(f => Du(1, 1 - f / 2));
                }
                else
                {
                    return(f => Du(1, 0.5f - f / 2));
                }

            case UVDirection.V0U01:
                if (firstHalf)
                {
                    return(f => Dv(f / 2, 0));
                }
                else
                {
                    return(f => Dv(0.5f + f / 2, 0));
                }

            case UVDirection.V0U10:
                if (firstHalf)
                {
                    return(f => Dv(1 - f / 2, 0));
                }
                else
                {
                    return(f => Dv(0.5f - f / 2, 0));
                }

            case UVDirection.V1U01:
                if (firstHalf)
                {
                    return(f => Dv(f / 2, 1));
                }
                else
                {
                    return(f => Dv(0.5f + f / 2, 1));
                }

            case UVDirection.V1U10:
                if (firstHalf)
                {
                    return(f => Dv(1 - f / 2, 1));
                }
                else
                {
                    return(f => Dv(0.5f - f / 2, 1));
                }
            }

            return(f => new Vector4());
        }