How to check if two planes intersect with each other?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Bruno Luong
le 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).
Réponses (2)
Jan
le 1 Nov 2022
Modifié(e) : Jan
le 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 commentaires
Bruno Luong
le 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 commentaires
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!