Verify plane equation perpendicular to vector
Show older comments
When robot gripper is in certain position I have to get a plane equation perpendicular to approach vector.

My code is following:
%% Plot approach vector
approach_vec=[-0.616490990166493, 0.492703172483058, -0.614151807673533]; %Approach vector
t=[-0.234045440283085, -0.520172447189332, -0.042211687615712]; %Approach vector origin
X=t(1);
Y=t(2);
Z=t(3);
U1=approach_vec(1);
V1=approach_vec(2);
W1=approach_vec(3);
quiver3(X,Y,Z,U1,V1,W1,'Color','#0072BD','linewidth',5,'AutoScale','on','AutoScaleFactor',1,'ShowArrowHead','on','Marker','.',MarkerEdgeColor='#D95319');
hold on;
%% Plot PLANE ABCD
A=approach_vec(1);
B=approach_vec(2);
C=approach_vec(3);
x1=t(1);
y1=t(2);
z1=t(3);
D=-(A*x1+B*y1+C*z1);
[x y] = meshgrid(-1:0.05:1); % Generate x and y data
z = -1/C*(A*x + B*y + D); % Solve for z data
surf(x,y,z); %Plot the surface
hold on; axis equal; plane=[A,B,C,D];
Plot and everything looks ok, but elements of this plane equation (A B C D) are input to some other function in which I get errors so I would like to get confirmation that this calculation is correct based on input data, because just maybe I am missing something.
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!