Draw plane via 3 points

110 Views Asked by At

I have 3 points (1,1,1), (2,2,2), (2,2,0). It is enough to draw plane via these 3 points.

But how to do this in Matlab? I'm planning to use surf() function. I do:

x=[1 2 2 ]
y=[1 2 2 ]
[X,Y] = meshgrid(x,y)

it creates mesh :

X

1 2 2
1 2 2
1 2 2

y

1 1 1
2 2 2 
2 2 2 

Problems appeared while construct Z matrix:

Z

1 ? ?
? 2 ?
? ? 0

I know only 3 points , how to fill other ones defined as ? ?

1

There are 1 best solutions below

0
On

I think you need the fill3 function. See below:

p1 = [1 1 1];
p2 = [2 2 2];
p3 = [2 2 0];

points=[p1' p2' p3']; 
fill3(points(1,:),points(2,:),points(3,:),'r')
grid on