private rm21HorizontalAlignment createSingleTangentHA() { var newHA = new rm21HorizontalAlignment(); newHA.reset(new ptsPoint(2082268.0907, 740846.3249, 0.0), new ptsPoint(2082339.9608, 740834.3849, 0.0)); return newHA; }
public void HorizontalAlignment_singleArcHAOutsideSolutionRight_fromFundamentalGeometry_HAlengthIs2439() { var funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(7415.7202, 4384.7704, 0.0)); funGeomItem.pointList.Add(new ptsPoint(7458.9796, 3830.6151, 0.0)); funGeomItem.pointList.Add(new ptsPoint(6947.3437, 3613.3867, 0.0)); funGeomItem.expectedType = expectedType.ArcSegmentOutsideSoluion; funGeomItem.deflectionSign = 1; var fGeomList = new List<IRM21fundamentalGeometry>(); fGeomList.Add(funGeomItem); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fGeomList, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 2439.4665; //Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00015); }
private rm21HorizontalAlignment buildFrehandHAforTesting() { var retHA = new rm21HorizontalAlignment(); retHA.reset(new ptsPoint(X: 2082268.0907, Y: 740846.3249, Z: 0.0), new ptsPoint(X: 2082339.9608, Y: 740834.3849, Z: 0.0)); retHA.appendArc(new ptsPoint(X: 2082657.7727, Y: 740825.3769, Z: 0.0), 1170.0); retHA.appendTangent(new ptsPoint(X: 2082747.2428, Y: 740835.0734, Z: 0.0)); retHA.appendArc(new ptsPoint(X: 2083115.2982, Y: 740931.8698, Z: 0.0), 1280.0); retHA.appendTangent(new ptsPoint(X: 2083652.8068, Y: 741163.1806, Z: 0.0)); retHA.appendArc(new ptsPoint(X: 2084073.2987, Y: 741255.4852, Z: 0.0), 1138.0); retHA.appendTangent(new ptsPoint(X: 2084518.1573, Y: 741266.9617, Z: 0.0)); return retHA; }
public void HorizontalAlignment_singleArcHAOutsideSolutionLeft_fromFundamentalGeometry_HAlengthIs3396() { var funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(6925.6663, 6218.7689, 0.0)); funGeomItem.pointList.Add(new ptsPoint(6540.7903, 5615.8802, 0.0)); funGeomItem.pointList.Add(new ptsPoint(5952.2191, 6022.3138, 0.0)); funGeomItem.expectedType = expectedType.ArcSegmentOutsideSoluion; funGeomItem.deflectionSign = 1; var fGeomList = new List<IRM21fundamentalGeometry>(); fGeomList.Add(funGeomItem); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fGeomList, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 3396.4881; //Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.0045); }
public void HorizontalAlignment_singleArcHAOutsideSolutionLeft_fromFundamentalGeometry_HAlengthIs4038() { var funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(4837.3905, 5202.1148, 0.0)); funGeomItem.pointList.Add(new ptsPoint(3995.0953, 5346.2102, 0.0)); funGeomItem.pointList.Add(new ptsPoint(3861.9225, 4502.1191, 0.0)); funGeomItem.expectedType = expectedType.ArcSegmentOutsideSoluion; funGeomItem.deflectionSign = -1; var fGeomList = new List<IRM21fundamentalGeometry>(); fGeomList.Add(funGeomItem); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fGeomList, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 4037.9558; //Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00015); }
public void HorizontalAlignment_singleArcHAInsideSolutionLeft_fromFundamentalGeometry_HAlengthIs1051() { var funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(4003.3849, 4491.7185, 0.0)); funGeomItem.pointList.Add(new ptsPoint(3995.0953, 5346.2102, 0.0)); funGeomItem.pointList.Add(new ptsPoint(4803.1466, 5068.2214, 0.0)); funGeomItem.expectedType = expectedType.ArcSegmentInsideSolution; funGeomItem.deflectionSign = -1; var fGeomList = new List<IRM21fundamentalGeometry>(); fGeomList.Add(funGeomItem); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fGeomList, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 1050.8644; Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00015); }
public void HorizontalAlignment_singleArcHAinsideSolutionRight_fromFundamentalGeometry_HAlengthIs666() { var funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(6903.1384, 3830.6151, 0.0)); funGeomItem.pointList.Add(new ptsPoint(7458.9796, 3830.6151, 0.0)); funGeomItem.pointList.Add(new ptsPoint(7257.2446, 4348.5557, 0.0)); funGeomItem.expectedType = expectedType.ArcSegmentInsideSolution; funGeomItem.deflectionSign = 1; var fGeomList = new List<IRM21fundamentalGeometry>(); fGeomList.Add(funGeomItem); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fGeomList, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 666.6644; Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00015); }
public void HorizontalAlignment_instantiateSingleLine_fromFundamentalGeometry() { List<IRM21fundamentalGeometry> fundmtlGeoms = createFundmGeoms1(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); Assert.IsNotNull(HA); }
public void HorizontalAlignment_instantiateSingleLine_fromFundamentalGeometry_HAlengthIs100() { List<IRM21fundamentalGeometry> fundmtlGeoms = createFundmGeoms1(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 100.0; Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00001); }
//[Test] public void HorizontalAlignment_instantiateFromFundamentalGeometry_shouldNotThrowException() { var fgList = new List<IRM21fundamentalGeometry>(); var funGeomItem = new rm21MockFundamentalGeometry(); // Line 1, Item [0], geometric sequence 1 funGeomItem.pointList.Add(new ptsPoint(2078236.6862, 746878.8969, 0.0)); funGeomItem.pointList.Add(new ptsPoint(2078312.7571, 746940.1485, 0.0)); funGeomItem.expectedType = expectedType.LineSegment; fgList.Add(funGeomItem); // Line 2, Item [1], geometric sequence 3 funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(2078814.5136, 747096.7721, 0.0)); funGeomItem.pointList.Add(new ptsPoint(2079329.4845, 747059.2340, 0.0)); funGeomItem.expectedType = expectedType.LineSegment; fgList.Add(funGeomItem); // Arc 1, Item [2], geometric sequence 2, oriented backward funGeomItem = new rm21MockFundamentalGeometry(); funGeomItem.pointList.Add(new ptsPoint(2078814.5136, 747096.7721, 0.0)); // beg matches [0].end funGeomItem.pointList.Add(new ptsPoint(2078762.3916, 746381.7284, 0.0)); // center pt funGeomItem.pointList.Add(new ptsPoint(2078312.7571, 746940.1485, 0.0)); // end matches [1].begin funGeomItem.expectedType = expectedType.ArcSegmentInsideSolution; funGeomItem.deflectionSign = 1; fgList.Add(funGeomItem); try { var HA = new rm21HorizontalAlignment( fundamentalGeometryList: fgList, Name: null, stationEquationing: null); } catch (Exception e) { Assert.Fail("Exception not expected: \"" + e.Message + "\""); } }
public void HorizontalAlignment_instantiateSingleArcExterior_fromFundamentalGeometry_HAlengthIs5235() { List<IRM21fundamentalGeometry> fundmtlGeoms = createFundmGeoms_arc1_butExternalSolution(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 5234.5162; Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00001); }
public void HorizontalAlignment_instantiate5ItemHA_fromFundamentalGeometry_HAlengthIs7155() { List<IRM21fundamentalGeometry> fundmtlGeoms = createTestHA_fundGeom1(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); double actualLength = HA.EndStation - HA.BeginStation; double expectedLength = 7154.9385; Assert.AreEqual(expected: expectedLength, actual: actualLength, delta: 0.00015); }
public void HorizontalAlignment_givenXYvalues_getStationOffsetValues() { List<IRM21fundamentalGeometry> fundmtlGeoms = createTestHA_fundGeom1(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); StationOffsetElevation anSOE = null; bool allValuesAgree = true; // test point on first tangent ptsPoint somePoint = new ptsPoint(4046.2915, 3161.3216, 0.0); var soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(801.8849, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(0.0, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.00000001); } else { allValuesAgree = false; } // test point which is before the beginning of the HA somePoint = new ptsPoint(2500.0, 1000.0, 0.0); soePoints = HA.getStationOffsetElevation(somePoint); allValuesAgree &= soePoints.Count == 0; // test point which is beyond the end of the HA somePoint = new ptsPoint(9554.0, 9000.0, 0.0); soePoints = HA.getStationOffsetElevation(somePoint); allValuesAgree &= soePoints.Count == 0; // test point offset from first tangent somePoint.x = 4516.0; somePoint.y = 3404.0; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(1281.0297, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(223.4706, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point on first arc somePoint.x = 5494.3772; somePoint.y = 4664.3429; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(2930.4718, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(0.0, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point offset right of second arc somePoint.x = 6918.0; somePoint.y = 4557.0; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(4324.6956, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(183.2743, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point offset left of second arc somePoint.x = 7103.0; somePoint.y = 4979.0; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(4614.0481, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(-176.4468, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point offset left of third line (fifth segment somePoint.x = 8071.7032; somePoint.y = 5913.8278; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(6047.5668, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(-314.4057, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point offset at center of first arc somePoint.x = 5700.5429; somePoint.y = 3716.3124; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(2252.1594, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(970.1887, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test point offset right that returns 2 SOE instances for the same point somePoint.x = 5940.0; somePoint.y = 3310.0; soePoints = HA.getStationOffsetElevation(somePoint); if (soePoints != null && soePoints.Count > 0) { allValuesAgree &= (soePoints.Count == 2); anSOE = soePoints.FirstOrDefault(); allValuesAgree &= anSOE.station.tolerantEquals(3342.5539, 0.00014); allValuesAgree &= anSOE.offset.OFST.tolerantEquals(1382.4657, 0.00014); allValuesAgree &= anSOE.elevation.EL.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } Assert.IsTrue(allValuesAgree); }
public void HorizontalAlignment_givenStationOffsetValues_getXYvalues() { bool allValuesAgree = true; List<IRM21fundamentalGeometry> fundmtlGeoms = createTestHA_fundGeom1(); rm21HorizontalAlignment HA = new rm21HorizontalAlignment( fundamentalGeometryList: fundmtlGeoms, Name: null, stationEquationing: null); StationOffsetElevation anSOE = new StationOffsetElevation(); // test a point right of the second line segment (the third segment) anSOE.station = 3611.75; anSOE.offset.OFST = 238.949; ptsPoint anXYpoint = HA.getXYZcoordinates(anSOE); if (anXYpoint != null) { allValuesAgree &= anXYpoint.x.tolerantEquals(6180.0, 0.014); allValuesAgree &= anXYpoint.y.tolerantEquals(4460.0, 0.014); allValuesAgree &= anXYpoint.z.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } // test a point right of the second arc (the fourth segment) anSOE.station = 4469.2978; anSOE.offset.OFST = 138.1336; anXYpoint = HA.getXYZcoordinates(anSOE); if (anXYpoint != null) { allValuesAgree &= anXYpoint.x.tolerantEquals(7062.3839, 0.014); allValuesAgree &= anXYpoint.y.tolerantEquals(4636.0766, 0.014); allValuesAgree &= anXYpoint.z.tolerantEquals(0.0, 0.000001); } else { allValuesAgree = false; } Assert.IsTrue(allValuesAgree); }
public void HorizontalAlignment_givenBeginStationAndLeftOffset_getXYcoordinates() { var HA = new rm21HorizontalAlignment( fundamentalGeometryList: createTestHA_fundGeom1(), Name: null, stationEquationing: null); var actual = HA.getXYZcoordinates(0.0, -20.0, 0.0); Assert.AreEqual(expected: 3540.3922, actual: actual.x, delta: 0.00015); Assert.AreEqual(expected: 2538.8385, actual: actual.y, delta: 0.00015); }
public void HorizontalAlignment_appendTangentToSimpleArc_DeflectionIsToTheRight() { var HA = new rm21HorizontalAlignment(); HA.reset(new ptsPoint(2083115.2982, 740931.8698, 0.0), new ptsPoint(X: 2083652.8068, Y: 741163.1806, Z: 0.0)); HA.appendArc(new ptsPoint(X: 2084073.2987, Y: 741255.4852, Z: 0.0), 1138.0); HA.appendTangent(new ptsPoint(X: 2084518.1573, Y: 741266.9617, Z: 0.0)); Double expectedDbl = 21.806287; Double actualDbl = HA.GetElementByStation(1010.0).Deflection.getAsDegreesDouble(); Assert.AreEqual(expected: expectedDbl, actual: actualDbl, delta: 0.000045); }