public void ToVector_Test() { var a = new SpaceAngle(0, 0, AngleType.Deg); var v = a.DirectionalVector; Assert.AreEqual(new Vector3D(0, 0, 1), v); }
public void Create_Test() { var angle = new SpaceAngle(); Assert.AreEqual(0d, angle.Theta); Assert.AreEqual(0d, angle.Phi); }
//Action<double, SpaceAngle> testRA = //(r, a) => //{ // var v = new Vector3D(r, a); // Assert.AreEqual(r, v.R, 1e-15, "{0}.R = {1} != {2} = r", v, v.R, r); // Assert.AreEqual(a, v.Angle, "{0}.a = {1}[π] != {2}[π] = r", v, v.Angle / pi, a / pi); //}; static void TestXYZ(double r, SpaceAngle a, double x, double y, double z) { //testRA(r, a); var v = new Vector3D(r, a); Assert.AreEqual(x, v.X, 2e-16, "\r\n{0}.X = {1} != {2} = x", v, v.X, x); Assert.AreEqual(y, v.Y, 2e-16, "\r\n{0}.Y = {1} != {2} = x", v, v.Y, y); Assert.AreEqual(z, v.Z, 2e-16, "\r\n{0}.Z = {1} != {2} = x", v, v.Z, z); }
/// <summary>Метод инициализации элементов решётки</summary> /// <param name="Nx">Число элементов по оси X</param> /// <param name="Ny">Число элементов по оси Y</param> /// <param name="dx">Шаг между элементами по оси X</param> /// <param name="dy">Шаг между элементами по оси Y</param> /// <param name="Element">Антенный элемент</param> /// <param name="Distribution">Распределение</param> /// <returns>Перечисление антенных элементов решётки</returns> private static IEnumerable <AntennaItem> Initialize(int Nx, int Ny, double dx, double dy, Antenna Element, Distribution Distribution) { var Lx = (Nx - 1) * dx; var Ly = (Ny - 1) * dy; var x0 = Lx / 2; var y0 = Ly / 2; var angle = new SpaceAngle(); for (var ix = 0; ix < Nx; ix++) { for (var iy = 0; iy < Ny; iy++) { var x = ix * dx - x0; var y = iy * dy - y0; var k = Distribution(x, y); yield return(new AntennaItem(Element, new Vector3D(x, y), angle, k)); } } }
static void AreEqual(Vector3D v, SpaceAngle a) { Assert.AreEqual(v, a.DirectionalVector); Assert.AreEqual(v.Angle, a); }
/// <inheritdoc /> public override Complex Pattern(SpaceAngle Direction, double f) => Math.Cos(Direction.ThetaRad);
/// <summary>Диаграмма направленности</summary> /// <param name="Direction">пространственное направление</param> /// <param name="f">Частота</param> /// <returns>Значение диаграммы направленности в указанном направлении</returns> public abstract Complex Pattern(SpaceAngle Direction, double f);
/// <inheritdoc /> public override Complex Pattern(SpaceAngle Direction, double f) { var v = Math.Cos(Direction.ThetaRad); return(v * v); }
public override Complex Pattern(SpaceAngle Direction, double f) => Complex.Real;