i'm trying to make a plane of 4 points that are in the corners of the plane. I used the Patch function to display this plane but I need the equation of this plane. Is there a way to do this in 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?
I am doubtful MATLAB's graphical objects have much mathematical capability built into them. 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. The 4th point on the plane is not necessary.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.