public void reset(ptsPoint pt1, ptsPoint pt2) { var lineSeg = new rm21HorLineSegment(pt1, pt2); lineSeg.Parent = this; allChildSegments = new List<HorizontalAlignmentBase>(); allChildSegments.Add(lineSeg); this.BeginStation = 0.0; this.EndStation = lineSeg.EndStation; this.Length = this.EndStation - this.BeginStation; this.BeginAzimuth = lineSeg.BeginAzimuth; this.EndAzimuth = lineSeg.EndAzimuth; this.BeginDegreeOfCurve = this.EndDegreeOfCurve = 0.0; this.BeginPoint = lineSeg.BeginPoint; this.EndPoint = lineSeg.EndPoint; restationAlignment(); alignmentData = new List<alignmentDataPacket>(); alignmentData.Add(new alignmentDataPacket(0, lineSeg)); }
private void createAddLineSegment(IRM21fundamentalGeometry fundGeomLineSeg) { ptList = fundGeomLineSeg.getPointList(); if (2 != ptList.Count) throw new Exception("Line Segment fundamental geometry must have two and only two points."); rm21HorLineSegment aLineSeg = new rm21HorLineSegment(ptList[0], ptList[1]); if (null == allChildSegments_scratchPad) allChildSegments_scratchPad = new List<HorizontalAlignmentBase>(); allChildSegments_scratchPad.Add(aLineSeg); }
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)); }