Example #1
0
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: virtual double FuncGrad(const Vector & x, Vector & grad) const
        public override double FuncGrad(Vector x, Vector grad)
        {
            Vec3d         n1    = new Vec3d();
            Vec3d         n2    = new Vec3d();
            Vec3d         v1    = new Vec3d();
            Vec3d         vgrad = new Vec3d();
            Point3d       pp1   = new Point3d();
            double        badness;
            VectorMem <3> freegrad;

            CalcNewPoint(x, ref pp1);


            badness = pf.PointFunctionValueGrad(pp1, ref freegrad);

            vgrad.X() = freegrad.Get(1);
            vgrad.Y() = freegrad.Get(2);
            vgrad.Z() = freegrad.Get(3);

            Vec <3> hn1, hn2;

            surf1.GetNormalVector(pp1, hn1);
            surf2.GetNormalVector(pp1, hn2);
            n1 = hn1;
            n2 = hn2;

            v1  = netgen.GlobalMembers.Cross(n1, n2);
            v1 /= v1.Length();

            grad.Elem(1) = (vgrad * v1) * (t1 * v1);
            return(badness);
        }
Example #2
0
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: virtual double FuncGrad(const Vector & x, Vector & grad) const
        public override double FuncGrad(Vector x, Vector grad)
        {
            Vec3d         n     = new Vec3d();
            Vec3d         vgrad = new Vec3d();
            Point3d       pp1   = new Point3d();
            VectorMem <3> freegrad;

            CalcNewPoint(x, ref pp1);

            double badness = pf.PointFunctionValueGrad(pp1, ref freegrad);

            vgrad.X() = freegrad.Get(1);
            vgrad.Y() = freegrad.Get(2);
            vgrad.Z() = freegrad.Get(3);

            Vec <3> hn;

            surf.GetNormalVector(pp1, hn);
            n = hn;

            vgrad -= (vgrad * n) * n;

            grad.Elem(1) = vgrad * t1;
            grad.Elem(2) = vgrad * t2;

            return(badness);
        }