Function Repository Resource:

HessianLine

Source Notebook

Get the Hessian normal form of a line passing through two given points on the Cartesian plane

Contributed by: Ed Pegg Jr

ResourceFunction["HessianLine"][pts]

returns the Hessian line for pts.

Details

Let and be the normal vector {a,b}, such that a2+b2=1. The Hessian normal form of a line is , with d the distance from the origin.
The Hessian normal form a x+b y-d=0 can also be written as {a,b,d}.{x,y,-1}=0. ResourceFunction["HessianLine"] returns the triple {a,b,d}.

Examples

Basic Examples (2) 

Find the Hessian line through two points:

In[1]:=
ResourceFunction["HessianLine"][{{2, 1}, {-2, 4}}]
Out[1]=

Show the plane, points, origin and normal vector:

In[2]:=
Graphics[{{ColorData[97, 1], {AbsoluteThickness[1.6], Hyperplane[{3/5, 4/5}, 2]},
   {AbsolutePointSize[5], Point[{{2, 1}, {-2, 4}}]}}, {Point[{0, 0}], Circle[{0, 0}, 1], Arrow[{{0, 0}, {3/5, 4/5}}]}}, PlotRange -> {{-3, 5}, {-3, 5}}]
Out[2]=

Scope (1) 

Use HessianLine with symbolic arguments:

In[3]:=
ResourceFunction["HessianLine"][{{x1, 1}, {x2, -2}}]
Out[3]=

Possible Issues (1) 

HessianPlane fails if the given points are identical:

In[4]:=
ResourceFunction["HessianLine"][{{0, 1}, {0, 1}}]
Out[4]=

Neat Examples (3) 

Find the Hessian lines through four points:

In[5]:=
pts = {{-1, -1}, {0, 0}, {1, -1}, {2, -4}};
hess = ResourceFunction["HessianLine"] /@ Subsets[pts, {2}]
Out[6]=

The lines are distinct, so no three points are on a line:

In[7]:=
Length[Union[hess]]
Out[7]=

Two of the lines have the same normal vector, so they are parallel:

In[8]:=
Select[Subsets[hess, {2}], Take[#[[1]], 2] == Take[#[[2]], 2] || Take[#[[1]], 2] == -Take[#[[2]], 2] &]
Out[8]=

Version History

  • 1.0.0 – 09 December 2022

Related Resources

Author Notes

Wanted to write a TrapezoidQ function, figured I should finish this first.

License Information