XLineXY Module
Functions and values
| Function or value |
Description
|
Full Usage:
closestParameters (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
pAy : float
pBx : float
pBy : float
vAx : float
vAy : float
vBx : float
vBy : float
Returns: float * float
A struct tuple (s, t) of the two clamped parameters. 0.0,0.0 for zero-length lines.
|
Gets the parameters s and t on two finite lines where they are closest to each other. Works on parallel lines too. For overlapping parallels there are many valid closest pairs. This algorithm returns the parameter closest to 0.0 on segment A. The more detailed function `getClosestParameters` returns the midpoint of the overlapping segment.
|
Full Usage:
doIntersect (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
Returns: bool
TRUE if both lines have an intersection parameter in the range 0.0 to 1.0 (with 1e-6 tolerance).
FALSE if the lines are parallel, coincident or at least one intersection parameter is outside of the range.
Modifiers: inline |
Checks if two 2D-lines intersect within the parameter range 0.0 to 1.0 (with 1e-6 tolerance) on both lines. This does not check for an explicit angle tolerance, so overlapping almost parallel lines may return TRUE.
|
Full Usage:
doOverlap (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tolerance)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
tolerance : float
-
Is a distance tolerance (compared against the squared distance internally).
Used for checking if the distance between parallel lines is less than this value.
Returns: bool
TRUE if the lines are coincident and overlap or touch.
FALSE if the lines are not coincident or do not overlap nor touch.
|
Checks if 2D lines are not only parallel and coincident but are also overlapping or at least touching at their ends.
|
Full Usage:
getClosestParameters (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
This is a tolerance for considering lines parallel.
This is a precomputed tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
Is a length tolerance.
If one or both lines are shorter than this, then a 'TooShort' union case is returned.
Returns: ClParams
A ClParams Discriminated Union with the following cases:
| Intersect of parameterA:float * parameterB:float
| Apart of parameterA:float * parameterB:float
| Parallel of parameterA:float * parameterB:float
| TooShortA
| TooShortB
| TooShortBoth
|
Gets the parameters on the finite lines where the lines are closest to each other. For parallel or overlapping lines, there are many solutions, The parameters in the middle of the overlap are returned. Alternatively you can use `closestParameters` for a simpler interface that returns a tuple of the closest parameters.
|
Full Usage:
getClosestPoints (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
This is a tolerance for considering lines parallel.
This is a precomputed tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
The length tolerance.
If one or both lines are shorter than this, then a 'TooShort' union case is returned.
Returns: ClPts
A ClPts Discriminated Union with the following cases:
| Intersect of Pt
| Apart of Pt * Pt
| Parallel of Pt * Pt
| TooShortA
| TooShortB
| TooShortBoth
|
Gets the point or points on the finite lines where the lines are closest to each other. For parallel or coincident lines, this returns the midpoint of the interval spanned by the projected endpoints (matching the middle of the overlapping segment when one exists). This method uses a small tolerance of 1e-6 to account for numerical inaccuracies when checking the 0..1 range.
|
Full Usage:
getIntersection (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
Is the tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
Is a length tolerance.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: XPt
An XPt Discriminated Union with the following cases:
| Intersect of Pt
| Parallel
| TooShortBoth
| TooShortA
| TooShortB
|
Tries to get intersection point of two finite 2D lines.
|
Full Usage:
getIntersectionParam (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
Is the tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
Is a length tolerance.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: XParam
An XParam Discriminated Union with the following cases:
| Intersect of float*float
| Parallel
| TooShortBoth
| TooShortA
| TooShortB
|
Tries to get intersection parameters of two finite 2D-lines.
|
Full Usage:
getRayIntersection (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
Is the tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
Is a length tolerance.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: XRay
An XRay Discriminated Union with the following cases:
| Intersect of Pt
| Parallel
| TooShortBoth
| TooShortA
| TooShortB
|
Tries to get intersection point of two rays (rays are 2D lines extended infinitely).
|
Full Usage:
getRayIntersectionParam (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent, tooShortTolerance)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
Is the tangent of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
tooShortTolerance : float
-
Is a length tolerance.
If one or both lines are shorter than this, then a 'TooShort' union case is returned.
Returns: XRayParam
An XRayParam discriminated union with the following cases:
| Intersect of float*float
| Parallel
| TooShortA
| TooShortB
| TooShortBoth
|
Tries to get intersection parameters of two rays (rays are 2D lines extended infinitely).
|
Full Usage:
intersectRays (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
Returns: Pt
The intersection point of the two rays.
Modifiers: inline |
Intersects two infinite 2D lines. Fails if they are parallel or zero length.
|
Full Usage:
isWithinRanges (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, minParameterA, maxParameterA, minParameterB, maxParameterB)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
minParameterA : float
-
The minimum parameter value of the range, inclusive.
maxParameterA : float
-
The maximum parameter value of the range, inclusive.
minParameterB : float
-
The minimum parameter value of the range, inclusive.
maxParameterB : float
-
The maximum parameter value of the range, inclusive.
Returns: bool
TRUE if both lines have an intersection parameter in the range (inclusive min and max value).
FALSE if the lines are parallel, coincident or at least one intersection parameter is outside of the range.
Modifiers: inline |
Checks if two 2D-lines both have intersection parameters within the given ranges for each line
|
Full Usage:
parameterA (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
Returns: float
The parameter at which the two rays intersect on line A,
This is NaN if A and B points are identical and the vectors are exactly parallel (zero divided by zero).
This is positive or negative Infinity for almost parallel lines.
Modifiers: inline |
Returns the intersection parameter on the first ray (A) where ray A and ray B intersect. Returns NaN or Infinity for zero length or parallel lines.
|
Full Usage:
parameters (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
Returns: float * float
A (t,u) tuple where t is the parameter on line A and u on line B at their intersection.
These are NaN if A and B points are identical and the vectors are exactly parallel (zero divided by zero).
These are positive or negative Infinity for almost parallel lines.
Modifiers: inline |
Returns the intersection parameters on both rays A and B. Returns NaN or Infinity for zero length or parallel lines.
|
Full Usage:
sqDistance (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
Returns: float
The squared distance between the two lines.
|
Gets the square distance between two finite lines. Works on Parallel lines too.
|
Full Usage:
tryIntersect (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
Returns: Pt voption
The intersection point if both parameters are within 0.0 to 1.0;
ValueNone otherwise or if parallel/coincident.
Modifiers: inline |
Returns the intersection point of two finite line segments if they intersect. This method uses a small tolerance of 1e-6 to account for numerical inaccuracies when checking the 0..1 range.
|
Full Usage:
tryIntersectInRangeA (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, minParameterA, maxParameterA)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
minParameterA : float
-
The minimum parameter value of the range, inclusive.
maxParameterA : float
-
The maximum parameter value of the range, inclusive.
Returns: Pt voption
A point if lineA has an intersection parameter in the range (inclusive min and max value).
ValueNone if the lines are parallel, coincident or the intersection parameter is outside of the range.
Modifiers: inline |
Returns the intersection point of two rays if it is within the given parameter range for line A.
|
Full Usage:
tryIntersectInRanges (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, minParameterA, maxParameterA, minParameterB, maxParameterB)
Parameters:
float
-
The X coordinate of the start point on the first line.
pAy : float
-
The Y coordinate of the start point on the first line.
pBx : float
-
The X coordinate of the start point on the second line.
pBy : float
-
The Y coordinate of the start point on the second line.
vAx : float
-
The X component of the vector of the first line.
vAy : float
-
The Y component of the vector of the first line.
vBx : float
-
The X component of the vector of the second line.
vBy : float
-
The Y component of the vector of the second line.
minParameterA : float
-
The minimum parameter value of the range, inclusive.
maxParameterA : float
-
The maximum parameter value of the range, inclusive.
minParameterB : float
-
The minimum parameter value of the range, inclusive.
maxParameterB : float
-
The maximum parameter value of the range, inclusive.
Returns: Pt voption
A point if both lines have an intersection parameter in the range (inclusive min and max value).
ValueNone if the lines are parallel, coincident or at least one intersection parameter is outside of the range.
Modifiers: inline |
Returns the intersection point of two rays if it is within the given parameter ranges for line A and line B.
|
Full Usage:
tryIntersectRay (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy, tangent)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
tangent : float<MeasureProduct<tangent, MeasureOne>>
-
The tangent value of the maximum allowed angle between the two line vectors.
Use the module Euclid.UtilEuclid.Tangent to set another tolerance here.
Returns: Pt voption
The point at which the two rays intersect or ValueNone.
Modifiers: inline |
Tries to get intersection point of two rays (rays are 2D lines extended infinitely). If the lines are parallel or coincident (within the tangent tolerance) or too short, ValueNone is returned.
|
Full Usage:
tryParameterA (pAx, pAy, pBx, pBy, vAx, vAy, vBx, vBy)
Parameters:
float
-
The X coordinate of the start point on the first ray.
pAy : float
-
The Y coordinate of the start point on the first ray.
pBx : float
-
The X coordinate of the start point on the second ray.
pBy : float
-
The Y coordinate of the start point on the second ray.
vAx : float
-
The X component of the vector of the first ray.
vAy : float
-
The Y component of the vector of the first ray.
vBx : float
-
The X component of the vector of the second ray.
vBy : float
-
The Y component of the vector of the second ray.
Returns: float voption
The parameter at which the two rays intersect on line A if it is smaller than 1e12 in absolute value,
or ValueNone if the parameter is bigger than 1e12 or if they are parallel or coincident.
Modifiers: inline |
Returns the intersection parameter on the first ray (A) where ray A and ray B intersect.
|
Euclid