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));
 }
 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);
 }
        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);
 }
 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);
 }
 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));
 }