hermann on Wed, 07 Feb 2024 18:41:02 +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 2024-02-07 18:15, Bill Allombert wrote:
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
Thanks for both answers. Bill's method only adds a 1 to each vector Loïc's method does vector subtraction for all vectors. So I will go with Bill's method:? P=[[1, 0, 2], [1, 1, 1], [-2, 0, -1], [0, 0, 1], [-1, 1, -1], [-1, -1, 1], [0, 2, -1], [1, 2, 0], [-2, -1, 0], [0, 1, 0], [-1, 0, 0]];
? matker(Mat(apply(x->concat(x,1),P~)))[1..3,1] %9 = [1, -1, -1]~? P=[[-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]];
? matker(Mat(apply(x->concat(x,1),P~)))[1..3,1] %11 = [0, 0, 1]~ ? I will raise an issue against incorrect implementation in JSCAD: https://discord.com/channels/775984095250612234/914627480512503829/1204817782265479280(they add normal vectors for vertices (i, i+1, i+2) and normalize, but for 2nd example the sum is the null vector).
Regards, Hermann.