Пример #1
0
 public static LineIntersectionResult <double> ComputeIntersection(CoordinatePair2 <double> segmentP, CoordinatePair2 <double> segmentQ)
 {
     if (segmentP == null || segmentQ == null)
     {
         return(new LineIntersectionResult <double>());
     }
     return(ComputeIntersection(segmentP.Start, segmentP.End, segmentQ.Start, segmentQ.End));
 }
Пример #2
0
 public static double Length(CoordinatePair2 <double> seg)
 {
     if (seg == null)
     {
         return(double.NaN);
     }
     return(Length(seg.Start, seg.End));
 }
Пример #3
0
 public CoordinatePair2(CoordinatePair2 <T> other)
 {
     if (other == null)
     {
         throw new ArgumentNullException();
     }
     this.Start = new Coordinate2 <T>(other.Start);
     this.End   = new Coordinate2 <T>(other.End);
 }
Пример #4
0
        public static bool HasIntersection(CoordinatePair2 <double> segmentP, CoordinatePair2 <double> segmentQ)
        {
            if (segmentP == null || segmentQ == null)
            {
                return(false);
            }
            LineIntersectionResult <double> tmp = ComputeIntersection(segmentP.Start, segmentP.End, segmentQ.Start, segmentQ.End);

            return(tmp.IntersectionType != LineIntersectionType.NoIntersection);
        }
Пример #5
0
 public bool EqualsNonDirectional(CoordinatePair2 <T> other)
 {
     if (this.Start.Equals(other.Start))
     {
         return(this.End.Equals(other.End));
     }
     if (this.End.Equals(other.Start))
     {
         return(this.Start.Equals(other.End));
     }
     return(false);
 }
Пример #6
0
 public static LineIntersectionType ComputeIntersectionType(CoordinatePair2 <double> segment, Coordinate2 <double> p)
 {
     if (segment == null || p == null)
     {
         return(LineIntersectionType.NoIntersection);
     }
     // do between check first, since it is faster than the orientation test
     if (PointInEnvelope(segment.Start, segment.End, p))
     {
         if ((OrientationIndex(segment.Start, segment.End, p) == 0) && (OrientationIndex(segment.End, segment.Start, p) == 0))
         {
             return(LineIntersectionType.PointIntersection);
         }
     }
     return(LineIntersectionType.NoIntersection);
 }
Пример #7
0
 public static double DistancePerpendicular(CoordinatePair2 <double> seg, Coordinate2 <double> q)
 {
     return(DistancePerpendicular(seg.Start, seg.End, q));
 }
Пример #8
0
 public bool Equals(CoordinatePair2 <T> other)
 {
     return(this.Start.Equals(other.Start) && this.End.Equals(other.End));
 }