How to check if two planes intersect with each other?
4 ビュー (過去 30 日間)
古いコメントを表示
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
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).
回答 (2 件)
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);
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 件のコメント
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!