Loïc Grenié on Wed, 07 Feb 2024 18:04:16 +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 ℤ³


Le mer. 7 févr. 2024 à 17:07, <hermann@stamm-wilbrandt.de> a écrit :
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].

Which builtin PARI/GP function that can determine the normal vector for
points on a plane in ℤ³?

    I'd do it that way:

{
v=[[-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]];
}
v=apply(x->x-v[1],v);
matker(Mat(Col(v)))
[0]
[0]
[1]

   There are probably better ways.

          Loïc