コード例 #1
0
        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;
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            Double piOver2 = Math.PI / 2.0;
             ptsVector alongVector = new ptsVector(this.BeginAzimuth, anSOE.station - this.BeginStation);
             ptsPoint returnPoint = this.BeginPoint + alongVector;
             returnPoint.z = anSOE.elevation.EL;

             Azimuth perpandicularAzimuth = this.BeginAzimuth + piOver2;
             ptsVector perpandicularVector = new ptsVector(perpandicularAzimuth, anSOE.offset.OFST);
             returnPoint = returnPoint + perpandicularVector;

             return returnPoint;
        }
コード例 #5
0
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            if (anSOE.station < this.BeginStation || anSOE.station > this.EndStation)
            return null;

             Double lengthIntoCurve = anSOE.station - this.BeginStation;

             Deflection deflToSOEpoint = new Deflection(this.BeginDegreeOfCurve.getAsRadians() * lengthIntoCurve / 100.0, this.deflDirection);
             Azimuth ccToSOEpointAzimuth = this.BeginRadiusVector.Azimuth + deflToSOEpoint;

             Double ccToSOEpointDistance = this.Radius - this.deflDirection * anSOE.offset.OFST;

             ptsVector ccToSOEpoint = new ptsVector(ccToSOEpointAzimuth, ccToSOEpointDistance);

             return this.ArcCenterPt + ccToSOEpoint;
        }
コード例 #6
0
        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;
        }