Description
Return planar closed-segment intersection witnesses, including degenerate-point and collinear overlap cases; exact floating comparisons, no robust geometry guarantee.
Planar geometry operates on two-coordinate Cartesian points and explicit shape boundaries. A closed rectangle includes its edges, while a segment parameter locates a point along a supporting line. Signed cross products, areas and axis gaps preserve orientation or direction information that a magnitude alone would lose.
Return planar closed-segment intersection witnesses, including degenerate-point and collinear overlap cases; exact floating comparisons, no robust geometry guarantee.
When to use this tool
Use this tool to return planar closed-segment intersection witnesses, including degenerate-point and collinear overlap cases; exact floating comparisons, no robust geometry guarantee.
How to use the tool and how it works
- Enter a, b, c, d using the input definitions below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.kind, result.points. Interpret signs, units, ordering and null values using the rules below.
For nonparallel segment directions solve both line parameters and retain a point only when both lie in [0,1]. For parallel or degenerate cases collect shared endpoints, remove exact repeats, and sort by x then y; return none, point or overlap with overlap endpoints.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| a | First point [x,y]; for segment-pair tools this is the first segment’s start. | Dense list of at most 128 finite numbers, subject to the stated integer/shape rules. |
| b | Second point [x,y]; for segment-pair tools this is the first segment’s end. | Dense list of at most 128 finite numbers, subject to the stated integer/shape rules. |
| c | Third point [x,y]; for segment-pair tools this is the second segment’s start. | Dense list of at most 128 finite numbers, subject to the stated integer/shape rules. |
| d | Second segment’s end point [x,y]. | Dense list of at most 128 finite numbers, subject to the stated integer/shape rules. |
| Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.kind | Intersection class: none, point or overlap. |
| result.points | Ordered resulting point coordinates under the stated clipping/intersection rule. |
{
"input": {
"a": [
0,
0
],
"b": [
2,
2
],
"c": [
0,
2
],
"d": [
2,
0
]
},
"output": {
"result": {
"kind": "point",
"points": [
[
1,
1
]
]
}
}
} Limitations and assumptions
- Exact floating comparisons decide parallelism and collinearity; nearly coincident geometry can be sensitive to roundoff.
- Point components and rectangle bounds are finite within ±1,000,000,000. Rectangles use [minX,minY,maxX,maxY] with ordered inclusive bounds. Floating arithmetic is used without an implicit robustness tolerance.
- Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.
Alternative or Complementary methods
Choose the boundary and coordinate convention explicitly. Use robust geometric predicates or a topology-aware library when near-coincidence, holes, invalid polygons or geographic coordinates matter.
References
Similar or alternative tools
- Point Segment Clamped Nearest Point
Find the clamped nearest point on a nondegenerate planar segment and its Euclidean distance; finite number arithmetic, not a spatial index.
- Point Segment Projection Parameter
Project a point onto the infinite supporting segment line and return the unclamped parameter; a degenerate segment is rejected.