public static Azimuth operator +(Azimuth Az1, Deflection defl) { var newAzDeg = Az1.getAsDegreesDouble() + defl.getAsDegreesDouble(); Double retDbl = ptsAngle.normalizeToPlusOrMinus360Static(newAzDeg); Azimuth retAz = new Azimuth(); retAz.setFromDegreesDouble(retDbl); return retAz; }
public void Azimuth_setFromXY(Double x, Double y, Double expectedDegrees) { Azimuth anAzimuth = new Azimuth(); anAzimuth.setFromXY(x, y); Double actualDegrees = anAzimuth.getAsDegreesDouble(); Assert.AreEqual(expected: expectedDegrees, actual: actualDegrees, delta: delta); }
public void AzimuthArithmatic_subtraction(Double Az1Dbl, Double Az2Dbl, Double expectedDeflection) { Azimuth Az1 = new Azimuth(); Az1.setFromDegreesDouble(Az1Dbl); Azimuth Az2 = new Azimuth(); Az2.setFromDegreesDouble(Az2Dbl); Double actualDeflection = Az2.minus(Az1).getAsDegreesDouble(); Assert.AreEqual(expected: expectedDeflection, actual: actualDeflection, delta: 0.00000001); }
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 AzimuthArithmatic_addition(Double Az1Dbl, Double ExpectedAz2Dbl, Double DeflectionDbl) { Azimuth Az1 = new Azimuth(); Az1.setFromDegreesDouble(Az1Dbl); Deflection defl = DeflectionDbl.AsPtsDegree(); Azimuth Az2 = Az1 + defl; Double actualAzimuth = Az2.getAsDegreesDouble(); Assert.AreEqual(expected: ExpectedAz2Dbl, actual: actualAzimuth, delta: 0.00000001); }
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 Deflection(Azimuth BeginAzimuth, Azimuth EndAzimuth, bool assumeDeflectionIsLessThan180Degrees) { isLessThanEqual_180degrees = assumeDeflectionIsLessThan180Degrees; if(false == isLessThanEqual_180degrees) this.angle_ = BeginAzimuth - EndAzimuth; else this.angle_ = EndAzimuth - BeginAzimuth; this.deflectionDirection = 1; if (this.angle_ < 0.0 || this.angle_ > Math.PI) { this.deflectionDirection = -1; } }
public rm21HorArc(ptsPoint begPt, ptsPoint endPt, Azimuth incomingAzimuth, Double radius) : base(begPt, endPt) { if (0 == utilFunctions.tolerantCompare((endPt - begPt).Length, 0.0, 0.000001)) throw new ArcExceptionZeroLengthNotDefined(); Double tanOffsetToEndPt; ptsRay incomingRay = new ptsRay(); incomingRay.advanceDirection = 1; incomingRay.StartPoint = begPt; incomingRay.HorizontalDirection = incomingAzimuth; tanOffsetToEndPt = incomingRay.getOffset(endPt); if (0 == utilFunctions.tolerantCompare(tanOffsetToEndPt, 0.0, 0.000001)) throw new ArcExceptionZeroDeflectionNotDefined(); this.BeginStation = 0.0; this.Radius = radius; this.BeginAzimuth = incomingAzimuth; deflDirection = Math.Sign(tanOffsetToEndPt); Deflection defl = Deflection.ctorDeflectionFromAngle(90.0, deflDirection); Azimuth azToCenter = incomingAzimuth + defl; ptsVector traverseToCenterVec = new ptsVector(azToCenter, radius); ArcCenterPt = begPt + traverseToCenterVec; this.BeginRadiusVector = this.ArcCenterPt - this.BeginPoint; Azimuth endVecAz = (this.ArcCenterPt - endPt).Azimuth; this.EndRadiusVector = new ptsVector(endVecAz, radius); this.EndPoint = this.ArcCenterPt + this.EndRadiusVector; var deflectionDbl = endVecAz - this.BeginRadiusVector.Azimuth; this.Deflection = new Deflection(deflectionDbl, deflDirection); this.EndAzimuth = this.BeginAzimuth + this.Deflection; // applies to English projects only (for now) this.BeginDegreeOfCurve = HorizontalAlignmentBase.computeDegreeOfCurve(this.Radius); this.EndDegreeOfCurve = this.BeginDegreeOfCurve; this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians(); this.Length = Math.Abs(this.Length); this.EndStation = this.BeginStation + this.Length; }
public ptsVector(Azimuth direction, Double length) { x = length * Math.Sin(direction.angle_); y = length * Math.Cos(direction.angle_); z = 0.0; }
public Azimuth givenXYgetSlopeAzimuth(ptsDTMpoint aPoint) { Azimuth slopeAz = new Azimuth(); slopeAz.setFromXY(this.normalVec.y, this.normalVec.x); return slopeAz; }
public void Azimuth_setToDMS183__29__29_5_shouldResultIn_Angle() { Azimuth anAzimuth = new Azimuth(); anAzimuth.setFromDegreesMinutesSeconds(183, 29, 29.5); Double expected = 183.4915277778; Double actual = anAzimuth.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); }
private static void printResult(int count, double? EL, double? slope, Azimuth AZ) { if (null == EL) { System.Console.WriteLine("Row {0} has elevation = null", count); } else { System.Console.Write("Row {0} has elevation = ", count); System.Console.Write((double)EL); System.Console.Write(", Slope = "); System.Console.Write((double)slope); System.Console.Write(", Az = "); System.Console.WriteLine(AZ); } }
//to do: //setAsAzimuth //getAsDegreeMinuteSecond //setAsDegree //setAsDegreeMinuteSecond //yada public static Azimuth newAzimuthFromAngle(ptsAngle angle) { Azimuth retAz = new Azimuth(); retAz.setFromDegreesDouble(angle.getAsDegreesDouble()); return retAz; }
public Deflection minus(Azimuth Az2) { Double returnDeflection = (this.angle_ - Az2.angle_); return new Deflection(ptsAngle.normalizeToPlusOrMinus2PiStatic(returnDeflection)); }