[英]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.