Пример #1
0
        /// <summary>
        /// Always assumes that the desired answer is the internal solution.
        /// If the external solution is desired,
        /// call deflection.ForceToExternalSolution()
        /// immediately after calling minus().
        /// </summary>
        /// <param name="Az2"></param>
        /// <returns></returns>
        public Deflection minus(Azimuth Az2)
        {
            Deflection returnDeflection =
                new Deflection(this, Az2, true);

            return(returnDeflection);
        }
Пример #2
0
 public Arc(Point centerPt, Point StartPt, Deflection defl)
     : this()
 {
     Origin = StartPt;
      Deflection = defl;
      CenterPt = centerPt;
      //this.Radius;
      BeginRadiusVector = Origin - CenterPt;
      //BeginPointAngle = Deflection / 2;
      //CentralVector = BeginRadiusVector + BeginPointAngle;
      EndRadiusVector = BeginRadiusVector + Deflection;
      EndPt = CenterPt + EndRadiusVector;
      computeBoundingBox();
 }
Пример #3
0
 public void Deflection_setTo_Pos6Rad_shouldBe_Pos6Rad()
 {
     Deflection aDefl = new Deflection();
      aDefl = (Deflection)6.0;
      Double expected = 6.0;
      Double actual = aDefl.getAsRadians();
      Assert.AreEqual(expected: expected, actual: actual, delta: delta);
 }
Пример #4
0
        public void Deflection_setTo_Pos2_shouldBe_Pos2Degrees()
        {
            Deflection defl = new Deflection();
             defl.setFromDegreesDouble(2.0);

             Double expected = 2.0;
             Double actual = defl.getAsDegreesDouble();
             Assert.AreEqual(expected: expected, actual: actual, delta: delta);
        }
Пример #5
0
 public void Deflection_setTo_neg5__18__29_5()
 {
     Deflection aDeflection = new Deflection();
      aDeflection.setFromDegreesMinutesSeconds(-5, 18, 29.5);
      Double expected = -5.308194444444;
      Double actual = aDeflection.getAsDegreesDouble();
      Assert.AreEqual(expected: expected, actual: actual, delta: delta);
 }
Пример #6
0
        public void Deflection_Right_divideBy2_isCorrect()
        {
            Deflection deflA = new Deflection();
             deflA.setFromDegreesDouble(4.0);
             Deflection defl = deflA / 2.0;

             Double expected = 2.0;
             Double actual = defl.getAsDegreesDouble();
             Assert.AreEqual(expected: expected, actual: actual, delta: delta);
        }
Пример #7
0
 public void Deflection_positiveLessThan180_getAsRadians()
 {
     Double expectedValue = 0.785398164;
      Deflection defl = new Deflection(0.785398164, 1);
      Double actualValue = defl.getAsRadians();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.00001);
 }
Пример #8
0
 public void Deflection_positiveGreaterThan180_getAsRadians()
 {
     Double expectedValue = 5.41052068118;
      Deflection defl = new Deflection(5.41052068118, 1);
      Double actualValue = defl.getAsRadians();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.00001);
 }
Пример #9
0
 public void Deflection_negativeLessThan180_getAsRadians()
 {
     Double expectedValue = -0.39479111970;
      Azimuth begAz = new Azimuth(new Point(0.0, 0.0, 0.0), new Point(10.0, 50.0, 0.0));
      Azimuth endAz = new Azimuth(new Point(10.0, 50.0, 0.0), new Point(0.0, 100.0, 0.0));
      Deflection defl = new Deflection(begAz, endAz, true);
      Double actualValue = defl.getAsRadians();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.0000001);
 }
Пример #10
0
 public void Deflection_negativeLessThan180_getAsDegrees()
 {
     Double expectedValue = -45.0;
      Deflection defl = new Deflection(0.785398164, -1);
      Double actualValue = defl.getAsDegreesDouble();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.00001);
 }
Пример #11
0
 public void Deflection_negativeGreaterThan180_getAsDegrees()
 {
     Double expectedValue = -310.0;
      Deflection defl = new Deflection(5.41052068118, -1);
      Double actualValue = defl.getAsDegreesDouble();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.00001);
 }
Пример #12
0
 public void Azimuth_Addition_Az189PlusDeflNeg15_shouldEqual174()
 {
     Double expectedDbl = 174.0;
      Azimuth az = new Azimuth(); az.setFromDegreesDouble(189.0);
      Deflection defl = new Deflection(); defl.setFromDegreesDouble(-15.0);
      Azimuth newAz = az + defl;
      Double actualDbl = newAz.getAsDegreesDouble();
      Assert.AreEqual(expected: expectedDbl, actual: actualDbl, delta: delta);
 }
Пример #13
0
        public void Azimuth_1_30_addDeflection_Pos2_15_shouldYieldNewAzimuth_3_45()
        {
            Azimuth anAzimuth = new Azimuth();
             anAzimuth.setFromDegreesMinutesSeconds(1, 30, 0);
             Deflection aDefl = new Deflection();
             aDefl.setFromDegreesMinutesSeconds(2, 15, 0);

             Double expected = 3.75;
             Azimuth newAz = anAzimuth + aDefl;
             Double actual = newAz.getAsDegreesDouble();
             Assert.AreEqual(expected: expected, actual: actual, delta: delta);
        }
Пример #14
0
 public Arc(Point StartPt, Azimuth incomingDir, Deflection defl,
  Double radius)
     : this()
 {
     populateThis(StartPt, incomingDir, defl, radius);
 }
Пример #15
0
        private void populateThis(Point StartPoint, Azimuth incomingDir, Deflection defl,
         Double radius)
        {
            Origin = StartPoint;
             Rotation = incomingDir;
             Deflection = defl;

             Azimuth BegRadiusDirection = incomingDir +
            new Deflection(Math.PI / 2.0, -1 * Deflection.deflectionDirection);

             BeginRadiusVector = new Vector(
            direction: BegRadiusDirection,
            length: radius);
             CenterPt = StartPoint - BeginRadiusVector;
             EndRadiusVector = BeginRadiusVector + Deflection;

             // Conic Section components
             Eccentricity = 0.0;
             a = b = Radius = BeginRadiusVector.Length;

             // Path Components
             StartPt = StartPoint;
             EndPt = CenterPt + EndRadiusVector;
             StartAzimuth = incomingDir;
             EndAzimuth = StartAzimuth + Deflection;
             Length = (Deflection.angle_ / Math.PI) * Radius;

             // Graphic Components not already set
             ScaleVector = new Vector(Azimuth.ctorAzimuthFromDegree(45.0), Radius);

             computeBoundingBox();
        }
Пример #16
0
        /// <summary>
        /// Always assumes that the desired answer is the internal solution.
        /// If the external solution is desired, 
        /// call deflection.ForceToExternalSolution()
        /// immediately after calling minus().
        /// </summary>
        /// <param name="Az2"></param>
        /// <returns></returns>
        public Deflection minus(Azimuth Az2)
        {
            Deflection returnDeflection =
            new Deflection(this, Az2, true);

             return returnDeflection;
        }