I would like a quick test to tell me that segments $ab$ and $cd$ cannot intersect in the plane. If the maximum $x$-coordinate of $a$ and $b$ is less than the minimum $x$-coordinate of $c$ and $d$, then they cannot intersect. Etc.:
max = Max[a[[1]], b[[1]]];
min = Min[c[[1]], d[[1]]];
(*ab leftof cd*)
If[max < min, Return[False]];
max = Max[c[[1]], d[[1]]];
min = Min[a[[1]], b[[1]]];
(*cd leftof ab*)
If[max < min, Return[False]];
...
I feel this is rather clumsy coding. What is (a) a more concise coding, and (b) recognizing this is for speed, a more efficient bounding-box rejection.
The same question can be asked for $\mathbb{R}^d$ for $d>2$ (athough then it would likely be higher-dimensional objects determining the bounding box).
RegionIntersection
and compare that withEmptyRegion
. It would look clean, but I'm not sure how it would do performance-wise. $\endgroup$RegionIntersection
,RegionIntersection[Line[ab], Line[cd], Rectangle[]]
$\endgroup$