示例#1
0
        public Surface(VectorFunction r)
        {
            this.r = r;

            List<CommonFunction> components = r.components;
            List<DefinedCommonFunction> derivativesU = new List<DefinedCommonFunction>();
            List<DefinedCommonFunction> derivativesV = new List<DefinedCommonFunction>();
            NumericalDerivative derivative = new NumericalDerivative();
            derivativesU.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[0].getCommonFunction(), 0, 1)));
            derivativesV.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[0].getCommonFunction(), 1, 1)));
            derivativesU.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[1].getCommonFunction(), 0, 1)));
            derivativesV.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[1].getCommonFunction(), 1, 1)));
            derivativesU.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[2].getCommonFunction(), 0, 1)));
            derivativesV.Add(new DefinedCommonFunction(derivative.CreatePartialDerivativeFunctionHandle(components[2].getCommonFunction(), 1, 1)));

            VectorFunction v1 = new VectorFunction(derivativesU);
            VectorFunction v2 = new VectorFunction(derivativesV);

            VectorFunction normalLength = new Vector3Mul(v1, v2);
            CommonFunction length = new Length(normalLength);

            List<bool> normalPow = new List<bool>();
            normalPow.Add(true); normalPow.Add(false);

            List<CommonFunction> normalx = new List<CommonFunction>();
            normalx.Add(normalLength.components[0]); normalx.Add(length);

            List<CommonFunction> normaly = new List<CommonFunction>();
            normaly.Add(normalLength.components[1]); normaly.Add(length);

            List<CommonFunction> normalz = new List<CommonFunction>();
            normalz.Add(normalLength.components[2]); normalz.Add(length);

            List<CommonFunction> normalCoordinates = new List<CommonFunction>();
            normalCoordinates.Add(new Mul(normalx, normalPow));
            normalCoordinates.Add(new Mul(normaly, normalPow));
            normalCoordinates.Add(new Mul(normalz, normalPow));

            normal = new VectorFunction(normalCoordinates);
        }
示例#2
0
 public Length(VectorFunction arg)
 {
     this.arg = arg;
 }