3

I have an array of lines that produce random shapes. These lines define edge boundaries from an array that I would like to use to reconstruct the main feature of the array. Can Mathematica find the points where most of these lines cross, and then define the largest area(s) inside these crossing points? I assume this will give me the main area(s) of the array to look at as in the example plot image. These lines are boundary lines and crossing too many reduces the accuracy of the area plot. There are 4 lines creating most boundaries. The first of those 4 is the line used in the plot below

lines={{{900., 703.449}, {590.556, 0.}}, {{900., 475.145}, {651.23, 0.}}, {{900., 286.849}, 
{660.333, 0.}}, {{900., 503.578}, {178.177,0.}}, {{0., 707.111}, {900., 689.133}}, {{231.482, 1093.}, {302.527, 0.}}, {{853.322, 1093.}, {568.821, 0.}}, {{513.461, 1093.},
{411.662, 0.}}, {{900., 521.686}, {514.729, 0.}}, {{280.141, 1093.}, {248.479, 0.}}, {{0., 183.582}, 
{900., 312.065}}, {{0., 648.073}, {900., 682.241}}, {{0.,110.149}, {900., 507.127}}, {{0., 402.186}, 
{900., 389.603}}, {{900., 605.326}, {324.743, 0.}}, {{706.587, 1093.}, {720.777, 0.}}, {{900., 86.9532}, 
{769.336, 0.}}, {{900., 539.768}, {610.491, 0.}}, {{900., 464.134}, {113.723, 0.}}, {{900.,428.16}, 
{47.3056, 0.}}, {{0., 1000.61}, {900., 988.023}}, {{316.911, 1093.}, {889.171, 0.}}, {{0., 337.878}, 
{900., 399.087}}, {{0., 492.562}, {900., 451.191}}, {{0.,344.122}, {900., 272.07}}, {{0., 151.791}, 
{900., 369.811}}, {{502.51, 1093.}, {352.038, 0.}}, {{0., 136.204}, {900.,460.163}}, {{177.623, 1093.}, {404.553, 0.}}, {{900., 234.416}, {665.35, 0.}}, {{900., 679.326}, {446.947, 0.}}, {{900., 1089.37}, {312.902, 0.}}, {{0., 652.435}, {900., 207.253}}, {{900.,115.841}, {712.418, 0.}}, {{900., 806.604}, {220.582, 0.}}, {{0., 783.297}, {900., 616.042}}, {{0., 1055.81}, {900., 938.313}}, {{300.376, 1093.}, {156.573, 0.}}, {{684.328, 1093.}, 
{770.733, 0.}}, {{0., 679.389}, {900., 733.378}}, {{900.,135.671}, {751.702, 0.}}, {{0., 1052.08}, 
{900., 822.61}}, {{900., 544.556}, {246.914, 0.}}, {{900., 879.237}, {32.7302, 1093.}}, {{0., 972.41}, 
{900., 956.231}}, {{0., 1026.6}, {900., 857.481}}, {{619.175, 1093.}, {818.911, 0.}}, {{0., 9.58286}, 
{900., 624.196}}, {{626.404, 1093.}, {555.359, 0.}}, {{772.244, 1093.}, {419.036, 0.}}, {{355.762, 1093.}, 
{105.964, 0.}}, {{900., 107.987}, {588.194, 1093.}}, {{806.666, 1093.}, {318.024, 0.}}, {{0., 86.1212}, 
{900., 760.554}}, {{279.164, 1093.}, {358.983, 0.}}, {{0., 27.23}, {900., 260.535}}, {{0., 169.335}, 
{900., 228.737}}, {{491.48, 1093.}, {96.8161, 0.}}, {{0., 404.323}, {900., 470.951}}, {{900., 681.523}, 
{342.039, 0.}}, {{732.078, 1093.}, {671.987, 0.}}, {{610.656, 1093.}, {406.405, 0.}}, {{0., 1069.95}, 
{900.,163.635}}, {{112.851, 1093.}, {397.351, 0.}}, {{0., 72.2908}, {900., 65.1008}}, {{644.998, 1093.}, 
{702.9, 0.}}, {{900., 720.816}, {203.947, 0.}}, {{549.162, 1093.}, {374.145, 0.}}, {{446.497, 1093.}, 
{434.49, 0.}}, {{0., 42.0853}, {900., 106.906}}, {{0., 743.122}, {900., 596.242}}, {{0.,630.275}, 
{900., 744.118}}, {{39.5396, 1093.}, {449.074, 0.}}};

Result Showing Largest Bounded Area

Thanks for your help!

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Nothingtoseehere
  • 4,518
  • 2
  • 30
  • 58
  • 1
    I feel this is a little underspecified... What is the criterion for determining the area in pink? You say: "find the points where these lines cross, and then define the largest area", but I can visually pick out areas that are larger than the one that you've highlighted and bounded by lines. – rm -rf Nov 20 '12 at 23:16
  • So which are you looking for? The area defined by the largest NUMBER of lines or the largest area define by ANY amount of lines? Also, as rm-rf notes, your example isn't very accurate. Do you perhaps mean the largest such area which does not contain any other areas bounded by lines? – VF1 Nov 20 '12 at 23:18
  • Understood, please see my edits – Nothingtoseehere Nov 20 '12 at 23:39
  • What's an area inside some points? – Rojo Nov 21 '12 at 00:33
  • @Rojo not sure. but if your referring to the above question, I'm looking for "the largest area(s) inside these crossing points" – Nothingtoseehere Nov 21 '12 at 01:00
  • 2
    I think what everyone is asking is, why not this area instead of what you've drawn? Or something even bigger? –  Nov 21 '12 at 01:09
  • @RahulNarain Good Question, these lines are boundary lines and crossing too many reduces the accuracy of the area plot. There are 4 lines creating most boundaries. The first of those 4 is the line used in the above plot. – Nothingtoseehere Nov 21 '12 at 01:18
  • 4
    Okay, so what characteristic defines a boundary line and what is "too many" crossings? Also, since this shape is not a quadrilateral, there are obviously more than four bounding lines. To be honest I find the definition of this problem completely incomprehensible... – Oleksandr R. Nov 21 '12 at 10:19

1 Answers1

7

Did you see this answer by J. M.?

If you apply it on your set of lines, you can extract all the intersection points:

Graphics`Mesh`MeshInit[];

pts = FindIntersections[Line /@ lines]; (*intersection points*)

Graphics[{{AbsoluteThickness[1], 
   Line /@ lines}, {Directive[Red, AbsolutePointSize[4]], 
   Point[pts]}}]

line intersections

You could then use SmoothDensityHistogram to visualize where the intersections are denser, but you have then to choose a criterion to pick the corners that would define your polygon.

SmoothDensityHistogram[pts]

density of intersections

VLC
  • 9,818
  • 1
  • 31
  • 60