Exemplo n.º 1
0
        public void TestTranslateAlongYAxisNoTranslation()
        {
            Vector3D expected = new Vector3D(5, 5, 5);
            Vector3D actual   = VectorManipulation.TranslateAlongYAxis(new Vector3D(5, 5, 5), 0);

            VectorAssert.AreEqual(expected, actual, 0.0001);
        }
Exemplo n.º 2
0
        public void RotateNormalizedUnitVectorByZeroDegrees()
        {
            Vector3D expected = new Vector3D(5, 5, 5);
            Vector3D actual   = VectorManipulation.RotateAboutZAxis(new Vector3D(5, 5, 5), 0);

            VectorAssert.AreEqual(expected, actual, 0.0001);
        }
Exemplo n.º 3
0
        public void RotateNormalizedUnitVectorByALargeAngle()
        {
            Vector3D expected = new Vector3D(-6.830127, 1.830127, 5);
            Vector3D actual   = VectorManipulation.RotateAboutZAxis(new Vector3D(5, 5, 5), 1200);

            VectorAssert.AreEqual(expected, actual, 0.0001);
        }
Exemplo n.º 4
0
        public void RotateVectorWithNonZeroXYZComponents()
        {
            Vector3D expected = new Vector3D(-15.980762, 32.320508, 45);
            Vector3D actual   = VectorManipulation.RotateAboutZAxis(new Vector3D(20, 30, 45), 60);

            VectorAssert.AreEqual(expected, actual, 0.0001);
        }
Exemplo n.º 5
0
        public void RotateNormalizedUnitVector()
        {
            Vector3D expected = new Vector3D(0.707107, 0.707107, 0);
            Vector3D actual   = VectorManipulation.RotateAboutZAxis(new Vector3D(1, 0, 0), 45);

            VectorAssert.AreEqual(expected, actual, 0.0001);
        }
Exemplo n.º 6
0
        //
        //  @ param the radius of the site. must be > 0
        //  @ param steplength must be > 0
        //  @ angle of section
        //  populates a site with late long and elevation data
        //
        public void GenerateRadial(double siteRadius, double steplength, double angleOfSection)
        {
            try
            {
                double NumberOfSteps = siteRadius / steplength;

                for (double theta = 0; theta < 180; theta += angleOfSection)
                {
                    // Rotate the vector normalised along the axis about the z axis by theta to get
                    // the unit offset vector for this profile
                    Vector3D OffsetUnitVector = VectorManipulation.RotateAboutZAxis(new Vector3D(steplength, 0, 0), theta);

                    // Get the initial position of the elevation profile
                    // This will be the outermost point of the site radius
                    Vector3D InitialPosition = new Vector3D(0, 0, 0);
                    InitialPosition.X = OffsetUnitVector.X * (-1 * NumberOfSteps);
                    InitialPosition.Y = OffsetUnitVector.Y * (-1 * NumberOfSteps);

                    // Here we initialise the elevation profile to the relevant subclass depending on
                    // what is our elevation data source i.e. google maps
                    ElevationProfileBase ElevationProfile = MapProvider.GetProfile(mapProvider);
                    // Now we need to intialise this Profile with points relative to the initial position and the offsetunit vector worked out above
                    ElevationProfile.InitiliseProfile(NumberOfSteps, InitialPosition, OffsetUnitVector, lat, lon, theta, steplength);

                    this.Add(ElevationProfile);
                }


                // now we need to get the elevation data for each of the profiles
                foreach (ElevationProfileBase Profile in this)
                {
                    Profile.GetElevationData();
                }

                // Return the SiteProfile
                return;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 7
0
    void MultiShot()
    {
        int MiddleBull = bulletCountForMultiFront % 2;
        int SideBull   = bulletCountForMultiFront / 2;

        if (MiddleBull == 0)
        {
            for (int i = 0; i < SideBull; i++)
            {
                float sideAngle = AngleSpacing * (2 * i + 1);

                float Xspacing = spacingX * (2 * i + 1);
                float Yspacing = spacingY * (2 * i + 1);
                Instantiate(bullets, transform.position + new Vector3(Xspacing, Mathf.Abs(Yspacing), 0), Quaternion.identity).direction  = VectorManipulation.SpinVector(ShootDirection, sideAngle);
                Instantiate(bullets, transform.position + new Vector3(-Yspacing, Mathf.Abs(Yspacing), 0), Quaternion.identity).direction = VectorManipulation.SpinVector(ShootDirection, -sideAngle);
            }
        }


        else
        {
            for (int i = 0; i < SideBull; i++)
            {
                float sideAngle = AngleSpacing * (2 * (i + 1));
                float Xspacing  = spacingX * (2 * (i + 1));
                float Yspacing  = spacingY * (2 * (i + 1));
                Instantiate(bullets, transform.position + new Vector3(Xspacing, Mathf.Abs(Yspacing), 0), Quaternion.identity).direction  = VectorManipulation.SpinVector(ShootDirection, sideAngle);
                Instantiate(bullets, transform.position + new Vector3(-Xspacing, Mathf.Abs(Yspacing), 0), Quaternion.identity).direction = VectorManipulation.SpinVector(ShootDirection, -sideAngle);
            }
            Instantiate(bullets, transform.position, Quaternion.identity).direction = ShootDirection;
        }
    }