Areal-Euclidean Equivalency

Explanation

In areal coordinates, a point has coordinates in terms of a simplex. The sum of coordinates is 1.
It’s often handy to convert to integers, {1/6,1/3,1/2} going to {1,2,3} and then dividing by the total before usage.
Some distance functions. The first is equivalent to euclidean distance:
In[]:=
DotDistance[u_,v_]:=Sqrt[u.u+v.v-2u.v];​​DotDistance2[u_,v_]:=u.u+v.v-2u.v;
Here are a 2D equilateral triangle and a 3D regular tetrahedron usable as simplices:
In[]:=
tri=-
1
2
,-
1
6
,0,
2
3
,
1
2
,-
1
6
;
In[]:=
tet={{-1,-1,1},{-1,1,-1},{1,-1,-1},{1,1,1}}/2;
Both simplices are chosen so that edgelengths are all
2
:
DotDistance@@#&/@Subsets[tri,{2}]

2
,
2
,
2

DotDistance@@#&/@Subsets[tet,{2}]

2
,
2
,
2
,
2
,
2
,
2

A function to go back and forth between areal coordinates and euclidean coordinates:
In[]:=
Areal[simplex_,point_]:=Module[{dim,var},​​dim=Dimensions[simplex];​​If[dim[[1]]Length[point]&&Chop[N[Total[point]-1]]0,​​(*ConvertfromAreal*)​​point.#&/@Transpose[simplex],​​(*ConverttoAreal*)​​var=Table[Subscript[x,a],{a,1,dim[[1]]}];​​var/.Solve[{var.#&/@Transpose[simplex]point,Total[var]1}][[1]]]];
Areal point
{a,b,c}
is on areal line
{A,B,C}
if their dot product
Aa+Bb+Cc
equals 0. A canonical areal line can have three forms:
•
{a,b,c}
with total 1.
•
{a,-1-a,1}
with total 0, going through the center point (1/3, 1/3, 1/3).
•
{1,-1,0}
, the vertical line through the center point.
A way to make the lines (fix this to work generally):
BaryLiner[{pt1_,pt2_}]:=Module[{a,b},If[Det[{pt1,pt2,{1,1,1}/3}]≠0,{a,b,1-a-b}/.Solve[{a,b,1-a-b}.#0&/@{pt1,pt2}][[1]],If[pt1[[1]]≠pt1[[2]],{a,-1-a,1}/.Solve[{a,-1-a,1}.#0&/@{pt1,pt2}][[1]],{1,-1,0}]]];
lineintersect[{{a1_,b1_,c1_},{a2_,b2_,c2_}}]:=With[{init={b1c2-b2c1,a2c1-a1c2,a1b2-a2b1}},If[Total[init]0,init,init/Total[init]]];
Three noncollinear points in three dimensions determine a unique plane with an equation of the form
Ax+By+Cz=D
, where
2
A
+
2
B
+
2
C
1
and
D
is the positive distance of the plane from the origin. The vector
(A,B,C)
is normal (perpendicular) to the plane and has norm (length) equal to 1. For such an equation, the signed distance from a point
(x,y,z)
to the plane is given by
(A,B,C,D)·(x,y,z,-1)
. Points on the same side of the plane have the same sign.
findPlaneEquation[{{x1_,y1_,z1_},{x2_,y2_,z2_},{x3_,y3_,z3_}}]:=​​Module[{pts,rowreduce,lastrr},​​pts=SortBy[{{x1,y1,z1},{x2,y2,z2},{x3,y3,z3}},N[#]&];​​If[Length[Union[pts]]1,(*point*)Return[pts]];​​rowreduce=RowReduce[Append[#,1]&/@pts];​​lastrr=Abs[Sign[Last[rowreduce]]];​​If[Total[lastrr]0,(*line*)Return[Drop[pts,{2}]],​​If[Total[Take[lastrr,3]]0,(*planethroughorigin*)​​Return[RootReduce[Append[#/Norm[#]&@(Last[SortBy[{a,b,c}/.​​Solve[Append[{a,b,c}.#0&/@pts,a^2+b^2+c^21]],Sign[#]&]]),0]]],​​(*planenotonorigin*)Return[-RootReduce[(#/Norm[Take[#,3]]&@Append[(Last/@rowreduce),-1])]]]]];
Bring in normed lines.
Liner[{pt1_,pt2_}]:=Det[{{x,y,1},{First[pt1],Last[pt1],1},{First[pt2],Last[pt2],1}}]
Here’s a set of 24 areal points on 24 areal lines (hover over to see).
set={{-1,1,2},{-1,2,1},{-1,2,3},{-1,2,4},{-1,3,2},{-1,4,2},{0,1,2},{0,2,1}};​​full=Flatten[{set,RotateLeft/@set,RotateRight/@set},1];Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],14,Bold]]&/@Table[{full[[k]],Sort[Areal[tri,#/Total[#]]&/@Select[full,full[[k]].#0&]]},{k,1,Length[full]}],White,{Disk[Areal[tri,#/Total[#]],.055],Black,Style[Text[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],Areal[tri,#/Total[#]]],12,Bold]}&/@full},ImageSize500]
Here’s a set of 27 areal points on 27 areal lines (hover over to see).
set={{-2,-1,4},{-2,1,3},{-1,1,1},{-1,2,0},{-1,2,1},{-1,3,2},{-1,4,2},{0,1,2},{1,1,2}};​​full=Flatten[{set,RotateLeft/@set,RotateRight/@set},1];​​Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],14,Bold]]&/@Table[{full[[k]],Sort[Areal[tri,#/Total[#]]&/@Select[full,full[[k]].#0&]]},{k,1,Length[full]}],White,{Disk[Areal[tri,#/Total[#]],.08],Black,Style[Text[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],Areal[tri,#/Total[#]]],9,Bold]}&/@full},ImageSize800]
Here’s a bunch of regular tetrahedra and equilateral triangles in areal coordinates:
arealtetras=
;​​arealtris=Drop[#,{3}]&/@Take[#,3]&/@arealtetras;
For the particular chosen simplex tet={{-1,-1,1},{-1,1,-1},{1,-1,-1},{1,1,1}}/2, using the distance function on the areal coordinates gives the same value as the distance function on the cartesian coordinates.
More examples showing that the areal distance is the same as the euclidean distance:
Also in the triangles, the areal distance is the same as the euclidean distance:

Making Levi Graphs

Levi graphs have vertices that are both lines and points.
If a point is on a line, they are connected by an edge.
The Fano plane is 7 points and 7 lines
The Levi graph of the Fano plane is the Heawood graph:
Another configuration and graph
A 96_6 Configuration and graph

Junk