【问题标题】:How to calculate the distance from all points in a 3d matrix to a plane in matlab?如何计算3d矩阵中所有点到matlab中平面的距离?
【发布时间】:2017-06-28 02:15:42
【问题描述】:

这个问题来自my last post

但我只会专注于特定的部分,

如果我有一个 3d 矩阵 M,256*256*124,以及一个由与 3d 矩阵相交的 3 个点定义的平面,A,B,C,如何找到M中所有点到A,B,C定义的平面的距离

这是我得到的建议,

[X Y Z] = meshgrid(1:256,1:256,1:124)
A = [X(:)';Y(:)';Z(:)'];
n = cross([coor_A-coor_B],[coor_B-coor_C]); %The norm vector of the plane
d = norm(mean([coor_A,coor_B,coor_C]),2); %The distance from origin to the plane

根据Hesse normal form

L = ((n*A)-d);    %The distance from all points in M to the plane 

但是L中的所有值都很大,说明在相交平面上没有找到点。

谁能告诉我怎么了?

【问题讨论】:

  • “3d 矩阵中的点”是什么意思?点在空间中,矩阵只存储数字,在这种情况下它们如何关联?

标签: matlab matrix 3d


【解决方案1】:

你错过了维基百科页面上的一行

在哪里

所以添加这一行

n0 = n / norm(n);

并将最后一行更改为

L = ((n0*A)-d);

【讨论】:

  • 你可以发布完整的解决方案
猜你喜欢
  • 1970-01-01
  • 2018-08-05
  • 1970-01-01
  • 2014-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-15
相关资源
最近更新 更多