[英]how to create a plane from 4 corner points in matlab?
我怀疑 MATLAB 的图形对象是否内置了很多数学功能。 我认为达到最终目标的最佳方法是自己进行算术运算。
您应该记住的一个数学属性是,唯一地定义一个平面只需要 3 个点。 平面上的第 4 个点不是必需的。
方法的快速总结:
示例代码:
x = [35.625, 35.7 , 35.825, 35.75];
y = [56.25 , 56.25, 59.25 , 59.25];
% This example assumes vectors are column vectors
% Must be 3 element vectors to perform cross product
v1 = [x(2)-x(1)
y(2)-y(1)
0];
v2 = [x(3)-x(1)
y(3)-y(1)
0];
n = cross(v1, v2);
n_hat = n / norm(n, 2);
% the unused 4th point should have zero distance to the plane, so d4=0
p4 = [x(4); y(4); 0];
d4 = dot(n_hat, p4)
% the point d5=[0,0,2] is 2 units above the plane, so d5=0
p5 = [0; 0; 2];
d5 = dot(n_hat, p5)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.