[英]how to create a plane from 4 corner points in matlab?
i'm trying to make a plane of 4 points that are in the corners of the plane.我正在尝试制作一个位于飞机角落的 4 个点的飞机。 I used the Patch function to display this plane but I need the equation of this plane.我使用了 Patch 函数来显示这个平面,但我需要这个平面的方程。 Is there a way to do this in matlab?有没有办法在matlab中做到这一点? In fact, I want to calculate the distance of a set of points from this page.实际上,我想计算一组点与此页面的距离。 Is this also possible using the Patch function?这也可以使用 Patch 功能吗?
I am doubtful MATLAB's graphical objects have much mathematical capability built into them.我怀疑 MATLAB 的图形对象是否内置了很多数学功能。 I think the best way to reach your end goal is to do the arithmetic yourself.我认为达到最终目标的最佳方法是自己进行算术运算。
A mathematical property that you should keep in mind is that only 3 points are required to uniquely define a plane.您应该记住的一个数学属性是,唯一地定义一个平面只需要 3 个点。 The 4th point on the plane is not necessary.平面上的第 4 个点不是必需的。
Quick summary of the method:方法的快速总结:
Example code:示例代码:
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.