Identify coordinates of nodes in a matrix above/below the coordinates of a plane

Is there a way to identify the coordinates of nodes (black nodes,'DATA_select') above (green selection) or below (purple selection) the plane formed by the cyan nodes?
circle_new = importdata("circle_new.mat");
DATA_select = [-34.9538764953613 -202.653717041016 -180.064163208008
-34.9621696472168 -202.662780761719 -180.033142089844
-34.9837760925293 -202.684707641602 -179.908370971680
-35.1441574096680 -202.809509277344 -179.447555541992
-35.2035064697266 -202.828262329102 -179.262985229492
-35.2346343994141 -202.842453002930 -179.193283081055
-35.2885208129883 -202.862808227539 -179.072174072266
-35.3297538757324 -202.876464843750 -178.992904663086
-35.3625869750977 -202.889877319336 -178.920135498047
-35.4839859008789 -202.917922973633 -178.627349853516
-35.4883193969727 -202.919113159180 -178.618835449219
-35.5550308227539 -202.943710327148 -178.500549316406];
N = [circle_new(1,:); circle_new(100,:); circle_new(200,:)];
% =======================
figure
plot3(circle_new(:,1),circle_new(:,2),circle_new(:,3),'c.','Markersize',10)
hold on
plot3(DATA_select(:,1),DATA_select(:,2),DATA_select(:,3),'k.','Markersize',20)
plot3(N(:,1), N(:,2), N(:,3), 'r.', 'Markersize', 30);
patch(N(:,1), N(:,2), N(:,3), 'k'); % Plotting the plane
hold off
axis equal
grid off
I determined the normal vector:
% Calculate the normal vector to the plane
v1 = N(2,:) - N(1,:);
v2 = N(3,:) - N(1,:);
normal_vector = cross(v1, v2);
normalized_normal = normal_vector / norm(normal_vector);

 Accepted Answer

Yes,
dot(normal,point)>0 %above the plane (the direction the normal is pointing)
dot(normal,point)<0 %below the plane

3 Comments

Thank you for your reply.
  • By 'normal' do you mean 'normal_vector'?
  • By 'point' do you mean a node of 'DATA_select'?
dot(normal_vector,DATA_select(1,:))>0; % result 1 for DATA_select(1:12,:)
Perhaps it is more correct to write it this way?
G_plane_new = [-35.2765495628843 -202.715302315428 -179.169337072340]; % node on plane
A = dot(DATA_select(r,:)-G_plane_new,normal_vector)>0; % r for 1:12
I assume you figured it out (since you accepted the answer)?

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!