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);
 }
 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);
 }
 public void AzimuthAddition_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);
 }
 public void Deflection_negativeGreaterThan180_getAsRadians()
 {
     Double expectedValue = -5.88839418748;
      Azimuth endAz = new Azimuth(new ptsPoint(0.0, 0.0, 0.0), new ptsPoint(10.0, 50.0, 0.0));
      Azimuth begAz = new Azimuth(new ptsPoint(10.0, 50.0, 0.0), new ptsPoint(0.0, 100.0, 0.0));
      Deflection defl = new Deflection(begAz, endAz, false);
      Double actualValue = defl.getAsRadians();
      Assert.AreEqual(expected: expectedValue, actual: actualValue, delta: 0.00001);
 }
        public void Azimuth1_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);
        }
 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);
 }
        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);
        }
 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);
 }
 public void Deflection_negativeLessThan180_getAsRadians()
 {
     Double expectedValue = -0.39479111970;
      Azimuth begAz = new Azimuth(new ptsPoint(0.0, 0.0, 0.0), new ptsPoint(10.0, 50.0, 0.0));
      Azimuth endAz = new Azimuth(new ptsPoint(10.0, 50.0, 0.0), new ptsPoint(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);
 }
Ejemplo n.º 10
0
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            if (anSOE.station < this.BeginStation || anSOE.station > this.EndStation)
            return null;

             Double lengthIntoCurve = anSOE.station - this.BeginStation;

             Deflection deflToSOEpoint = new Deflection(this.BeginDegreeOfCurve.getAsRadians() * lengthIntoCurve / 100.0, this.deflDirection);
             Azimuth ccToSOEpointAzimuth = this.BeginRadiusVector.Azimuth + deflToSOEpoint;

             Double ccToSOEpointDistance = this.Radius - this.deflDirection * anSOE.offset.OFST;

             ptsVector ccToSOEpoint = new ptsVector(ccToSOEpointAzimuth, ccToSOEpointDistance);

             return this.ArcCenterPt + ccToSOEpoint;
        }
 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);
 }
 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);
 }
Ejemplo n.º 13
0
        public rm21HorArc(ptsPoint begPt, ptsPoint centerPt, ptsPoint endPt, expectedType ExpectedType,
         int deflectionDirection)
            : base(begPt, endPt)
        {
            this.deflDirection = deflectionDirection;
             this.ArcCenterPt = centerPt;
             this.BeginRadiusVector = this.ArcCenterPt - this.BeginPoint;
             this.EndRadiusVector = this.ArcCenterPt - this.EndPoint;

             this.Radius = this.BeginRadiusVector.Length;
             Double validationRadius = this.EndRadiusVector.Length;
             if (Math.Abs(this.Radius - validationRadius) > 0.00014)
            throw new Exception("Given points do not represent a circle.");

             Double degreesToAdd = 90 * deflectionDirection;
             if (ExpectedType == expectedType.ArcSegmentOutsideSoluion)
            deflectionDirection *= -1;

             this.BeginAzimuth = this.BeginRadiusVector.Azimuth + ptsAngle.radiansFromDegree(degreesToAdd);
             this.EndAzimuth = this.EndRadiusVector.Azimuth + ptsAngle.radiansFromDegree(degreesToAdd);

             // applies to English projects only (for now)
             this.BeginDegreeOfCurve = HorizontalAlignmentBase.computeDegreeOfCurve(this.Radius);
             this.EndDegreeOfCurve = this.BeginDegreeOfCurve;

             if (ExpectedType == expectedType.ArcSegmentOutsideSoluion)
             {
            computeDeflectionForOutsideSolutionCurve();
            this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians();
            this.Length = Math.Abs(this.Length);
             }
             else
             {
            Deflection = new Deflection(this.BeginAzimuth, this.EndAzimuth, true);
            Double deflAsRadians = this.Deflection.getAsRadians();
            Double DcAsRadians = this.BeginDegreeOfCurve.getAsRadians();
            this.Length = 100.0 * deflAsRadians / DcAsRadians;
            this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians();
            this.Length = Math.Abs(this.Length);
             }
        }
Ejemplo n.º 14
0
        internal void setDeflection(Deflection newDeflection)
        {
            if (newDeflection.getAsRadians() == 0.0)
            throw new Exception("Can't create arc with zero degree deflection.");

             this.Deflection = newDeflection;
             this.deflDirection = Math.Sign(newDeflection.getAsRadians());

             //var anAngle = this.BeginRadiusVector + this.Deflection;
             //var newAz = Azimuth.newAzimuthFromAngle(anAngle);
             this.EndRadiusVector = this.BeginRadiusVector + this.Deflection;
             this.EndAzimuth = this.BeginAzimuth + this.Deflection;
             this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians();
             this.Length = Math.Abs(this.Length);
             this.EndStation = this.BeginStation + this.Length;
             this.EndPoint = this.ArcCenterPt + this.EndRadiusVector;
        }
Ejemplo n.º 15
0
        public override List<StationOffsetElevation> getStationOffsetElevation(ptsPoint interestPoint)
        {
            ptsVector BeginToInterestPtVector = new ptsVector(this.BeginPoint, interestPoint);
             Deflection BeginToInterestDeflection = new Deflection(this.BeginAzimuth, BeginToInterestPtVector.Azimuth, true);
             if (Math.Abs(BeginToInterestDeflection.getAsDegreesDouble()) > 90.0)
            return null;

             ptsVector EndToInterestPtVector = new ptsVector(this.EndPoint, interestPoint);
             Deflection EndToInterestDeflection = new Deflection(this.EndAzimuth, EndToInterestPtVector.Azimuth, true);
             if (Math.Abs(EndToInterestDeflection.getAsDegreesDouble()) < 90.0)
            return null;

             Double length = BeginToInterestPtVector.Length * Math.Cos(BeginToInterestDeflection.getAsRadians());
             Double theStation = this.BeginStation + length;

             Double offset = BeginToInterestPtVector.Length * Math.Sin(BeginToInterestDeflection.getAsRadians());

             var soe = new StationOffsetElevation(this.BeginStation + length, offset, 0.0);
             var returnList = new List<StationOffsetElevation>();
             returnList.Add(soe);
             return returnList;
        }
        public void appendTangent(ptsPoint TangentEndPoint)
        {
            // See "Solving SSA triangles"
             // http://www.mathsisfun.com/algebra/trig-solving-ssa-triangles.html

             var lastChainItem = allChildSegments.Last();
             if (!(lastChainItem is rm21HorArc))
            throw new Exception("Can't add tangent on a tangent segment.");

             var finalArc = lastChainItem as rm21HorArc;

             var incomingTanRay = new ptsRay(); incomingTanRay.StartPoint = finalArc.BeginPoint;
             incomingTanRay.HorizontalDirection = finalArc.BeginAzimuth;
             int offsetSide = Math.Sign(incomingTanRay.getOffset(TangentEndPoint));
             double rad = finalArc.Radius;
             Azimuth traverseToRevisedCenterPtAzimuth = finalArc.BeginAzimuth + offsetSide * Math.PI/2.0;
             ptsVector traverseToRevisedCenterPt = new ptsVector(traverseToRevisedCenterPtAzimuth, rad);
             ptsPoint revCenterPt = finalArc.BeginPoint + traverseToRevisedCenterPt;

             ptsVector ccToTEPvec = finalArc.ArcCenterPt - TangentEndPoint;

             ptsAngle rho = Math.Asin(rad / ccToTEPvec.Length);
             ptsAngle ninetyDegrees = new ptsAngle();
             ninetyDegrees.setFromDegreesDouble(90.0);
             ptsAngle tau = ninetyDegrees - rho;

             Azimuth ccToPtVecAz = ccToTEPvec.Azimuth;
             Azimuth arcBegRadAz = finalArc.BeginRadiusVector.Azimuth;

             ptsCogo.Angle.Deflection outerDefl = ccToPtVecAz.minus(arcBegRadAz);
             ptsDegree  defl = Math.Abs((tau - outerDefl).getAsDegreesDouble()) * offsetSide;
             Deflection newDeflection = new Deflection(defl.getAsRadians());
             finalArc.setDeflection(newDeflection: newDeflection);

             var appendedLineSegment = new rm21HorLineSegment(finalArc.EndPoint, TangentEndPoint);
             appendedLineSegment.BeginStation = finalArc.EndStation;
             appendedLineSegment.Parent = this;
             allChildSegments.Add(appendedLineSegment);

             this.EndAzimuth = appendedLineSegment.EndAzimuth;
             this.EndPoint = appendedLineSegment.EndPoint;
             restationAlignment();

             if (alignmentData.Count > 0)
            alignmentData.RemoveAt(alignmentData.Count-1);
             alignmentData.Add(new alignmentDataPacket(alignmentData.Count, finalArc));
             alignmentData.Add(new alignmentDataPacket(alignmentData.Count, appendedLineSegment));
        }
Ejemplo n.º 17
0
        public override List<StationOffsetElevation> getStationOffsetElevation(ptsPoint interestPoint)
        {
            ptsVector arcCenterToInterestPtVector = new ptsVector(this.ArcCenterPt, interestPoint);
             Deflection deflToInterestPt = new Deflection(this.BeginRadiusVector.Azimuth, arcCenterToInterestPtVector.Azimuth, true);
             int arcDeflDirection = Math.Sign(this.Deflection.getAsDegreesDouble());
             if (arcDeflDirection * deflToInterestPt.getAsDegreesDouble() < 0.0)
             {
            return null;
             }
             else if (Math.Abs(this.Deflection.getAsDegreesDouble()) - Math.Abs(deflToInterestPt.getAsDegreesDouble()) < 0.0)
             {
            return null;
             }

             Double interestLength = this.Length * deflToInterestPt.getAsRadians() / this.Deflection.getAsRadians();
             Offset offset =  new Offset(arcDeflDirection * (this.Radius - arcCenterToInterestPtVector.Length));

             var soe = new StationOffsetElevation(this.BeginStation + interestLength, offset, 0.0);
             var returnList = new List<StationOffsetElevation>();
             returnList.Add(soe);
             return returnList;
        }