MATLAB: 3D plane plotting restricted by 3 points

3d plane

how can plot a 3D plane restricted among 3 points…???.I mean the plane should be restricted by 3 lines formed by those 3 points

Best Answer

Equation of a plane is determined uniquely by any 3 (noncollinear) points lying on the plane. Based on your question, it sounds like you dont care about equation of the plane and just want to visualize region of a plane enclosed by 3 points (i.e., a triangle). Here is an example of how to do this:
% Vertex coordinates
p1=[0 0 0];
p2=[2 0 0];
p3=[1 sqrt(3/2) sqrt(3/2)];
% Plot trianle using 'patch'
figure('color','w')
h=patch('Faces',1:3,'Vertices',[p1;p2;p3]);
set(h,'FaceColor','r','EdgeColor','k','LineWidth',2,'FaceAlpha',0.5)
axis equal vis3d
view([30 30])
xlabel('x','FontSize',20)
ylabel('y','FontSize',20)
zlabel('z','FontSize',20)
Related Question