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 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 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_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); }
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); }
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; }
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; }