Example #1
0
        internal Angle CalculateAngleInRadiansRelativeToXAxis([NotNull] Point one,
                                                              [NotNull] Point two,
                                                              Constants.LineDirection lineDirection)
        {
            double deltaX = two.X - one.X;
            double deltaY = two.Y - one.Y;

            double radians = IsDeltaXOrDeltaYLessThanEpsilon(deltaX,
                                                             deltaY)
                                 ? DetermineRadiansDependingOnDeltaX(one,
                                                                     two,
                                                                     deltaX)
                                 : CalculateRadians(deltaY,
                                                    deltaX);

            // todo check/fix linedirection causes more trouble than worth,
            // todo use always forward and don't use reverse here
            if (lineDirection == Constants.LineDirection.Reverse)
            {
                radians += BaseAngle.RadiansFor180Degrees;
            }

            if (Math.Abs(BaseAngle.RadiansFor360Degrees - radians) < SelkieConstants.EpsilonRadians)
            {
                radians = BaseAngle.RadiansForZeroDegrees;
            }

            return(Angle.FromRadians(radians));
        }
Example #2
0
 // ReSharper disable once TooManyDependencies
 public Line([NotNull] Point startPoint,
             [NotNull] Point endPoint,
             Constants.LineDirection lineDirection)
     : this(UnknownId,
            startPoint,
            endPoint,
            lineDirection,
            false)
 {
 }
Example #3
0
 public Polyline(int id,
                 Constants.LineDirection runDirection)
 {
     Id                       = id;
     IsUnknown                = false;
     EndPoint                 = Point.Unknown;
     StartPoint               = Point.Unknown;
     RunDirection             = runDirection;
     AngleToXAxisAtEndPoint   = Angle.Unknown;
     AngleToXAxisAtStartPoint = Angle.Unknown;
 }
Example #4
0
 // ReSharper disable once TooManyDependencies
 public Line(int id,
             double x1,
             double y1,
             double x2,
             double y2,
             Constants.LineDirection runDirection = Constants.LineDirection.Forward,
             bool isUnknown = false)
     : this(id,
            new Point(x1,
                      y1),
            new Point(x2,
                      y2),
            runDirection,
            isUnknown)
 {
 }
Example #5
0
 // ReSharper disable once TooManyDependencies
 internal Line(int id,
               [NotNull] Point startPoint,
               [NotNull] Point endPoint,
               Constants.LineDirection lineDirection,
               bool isUnknown)
 {
     Id             = id;
     m_StartPoint   = startPoint;
     m_EndPoint     = endPoint;
     m_IsUnknown    = isUnknown;
     m_RunDirection = lineDirection;
     Length         = CalculateLength();
     AngleToXAxis   = CalculateAngleInRadiansRelativeToXAxis(startPoint,
                                                             endPoint,
                                                             lineDirection);
     AngleToXAxisAtStartPoint = AngleToXAxis;
     AngleToXAxisAtEndPoint   = AngleToXAxis;
 }
Example #6
0
 public SurveyFeature(int id,
                      [NotNull] Point startPoint,
                      [NotNull] Point endPoint,
                      [NotNull] Angle angleToXAxisAtStartPoint,
                      [NotNull] Angle angleToXAxisAtEndPoint,
                      Constants.LineDirection runDirection,
                      double length,
                      bool isUnknown = false,
                      [UsedImplicitly] string geoJson = "") // todo check why we don't use it
 {
     Id         = id;
     IsUnknown  = isUnknown;
     StartPoint = startPoint;
     EndPoint   = endPoint;
     AngleToXAxisAtStartPoint = angleToXAxisAtStartPoint;
     AngleToXAxisAtEndPoint   = angleToXAxisAtEndPoint;
     RunDirection             = runDirection;
     Length = length;
 }
 public SurveyFeatureData(
     int id,
     [NotNull] Point startPoint,
     [NotNull] Point endPoint,
     [NotNull] Angle angleToXAxisAtStartPoint,
     [NotNull] Angle angleToXAxisAtEndPoint,
     Constants.LineDirection runDirection,
     double length,
     bool isUnknown)
 {
     Id         = id;
     StartPoint = startPoint;
     EndPoint   = endPoint;
     AngleToXAxisAtStartPoint = angleToXAxisAtStartPoint;
     AngleToXAxisAtEndPoint   = angleToXAxisAtEndPoint;
     RunDirection             = runDirection;
     Length    = length;
     IsUnknown = isUnknown;
 }