Exemplo n.º 1
0
 public double getOffset(ptsPoint endPt)
 {
     ptsVector directVectr = endPt - this.StartPoint;
      ptsAngle alpha =  this.HorizontalDirection - directVectr;
      Double offset = -1.0 * directVectr.Length * Math.Sin(alpha.getAsRadians());
      return offset;
 }
 public rm21HorLineSegment(ptsPoint begPt, ptsPoint endPt)
     : base(begPt, endPt)
 {
     //this.BeginBearing = do this later
      //this.EndBearing = do this later
      this.BeginDegreeOfCurve = 0.0;
      this.EndDegreeOfCurve = 0.0;
      this.BeginStation = 0.0;
      this.EndStation = (endPt - begPt).Length;
      this.BeginAzimuth = this.EndAzimuth = (endPt - begPt).Azimuth;
 }
Exemplo n.º 3
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;
        }
 public HorizontalAlignmentBase(ptsPoint begPt, ptsPoint endPt)
     : base()
 {
     BeginPoint = begPt;
      EndPoint = endPt;
 }
 public virtual List<StationOffsetElevation> getStationOffsetElevation(ptsPoint aPoint)
 {
     throw new NotImplementedException();
 }
        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));
        }
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            if (anSOE.station < this.BeginStation || anSOE.station > this.EndStation)
            return null;

             ptsPoint returnPoint = new ptsPoint();
             foreach (var segment in this.allChildSegments)
             {
            if (anSOE.station < segment.EndStation)
            {
               return segment.getXYZcoordinates(anSOE);
            }
             }
             return null;
        }
        public override List<StationOffsetElevation> getStationOffsetElevation(ptsPoint aPoint)
        {
            var returnList = new List<StationOffsetElevation>();

             foreach (var segment in allChildSegments)
             {
            var SOEforThisSegment = segment.getStationOffsetElevation(aPoint);
            if (null != SOEforThisSegment)
               returnList.AddRange(SOEforThisSegment);
             }

             returnList = returnList.OrderBy(soe => Math.Abs(soe.offset)).ToList<StationOffsetElevation>();

             return returnList;
        }
 public void getCrossSectionEndPoints(
  CogoStation station, 
  out ptsPoint leftPt, 
  double leftOffset, 
  out ptsPoint rightPt, 
  double rightOffset)
 {
     leftPt = null;
      rightPt = null;
 }
        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));
        }
        public void appendArc(ptsPoint ArcEndPoint, Double radius)
        {
            var newArc = new rm21HorArc(this.EndPoint, ArcEndPoint, this.EndAzimuth, radius);
             newArc.BeginStation = this.EndStation;
             newArc.EndStation = newArc.BeginStation + newArc.Length;

             newArc.Parent = this;
             this.allChildSegments.Add(newArc);

             this.EndAzimuth = this.BeginAzimuth + newArc.Deflection;
             this.EndPoint = newArc.EndPoint;
             restationAlignment();

             alignmentData.Add(new alignmentDataPacket(alignmentData.Count, newArc));
        }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
0
        public rm21HorArc(ptsPoint begPt, ptsPoint centerPt, ptsPoint endPt, expectedType ExpectedType,
         int deflectionDirection)
            : base(begPt, endPt)
        {
            this.deflDirection = deflectionDirection;
             this.ArcCenterPt = centerPt;
             this.BeginRadiusVector = this.ArcCenterPt - this.BeginPoint;
             this.EndRadiusVector = this.ArcCenterPt - this.EndPoint;

             this.Radius = this.BeginRadiusVector.Length;
             Double validationRadius = this.EndRadiusVector.Length;
             if (Math.Abs(this.Radius - validationRadius) > 0.00014)
            throw new Exception("Given points do not represent a circle.");

             Double degreesToAdd = 90 * deflectionDirection;
             if (ExpectedType == expectedType.ArcSegmentOutsideSoluion)
            deflectionDirection *= -1;

             this.BeginAzimuth = this.BeginRadiusVector.Azimuth + ptsAngle.radiansFromDegree(degreesToAdd);
             this.EndAzimuth = this.EndRadiusVector.Azimuth + ptsAngle.radiansFromDegree(degreesToAdd);

             // applies to English projects only (for now)
             this.BeginDegreeOfCurve = HorizontalAlignmentBase.computeDegreeOfCurve(this.Radius);
             this.EndDegreeOfCurve = this.BeginDegreeOfCurve;

             if (ExpectedType == expectedType.ArcSegmentOutsideSoluion)
             {
            computeDeflectionForOutsideSolutionCurve();
            this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians();
            this.Length = Math.Abs(this.Length);
             }
             else
             {
            Deflection = new Deflection(this.BeginAzimuth, this.EndAzimuth, true);
            Double deflAsRadians = this.Deflection.getAsRadians();
            Double DcAsRadians = this.BeginDegreeOfCurve.getAsRadians();
            this.Length = 100.0 * deflAsRadians / DcAsRadians;
            this.Length = 100.0 * this.Deflection.getAsRadians() / this.BeginDegreeOfCurve.getAsRadians();
            this.Length = Math.Abs(this.Length);
             }
        }
Exemplo n.º 14
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;
        }
Exemplo n.º 15
0
 public Azimuth(ptsPoint beginPt, ptsPoint endPt)
 {
     this.angle__ = Math.Atan2(endPt.y - beginPt.y, endPt.x - beginPt.x);
 }