How to calcululate the distance between 3D matrix elements to plane "Ax+By+Cz+D = 0" in a vectorized manner?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a 3D matrix M
M = zeros(405,706,1932);
Suppose putting matrix M into the x-y-z coordinate,with the x-axis indicating the size(M)(1),y-axis indicating the size(M)(2), and z-axis indicating size(M)(3).
I also have a plane "Ax+By+Cz+D = 0" .
For each element in this matrix, calculate the distance to plane using (Ax0+By0+Cz0+D)/sqrt(A^2+B^2+C^2), then use the results to replace the element itself. So each element in M is the distance to this place.
The "for... for... for ..." cycle is too slow, how to vectorize this command?
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!