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

조회 수: 2 (최근 30일)
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);

채택된 답변

Matt J
Matt J 2024년 2월 8일
편집: Matt J 2024년 2월 8일
Yes,
dot(normal,point)>0 %above the plane (the direction the normal is pointing)
dot(normal,point)<0 %below the plane
  댓글 수: 3
Matt J
Matt J 2024년 2월 8일
I assume you figured it out (since you accepted the answer)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by