This question is from my last post,

But I will just focus on a particular part,

If I have a **3d matrix M**, 256*256*124,and a plane defined by 3 points that intersect the 3d matrix, **A,B,C**, how to find the distance of all points in M to the plane defined by A,B,C

Here is the suggestion I got,

```
[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
```

According to Hesse normal form, enter link description here

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

But all the values in L are huge, which indicates that no points are found on the intersection plane.

Can anyone tell me what's wrong?