Get[FileNameJoin[{NotebookDirectory[],"Packages","RigidAlgebra2D.wl"}]]

HeadingColor=RGBColor["#FFA9A9"];
NonzeroColor=RGBColor["#FAF6C1"];
WedgeColor=RGBColor["#FAF6C1"];
TranswedgeColor1=RGBColor["#D0FFE0"];
TranswedgeColor2=RGBColor["#C0ECFF"];MetricColor=RGBColor["#FFC67B"];

Complements

Grid[{Table[BasisList[[x]],{x,1,8}]//Prepend[Style["Basis element",Bold]],
Table[Comp[BasisList[[x]]],{x,1,8}]//Prepend[Style["Complement",Bold]]},
ItemSize->{{12,{3.5}},2},Spacings->{0,0.2},Dividers->{DividerList,{Thick,Thick,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Reverses

Grid[{Table[BasisList[[x]],{x,1,8}]//Prepend[Style["Basis element",Bold]],
Table[Rev[BasisList[[x]]],{x,1,8}]//Prepend[Style["Reverse",Bold]],
Table[Antirev[BasisList[[x]]],{x,1,8}]//Prepend[Style["Antireverse",Bold]]},
ItemSize->{{12,{3.5}},2},Spacings->{0,0.2},Dividers->{DividerList,{Thick,Thick,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Duals

Grid[{Table[BasisList[[x]],{x,1,8}]//Prepend[Style["Basis element",Bold]],
Table[BulkDual[BasisList[[x]]],{x,1,8}]//Prepend[Style["Bulk dual",Bold]],
Table[WeightDual[BasisList[[x]]],{x,1,8}]//Prepend[Style["Weight dual",Bold]]},
ItemSize->{{12,{3.5}},2},Spacings->{0,0.2},Dividers->{DividerList,{Thick,Thick,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Inner Products

DotItem[i_,j_]:=Module[{x},x=BasisList[[i]]\[Dot]BasisList[[j]];If[Coefficient[x,e[]]==0,Item[x],Item[x,Background->MetricColor]]]

AntidotItem[i_,j_]:=Module[{x},x=BasisList[[i]]\[Antidot]BasisList[[j]];If[Coefficient[x,e[3,2,1]]==0,Item[x],Item[x,Background->MetricColor]]]

Dot Product

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[DotItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Antidot Product

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[AntidotItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Exterior Products

WedgeItem[i_,j_]:=Module[{x},x=BasisList[[i]]∧BasisList[[j]];If[FreeQ[x,e],Item[x],Item[x,Background->NonzeroColor]]]

AntiwedgeItem[i_,j_]:=Module[{x},x=BasisList[[i]]∨BasisList[[j]];If[FreeQ[x,e],Item[x],Item[x,Background->NonzeroColor]]]

Wedge Product

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[WedgeItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Antiwedge Product

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[AntiwedgeItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Interior Products

BulkContractionItem[i_,j_]:=Module[{p},p=BulkContraction[BasisList[[i]],BasisList[[j]]];If[FreeQ[p,e],Item[p],If[i!=j,Item[p,Background->NonzeroColor],Item[p,Background->MetricColor]]]]

WeightContractionItem[i_,j_]:=Module[{p},p=WeightContraction[BasisList[[i]],BasisList[[j]]];If[FreeQ[p,e],Item[p],If[i!=j,Item[p,Background->NonzeroColor],Item[p,Background->MetricColor]]]]

BulkExpansionItem[i_,j_]:=Module[{p},p=BulkExpansion[BasisList[[i]],BasisList[[j]]];If[FreeQ[p,e],Item[p],If[i!=j,Item[p,Background->NonzeroColor],Item[p,Background->MetricColor]]]]

WeightExpansionItem[i_,j_]:=Module[{p},p=WeightExpansion[BasisList[[i]],BasisList[[j]]];If[FreeQ[p,e],Item[p],If[i!=j,Item[p,Background->NonzeroColor],Item[p,Background->MetricColor]]]]

Bulk Contraction

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[BulkContractionItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Weight Contraction

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[WeightContractionItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Bulk Expansion

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[BulkExpansionItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Weight Expansion

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[WeightExpansionItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Transwedge Products

TranswedgeItem[i_,j_]:=Module[{x0,x1,x2},x0=BasisList[[i]]∧BasisList[[j]];x1=TranswedgeProduct[BasisList[[i]],BasisList[[j]],1];x2=-TranswedgeProduct[BasisList[[i]],BasisList[[j]],2];If[FreeQ[x0,e],If[FreeQ[x1,e],If[FreeQ[x2,e],Item[x2],Item[x2,Background->TranswedgeColor2]],Item[x1,Background->TranswedgeColor1]],Item[x0,Background->WedgeColor]]]

AntiTranswedgeItem[i_,j_]:=Module[{x0,x1,x2},x0=BasisList[[i]]∨BasisList[[j]];x1=TranswedgeAntiproduct[BasisList[[i]],BasisList[[j]],1];x2=-TranswedgeAntiproduct[BasisList[[i]],BasisList[[j]],2];If[FreeQ[x0,e],If[FreeQ[x1,e],If[FreeQ[x2,e],Item[x2],Item[x2,Background->TranswedgeColor2]],Item[x1,Background->TranswedgeColor1]],Item[x0,Background->WedgeColor]]]

Transwedge Products

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[TranswedgeItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Transwedge Antiproducts

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[AntiTranswedgeItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Geometric Products

GeometricItem[i_,j_]:=Module[{g,w},g=BasisList[[i]]\[Geometric]BasisList[[j]];w=BasisList[[i]]∧BasisList[[j]];If[FreeQ[g,e],Item[g],If[FreeQ[g-w,e]&&i!=j,Item[g,Background->NonzeroColor],If[i==j,Item[g,Background->MetricColor],Item[g]]]]]

AntigeometricItem[i_,j_]:=Module[{g,w},g=BasisList[[i]]\[Antigeometric]BasisList[[j]];w=BasisList[[i]]∨BasisList[[j]];If[FreeQ[g,e],Item[g],If[FreeQ[g-w,e]&&i!=j,Item[g,Background->NonzeroColor],If[i==j,Item[g,Background->MetricColor],Item[g]]]]]

Geometric Product

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[GeometricItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Geometric Antiproduct

Grid[{Table[BasisList[[k]],{k,1,8}]//Prepend[Style["",Bold]]}~Join~
Table[Table[AntigeometricItem[i,j],{j,1,8}]//Prepend[BasisList[[i]]],{i,1,8}],
ItemSize->{3.5,2},Spacings->{0,0.2},Dividers->{DividerList,DividerList},Background->{None,{HeadingColor},Table[{i,1}->HeadingColor,{i,2,9}]}]//TraditionalForm

Objects

ObjectList:={z,p,g,Q,F}

NameList:={"Magnitude","Point","Line","Motor","Flector"}

Magnitude

z:=x e[]+y e[3,2,1]

Point

p:=px e[1]+py e[2]+pz e[3]

q:=qx e[1]+qy e[2]+qz e[3]

Line

g:=gx e[2,3]+gy e[3,1]+gz e[1,2]

h:=hx e[2,3]+hy e[3,1]+hz e[1,2]

Motor

Q:=Qx e[1]+Qy e[2]+Qz e[3]+Qw e[3,2,1]

Flector

F:=Fw e[]+Fx e[2,3]+Fy e[3,1]+Fz e[1,2]

Attitude

Grid[{{"",Style["Object",Bold],Style["Attitude",Bold]}}~Join~
Table[{Style[NameList[[i]],Bold],ObjectList[[i]],Attitude[ObjectList[[i]]]},{i,1,Length[ObjectList]}],
ItemSize->Full,Spacings->{1.5,1.5},Dividers->{{Thick,Thick,True,Thick},{Thick,Thick,True,True,True,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Duals

Grid[{{"",Style["Object",Bold],Style["Bulk Dual",Bold],Style["Weight Dual",Bold]}}~Join~
Table[{Style[NameList[[i]],Bold],ObjectList[[i]],BulkDual[ObjectList[[i]]],WeightDual[ObjectList[[i]]]},{i,1,Length[ObjectList]}],
ItemSize->Full,Spacings->{1.5,1.5},Dividers->{{Thick,Thick,True,True,Thick},{Thick,Thick,True,True,True,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Norms

Grid[{{"",Style["Object",Bold],Style["Bulk Norm",Bold],Style["Weight Norm",Bold],Style["Geometric Norm",Bold]}}~Join~
Table[{Style[NameList[[i]],Bold],ObjectList[[i]],BulkNorm[ObjectList[[i]]],WeightNorm[ObjectList[[i]]],GeometricNorm[ObjectList[[i]]]},{i,1,Length[ObjectList]}],
ItemSize->Full,Spacings->{1.5,1.5},Dividers->{{Thick,Thick,True,True,True,Thick},{Thick,Thick,True,True,True,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Unitization

Grid[{{"",Style["Object",Bold],Style["Unitization",Bold]}}~Join~
Table[{Style[NameList[[i]],Bold],ObjectList[[i]],Coefficient[WeightNorm[ObjectList[[i]]],e[3,2,1]]^2==1},{i,1,Length[ObjectList]}],
ItemSize->Full,Spacings->{1.5,1.5},Dividers->{{Thick,Thick,True,Thick},{Thick,Thick,True,True,True,True,Thick}},Background->{None,{HeadingColor}}]//TraditionalForm

Join and Meet

Line containing points p and q

p∧q//BasisForm

Point where lines g and h intersect

g∨h//BasisForm

Expansion

Line perpendicular to line g and containing point p

WeightExpansion[p,g]//BasisForm

Measurements

Distance between points p and q

HomogeneousDistance[p,q]//BasisForm

Distance between point p and line g

Simplify[HomogeneousDistance[p,g]]//BasisForm

Cosine of angle between lines g and h

HomogeneousAngle[g,h]//BasisForm

Reflection

Simplify[-Antisandwich[g,p],{gx^2+gy^2==1}]//BasisForm

-OperatorMatrix[g,{gx^2+gy^2==1}]//MatrixForm

Translation

translation:=-ty/2 e[1]+tx/2 e[2]+e[3,2,1]

Antisandwich[translation,p]//BasisForm

OperatorMatrix[translation]//MatrixForm

License

MIT License

Copyright (c) 2025 Eric Lengyel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.