public Deflection(ptsAngle anAngle) { this.deflectionDirection = Math.Sign(anAngle.angle_); angle__ = Math.Abs(anAngle.angle_); }
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)); }
//to do: //setAsAzimuth //getAsDegreeMinuteSecond //setAsDegree //setAsDegreeMinuteSecond //yada public static Azimuth newAzimuthFromAngle(ptsAngle angle) { Azimuth retAz = new Azimuth(); retAz.setFromDegreesDouble(angle.getAsDegreesDouble()); return retAz; }