Function tryLineIntersectionPoint
Constructs the unique intersection point of two valid unbounded lines.
Topological classification remains authoritative and exact.
Preconditions
- first is finite and nondegenerate;
- second is finite and nondegenerate.
Supported input scalar types:
int long float double
The constructed point uses IntersectionScalar!T, which is currently
double for every supported input scalar.
Returns true exactly when:
- lineIntersectionKind(first, second) == LineIntersectionKind; and
- both exact coordinates round to finite values in the construction scalar.
Returns false for:
- distinct parallel lines; - coincident lines; - a mathematically unique intersection whose rounded public coordinate is not finite.
Every false path leaves point == Point2!R.
No floating-point arithmetic participates before the final correctly rounded binary64 conversion.
The returned point is construction data and must not be used as evidence
for topology already established by lineIntersectionKind.
No allocation is performed.
Complexity
time O(1) space O(1)
Example
Example constructing an unbounded-line intersection through the public API.
import geo;
alias P = Point2!int;
alias V = Vector2!int;
alias L = Line2!int;
auto first =
L(
P(0, 0),
P(10, 10)
);
auto second =
L(
P(0, 10),
V(10, -10)
);
Point2!double point;
assert(
tryLineIntersectionPoint(
first: first,
second: second,
point: point
)
);
assert(
point ==
Point2!double(
5.0,
5.0
)
);