Vector3D.Magnitude C# (CSharp) Метод

Magnitude() публичный статический Метод

public static Magnitude ( Vector3D, a ) : double
a Vector3D,
Результат double
    public static double Magnitude(Vector3D a)
    {
        return Math.Sqrt (Dot(a,a));
    }

Usage Example

Пример #1
0
        public void TestSphericalEarthSurface()
        {
            GroundCallback cb = new DefaultGroundCallback(RadiusReference, RadiusReference);

            Location loc, contact;
            Vector3D normal, v, w;
            Vector3D zero = new Vector3D(0.0, 0.0, 0.0);

            // Check that, for a point located, on the sea level radius the AGL is 0.0
            for (double lat = -90.0; lat <= 90.0; lat += 30.0)
            {
                for (double lon = 0.0; lon <= 360.0; lon += 45.0)
                {
                    double lon_rad = lon * Math.PI / 180.0;
                    double lat_rad = lat * Math.PI / 180.0;
                    loc = new Location(lon_rad, lat_rad, RadiusReference);
                    double agl = cb.GetAGLevel(loc, out contact, out normal, out v, out w);
                    Assert.AreEqual(0.0, agl, 1e-8);
                    AssertVectorEqual(v, zero);
                    AssertVectorEqual(w, zero);
                    Vector3D vLoc     = (Vector3D)loc;
                    Vector3D vContact = (Vector3D)contact;
                    Assert.AreEqual(vContact.Magnitude(), RadiusReference, tolerance);
                    Assert.AreEqual(vLoc.X, vContact.X, 1e-8);
                    Assert.AreEqual(vLoc.Y, vContact.Y, 1e-8);
                    Assert.AreEqual(vLoc.Z, vContact.Z, 1e-8);
                    Assert.AreEqual(normal.X, Math.Cos(lat_rad) * Math.Cos(lon_rad), tolerance);
                    Assert.AreEqual(normal.Y, Math.Cos(lat_rad) * Math.Sin(lon_rad), tolerance);
                    Assert.AreEqual(normal.Z, Math.Sin(lat_rad), tolerance);
                    vContact.Normalize();
                    AssertVectorEqual(vContact, normal);
                }
            }
        }
All Usage Examples Of Vector3D::Magnitude