Set boundaries to a plane equation
Afficher commentaires plus anciens
I have a surface with four edges, namely (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4). Those four points are always coplanar and they form a rectangle. I can find a plane equation with any of 3 coordinates above, however, that equation can be applied infinitely along x, y and z. How to limit the equation so that it is valid within the surface only? In other words, how to set boundaries to a plane equation in matlab coding
i tried searching but to no avail. Thank you.
Réponse acceptée
Plus de réponses (2)
Using VERT2LCON (Download), you can derive a system of inequalities and equalities giving the region bounded by the vertices,
[A,b,Aeq,beq]=vert2lcon( [ x1, y1, z1 ; x2, y2, z2 ; x3, y3, z3 ;x4, y4, z4 ])
1 commentaire
S Justin
le 11 Fév 2018
(1) Find the best fit plane using all 4 points
V=[ x1, y1, z1 ; x2, y2, z2 ; x3, y3, z3 ;x4, y4, z4 ];
mu=mean(V);
[~,~,N]=svd(V-mu,0);
n=N(:,end).'; d= dot(n,mu); %Equation of plane is dot(n,x)=dot(n,mu);
(2) Project all the points into 2D coordinate system of the plane,
xy=V*N(:,1:2);
[A,b]=vert2lcon( xy );
(4) Map the inequality data back to 3D,
A_3d=A*N(:,1:2).';
b_3d=b;
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

