Assembly: EGIS.ShapeFileLib (in EGIS.ShapeFileLib.dll)
Syntax
Visual Basic |
---|
Public Shared Function LineLineIntersection ( _ ByRef p0 As PointD, _ ByRef p1 As PointD, _ ByRef p2 As PointD, _ ByRef p3 As PointD, _ <OutAttribute> ByRef intersectionPoint As PointD, _ <OutAttribute> ByRef tVal As Double, _ <OutAttribute> ByRef vVal As Double _ ) As Boolean |
C# |
---|
public static bool LineLineIntersection( ref PointD p0, ref PointD p1, ref PointD p2, ref PointD p3, out PointD intersectionPoint, out double tVal, out double vVal ) |
Visual C++ |
---|
public: static bool LineLineIntersection( PointD% p0, PointD% p1, PointD% p2, PointD% p3, [OutAttribute] PointD% intersectionPoint, [OutAttribute] double% tVal, [OutAttribute] double% vVal ) |
JavaScript |
---|
EGIS.ShapeFileLib.GeometryAlgorithms.lineLineIntersection = function(p0, p1, p2, p3, intersectionPoint, tVal, vVal); |
Parameters
- p0
- Type: EGIS.ShapeFileLib..::..PointD%
first point defining line 1
- p1
- Type: EGIS.ShapeFileLib..::..PointD%
second point defining line 1
- p2
- Type: EGIS.ShapeFileLib..::..PointD%
first point defining line 2
- p3
- Type: EGIS.ShapeFileLib..::..PointD%
second point defining line 2
- intersectionPoint
- Type: EGIS.ShapeFileLib..::..PointD%
the calculated intersectino point (PointD.Empty if lines do not intersect)
- tVal
- Type: System..::..Double%
The parametric tValue where the interection ocurrs on line 1. See remarks
- vVal
- Type: System..::..Double%
The parametric vValue where the interection ocurrs on line 2. See remarks
Return Value
true if the two lines intersectRemarks
This method tests "infinite" lines defined by two points on the line. Line 1 is defined as the line passing through points p0 and p1. Line 2 is defined as the line passing through points p2 and p3
The two lines will not intersect if the lines are parallel and the method will return false. If either p0 == p1 or p2 == p3 then a line cannot be defined and the method will return false;
The tVal and vVal are from the parametric representations of the lines in the equations:
line1 : (X,Y) = p0 + (t * (p1 - p0))
: X = p0.X + (t * (p1.X-p0.X))
: Y = p0.Y + (t * (p1.Y-p0.Y))
The tVal returned indicates where on Line1 the intersection ocurrs.
If tVal < 0 the intersection ocurrs before p0 on the line.
If tVal > 1 the intersection ocurrs after p1 on the line.
If tVal is between 0 and 1 the intersection ocurrs between p0 and p1 on the line