4 deleted 51 characters in body
source | link

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

Jason B gave a nice answer, but I realize now I needit needs it to work with both LineLine[]'s and InfiniteLine's. And naively changing __InfiniteLine to __InfiniteLine[] in, for which the triangles[] function below doesn't work:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines, LightBlue, Triangle /@ triangles[lines]}, 
  Frame -> True, PlotRange -> All, AspectRatio -> 1]

enter image description here

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

Jason B gave a nice answer, but I realize now I need it to work with both Line's and InfiniteLine's. And naively changing __InfiniteLine to __ in the triangles[] function below doesn't work:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines, LightBlue, Triangle /@ triangles[lines]}, 
  Frame -> True, PlotRange -> All, AspectRatio -> 1]

enter image description here

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

Jason B gave a nice answer, but it needs it to work with both Line[] and InfiniteLine[], for which the triangles[] function below doesn't work:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines, LightBlue, Triangle /@ triangles[lines]}, 
  Frame -> True, PlotRange -> All, AspectRatio -> 1]

enter image description here

    Tweeted twitter.com/StackMma/status/971105743494635520
3 added 107 characters in body
source | link

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

Jason B gave a nice answer, but I realizedrealize now I need it to work with both Lines's and InfiniteLines's. And naively changing __InfiniteLine to __ in the triangles[] function below doesn't work:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines(*, LightBlue, Triangle /@triangles[lines]*)@ triangles[lines]}, 
  Frame -> True, PlotRange -> All]All, AspectRatio -> 1]

enter image description here

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

I realized I need it to work with both Lines and InfiniteLines:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines(*,LightBlue,Triangle/@triangles[lines]*)}, 
  Frame -> True, PlotRange -> All]

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

Jason B gave a nice answer, but I realize now I need it to work with both Line's and InfiniteLine's. And naively changing __InfiniteLine to __ in the triangles[] function below doesn't work:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines, LightBlue, Triangle /@ triangles[lines]}, 
  Frame -> True, PlotRange -> All, AspectRatio -> 1]

enter image description here

2 added 385 characters in body
source | link

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

I realized I need it to work with both Lines and InfiniteLines:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines(*,LightBlue,Triangle/@triangles[lines]*)}, 
  Frame -> True, PlotRange -> All]

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

There are at least a few non-overlapping triangles made by the lines in the following graphic, how would I isolate them?

pts = RandomReal[1, {7, 2, 2}];
g = Graphics[{InfiniteLine @@@ pts}, Frame -> True, 
  PlotRange -> {{-1, 2}, {-1, 3}}]

enter image description here

Update:

I realized I need it to work with both Lines and InfiniteLines:

SeedRandom[4430];
pts = RandomReal[1, {3, 2, 2}];
l = InfiniteLine @@@ pts; h = 
 Line@{{{0, 0}, {0, 2}}, {{0, 1}, {1, 1}}, {{1, 0}, {1, 2}}};
lines = Join[l, {h}];
g = Graphics[{lines(*,LightBlue,Triangle/@triangles[lines]*)}, 
  Frame -> True, PlotRange -> All]
1
source | link