Bill Allombert on Wed, 07 Feb 2024 18:15:37 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: how to determine normal vector for points on a plane in ℤ³


On Wed, Feb 07, 2024 at 05:06:53PM +0100, hermann@stamm-wilbrandt.de wrote:
> I want to determine the normal vector of points in ℤ³ that I know by
> construction are on same plane.
> 
> Just learned how to do that with JSCAD "plane.fromPoints()", but while the
> first example result looks OK, null vector as normal vector in 2nd example
> does not make sense:
> https://discord.com/channels/775984095250612234/914627480512503829/1204797915433013289
> 
> Since I generated the JSCAD code from PARI/GP, I would like to determine the
> normal vector for say these vertices from above thread (with screenshot
> there) in PARI/GP:
> [[-1, -3, -1], [0, -3, -1], [1, -3, -1], [-2, -2, -1], [-1, -2, -1], [0, -2,
> -1], [1, -2, -1], [2, -2, -1], [-3, -1, -1], [-2, -1, -1], [-1, -1, -1], [0,
> -1, -1], [1, -1, -1], [2, -1, -1], [3, -1, -1], [-3, 0, -1], [-2, 0, -1],
> [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [3, 0, -1], [-3, 1, -1],
> [-2, 1, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], [2, 1, -1], [3, 1, -1],
> [-2, 2, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], [0, 3, -1],
> [1, 3, -1]]
> 
> I would say that normal vector should be either [0,0,1] or [0,0,-1].

I assume you means 'the same affine plane', and the normal vector 
is not unique.
All you need to do is to find a,b,c,d so that, for all your points, 
  a*x+b*y+c*z+d=0

So just add a component 1 to your vectors and take the kernel

? matker(Mat(apply(x->concat(x,1),V~)))
%15 = [0;0;1;1]

So a=0, b=0 and c=1 so one of the normal vectors is [0,0,1]

Cheers,
Bill