Esempio n. 1
0
		/// <summary> Determines whether the current line intersects the specified line. </summary>
		public virtual bool Intersects(Line line)
		{
			Point intersection = FindExtrapolatedIntersection(this, line);
			if (double.IsNaN(intersection.X))
				return false;//they're parallel

			//the intersection may be on the extrapolation of the specified line, and is checked by the Contains method:
			return line.Contains(intersection);
		}
Esempio n. 2
0
		/// <summary> Determines whether the current line segment intersects the specified line. </summary>
		public override bool Intersects(Line other)
		{
			if (!(other is LineSegment)) return other.Intersects(this);//this simpler case is handled by the base class

			Point intersection = FindExtrapolatedIntersection(this, other);
			if (double.IsNaN(intersection.X)) return false;//the lines are parallel 

			//the intersection may lie on the extrapolation of the segments. To check that they are within the boundaries, the contains method is invoked for each segment
			return this.Contains(intersection) && other.Contains(intersection);
		}
Esempio n. 3
0
        /// <summary> Determines whether the current line intersects the specified line. </summary>
        public virtual bool Intersects(Line line)
        {
            Point intersection = FindExtrapolatedIntersection(this, line);

            if (double.IsNaN(intersection.X))
            {
                return(false);               //they're parallel
            }
            //the intersection may be on the extrapolation of the specified line, and is checked by the Contains method:
            return(line.Contains(intersection));
        }
Esempio n. 4
0
        /// <summary> Determines whether the current line segment intersects the specified line. </summary>
        public override bool Intersects(Line other)
        {
            if (!(other is LineSegment))
            {
                return(other.Intersects(this));                                    //this simpler case is handled by the base class
            }
            Point intersection = FindExtrapolatedIntersection(this, other);

            if (double.IsNaN(intersection.X))
            {
                return(false);                                         //the lines are parallel
            }
            //the intersection may lie on the extrapolation of the segments. To check that they are within the boundaries, the contains method is invoked for each segment
            return(this.Contains(intersection) && other.Contains(intersection));
        }