How to check if two planes intersect with each other?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Bruno Luong
am 1 Nov. 2022
" 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).
Antworten (2)
Jan
am 1 Nov. 2022
Bearbeitet: Jan
am 1 Nov. 2022
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);
nB = GetPlaneNormal(B);
doIntersect = dot(nA, nB) > 1000 * eps
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
0 Kommentare
Bruno Luong
am 2 Nov. 2022
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!