|
|
◆ linesegm_intersect()
| static IntersectResult linesegm_intersect |
( |
double |
ax, |
|
|
double |
ay, |
|
|
double |
rx, |
|
|
double |
ry, |
|
|
double |
cx, |
|
|
double |
cy, |
|
|
double |
dx, |
|
|
double |
dy |
|
) |
| |
|
inlinestatic |
Return the intersection value obtained by computing the intersection of a line segment defined by two 2D points intersects an edge.
Possible result values
- No intersection: INTERSECT_NONE -> t0 and t1 undefined
- Single point: INTERSECT_POINT -> t1 in [0,1], t1 ignored
- Overlap segment: INTERSECT_OVERLAP -> t0 <= t1 in [0,1] Invariants:
- 0 <= t0 <= 1
- 0 <= t1 <= 1
- t0 <= t1
- Overlap must satisfy: t1 - t0 > FP_TOLERANCE
- Parameters
-
| [in] | ax,ay | Coordinates of the first point defining the first segment |
| [in] | rx,ry | Vector AB |
| [in] | cx,cy,dx,dy | Coordinates of the points defining the second segment |
- Note
- To avoid recomputing vector AB in EVERY call to the functions, we pass the vector instead of the second point b computed as follows
double rx = bx - ax, ry = by - ay;
|