Ejemplo n.º 1
0
        private void GenerateCosOnStepApperture(CVector i_a, CVector m_a, double delta) //i_a, m_a - двумерные вектора, связанные с плоскостью апертуры)
        {
            CVector[] VectorI  = new CVector[Count];
            CVector[] VectorM  = new CVector[Count];
            Point3D[] Segments = new Point3D[Count];
            double[]  Square   = new double[Count];

            double xlen = XMax - XMin;
            double ylen = YMax - YMin;
            double zlen = ZMax - ZMin;

            double Ra = 0;

            if (xlen >= ylen && xlen >= zlen)
            {
                Ra = xlen / 2;
            }
            else if (ylen >= zlen)
            {
                Ra = ylen / 2;
            }
            else
            {
                Ra = zlen / 2;
            }


            for (int p = 0; p < Count; p++)
            {
                Point3D position = this[p].Center;
                DVector n        = this[p].Norma;

                DVector ran = new DVector(1, 0, 0);
                if (DVector.IsEqual(n, ran, 4) || DVector.IsEqual((-1) * n, ran, 4))
                {
                    ran = new DVector(0, 1, 0);
                }
                //базисные вектора в плоскости апертуры
                DVector e_u = DVector.Cross(n, ran);
                e_u.Normalize();
                DVector e_v = DVector.Cross(n, e_u);
                e_v.Normalize();



                double  c1 = (1 + delta * Math.Cos(Math.PI * Point3D.Distance(position, this.Center) / Ra)) / (1 + delta);
                CVector i  = c1 * (i_a.X * e_u + i_a.Y * e_v);
                CVector m  = c1 * (m_a.X * e_u + m_a.Y * e_v);

                VectorI[p]  = i;
                VectorM[p]  = m;
                Segments[p] = this[p].Center;
                Square[p]   = this[p].Area;
            }

            ApertureCurrent = new Current(VectorI, VectorM, Segments, Square);
            //electricCurrent = new Current(VectorI, Segments);
            //magneticCurrent = new Current(VectorM, Segments);
        }
Ejemplo n.º 2
0
        public static double Scal(DVector v1, DVector v2)
        {
            double ans = 0;

            if (DVector.IsEqual(v1, v2, 9))
            {
                ans = 1;
            }
            else
            {
                ans = v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z;
            }
            return(ans);
        }
Ejemplo n.º 3
0
        public static double Scal(double ax, double ay, double az, double bx, double by, double bz)
        {
            double ans = 0;

            if (DVector.IsEqual(ax, ay, az, bx, by, bz, 9))
            {
                ans = 1;
            }
            else
            {
                ans = ax * bx + ay * by + az * bz;
            }
            return(ans);
        }
Ejemplo n.º 4
0
        public static DVector GetUVector(DVector n)
        {
            DVector ran = new DVector(1, 0, 0);

            if (DVector.IsEqual(n, ran, 4) || DVector.IsEqual((-1) * n, ran, 4))
            {
                ran = new DVector(0, 1, 0);
            }

            DVector e_u = DVector.Cross(n, ran);

            e_u.Normalize();
            return(e_u);
        }