My question departs from this one: Find intersection of pairs of straight lines
but now I want to find the points with the new V10 Region
-functions.
lines =
{{Line[{{243.8`, 77.`}, {467.4`, 12.`}}], Line[{{356.8`, 32.`}, {363.2`, 120.`}}]},
{Line[{{291.8`, 130.`}, {476.`, 210.5`}}], Line[{{346.`, 245.`}, {393.8`, 158.`}}]},
{Line[{{103.2`, 327.`}, {245.2`, 110.5`}}], Line[{{163.8`, 211.5`}, {230.2`, 250.`}}]},
{Line[{{47.4`, 343.`}, {87.4`, 108.5`}}], Line[{{54.6`, 225.`}, {139.6`, 220.`}}]},
{Line[{{371.`, 506.5`}, {384.6`, 277.`}}], Line[{{366.`, 394.5`}, {451.8`, 372.`}}]},
{Line[{{264.6`, 525.5`}, {353.8`, 294.5`}}], Line[{{241.`, 398.`}, {321.`, 411.5`}}]},
{Line[{{113.2`, 484.5`}, {296.`, 304.5`}}], Line[{{163.2`, 347.`}, {213.2`, 406.5`}}]},
{Line[{{459.6`, 604.5`}, {320.2`, 466.5`}}], Line[{{332.4`, 596.5`}, {402.4`, 528.5`}}]},
{Line[{{288.2`, 630.5`}, {199.6`, 446.5`}}], Line[{{176.`, 585.5`}, {256.`, 530.5`}}]},
{Line[{{138.8`, 615.5`}, {81.8`, 410.`}}], Line[{{38.2`, 553.`}, {122.4`, 507.`}}]},
{Line[{{232.4`, 795.`}, {461.8`, 727.`}}], Line[{{345.2`, 774.5`}, {345.2`, 688.`}}]},
{Line[{{27.4`, 671.5`}, {206.8`, 763.5`}}], Line[{{104.6`, 728.`}, {161.8`, 647.`}}]}};
This function finds the points but is horribly slow:
(points = Point /@ RegionCentroid /@ DiscretizeRegion /@ RegionUnion @@@ lines); //
Timing // First
1.591210
Graphics[{lines, {Red, [email protected], points}}, Frame -> True]
The next function finds the same points in less time (0.28 seconds), but is ugly and probably not general enough.
points = Cases[Show[DiscretizeRegion /@ RegionIntersection @@@ lines],
{a_Real, b_Real} :> Point[{a, b}], Infinity];
I hope somebody can suggest a fast and terse V10-method to find intersection points in 2 dimensions
Point[{x, y}] /. Solve[{x, y} \[Element] #, {x, y}] & /@ RegionIntersection @@@ lines
the sort of thing you want? You have lots of requirements, fast, terse, V10, which might not be satisfied simultaneously. But this one is about four times faster than your last one. $\endgroup$