필터 지우기
필터 지우기

How to check if two planes intersect with each other?

조회 수: 6 (최근 30일)
Jake
Jake 2022년 11월 1일
답변: Bruno Luong 2022년 11월 2일
Suppose I have two planes defined by four points (each) as follows. For ease of explanation, I will follow a graphical approach.
A = [-1140,14,16.125; -1140,14,0; -1140,10.5,-4; 1118,0,64.5];
B = [1500, 0, 0; 1500, 14, 0; -1500, 14, 0; -1500, 0, 0];
fill3(A(:,1), A(:,2), A(:,3), 'b', 'FaceAlpha',0.5); hold on
fill3(B(:,1), B(:,2), B(:,3), 'r', 'FaceAlpha',0.5)
As one can see, the two planes intersect. However, I have a cloud of different points (like A) that creates panels. How can I check which ones intersect with another plane (say, like B)? I think I should use cross, but I'm not sure how to use it. In the end, what I'm interested in is running the point cloud through a for loop, and separating the panels that intersect with one specific panel. I know an if command will do the trick, but I'm having trouble making the logic here. Any help is appreciated!
  댓글 수: 4
Bruno Luong
Bruno Luong 2022년 11월 1일
" two planes intersect"
I hope you know exactly the mathematical of the word "plane"when writing thos sentence and not confuse it with a patch (a 2D manifold that is bounded, such as polygonal defined by 4 vertices).
Jake
Jake 2022년 11월 2일
Both John and Bruno are right, I should've been clearer. I'm aware that planes do intersect, but what I was looking for was whether they intersect or not within a restricted domain. Thank you for the feedback!

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

답변 (2개)

Jan
Jan 2022년 11월 1일
편집: Jan 2022년 11월 1일
Planes intersect, if their normal vectors point to different directions:
A = [-1140,14,16.125; -1140,14,0; -1140,10.5,-4; 1118,0,64.5];
B = [1500, 0, 0; 1500, 14, 0; -1500, 14, 0; -1500, 0, 0];
nA = GetPlaneNormal(A);
Warning: Data not similar to a plane.
nB = GetPlaneNormal(B);
doIntersect = dot(nA, nB) > 1000 * eps
doIntersect = logical
1
function N = GetPlaneNormal(X)
m = mean(X, 1); % Center of points
[U, S, V] = svd(X - m, 0);
N = V(:, 3);
% A very coarse test, if data resemble a plane:
if S(1,1) < 100 * S(2,2) || S(2,2) < 100 * S(3,3)
warning('Jan:GetPlaneNormal:Noisy', 'Data not similar to a plane.');
end
end

Bruno Luong
Bruno Luong 2022년 11월 2일
fastMesh2Mesh(A,B,[1 2 4; 2 3 4], [1 2 4; 2 3 4],100)
If the result is not empty the patch (splitted in 2 trangles, there are 2 ways, but we pick them arbitrary) then the patches intersect.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by