Wolfram Research

Function Repository Resource:

FindExtraordinaryLines

Source Notebook

Return the lines of three or more points, given a set of points

Contributed by: Ed Pegg Jr

ResourceFunction["FindExtraordinaryLines"][pts]

returns indices for sets of three or more points on the same line, given pts.

Details and Options

For a finite set of points, a line going through only two points is called an ordinary line.

Examples

Basic Examples

Here are 11 points that make 15 lines of three points each:

In[1]:=
pts = {{0, 0}, {6, -6}, {-6, 6}, {-2, -6}, {2, 6}, {6, 6}, {-6, -6}, {-6, 0}, {6, 0}, {0, 3}, {0, -3}};
lines = ResourceFunction["FindExtraordinaryLines"][pts]
Out[2]=

A graphic showing the points and lines:

In[3]:=
Graphics[{Cyan, Line[pts[[#]]] & /@ lines,
  Black, Table[Style[Text[n, pts[[n]]], 20], {n, 1, Length[pts]}]}]
Out[3]=

Scope

Here is a set of 20 lattice points where all lines are ordinary:

In[4]:=
pts = {{1, 5}, {1, 6}, {2, 3}, {2, 8}, {3, 2}, {3, 9}, {4, 4}, {4, 7}, {5, 1}, {5, 10}, {6, 1}, {6, 10}, {7, 4}, {7, 7}, {8, 2}, {8, 9}, {9, 3}, {9, 8}, {10, 5}, {10, 6}};
lines = ResourceFunction["FindExtraordinaryLines"][pts]
Out[5]=
In[6]:=
Graphics[{Cyan, Line[pts[[#]]] & /@ lines,
  Black, Table[Style[Text[n, pts[[n]]], 20], {n, 1, Length[pts]}]}]
Out[6]=

Most sets of 20 points from this lattice will have many extraordinary lines:

In[7]:=
pts = Sort[RandomSample[Tuples[Range[10], {2}], 20]]; lines = ResourceFunction["FindExtraordinaryLines"][pts]
Out[7]=
In[8]:=
Graphics[{Cyan, Line[pts[[#]]] & /@ lines,
  Black, Table[Style[Text[n, pts[[n]]], 20], {n, 1, Length[pts]}]}]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information