0

我的数学(和 matlab)只是不符合这个,所以我谦虚地请求你的帮助:

我有一个通过环形空间的流动模型。我想得到峰值流量点的半径和环到中心线的半径。

因此,我在 3D 模型中有 3 个点 ABC,其坐标我们知道但未与 xyz 对齐。我希望 AB 是平面上的两个点,点 A 是原点(环的中心)。点 C 位于与前一个平面(峰值流量点)平行的平面上。我想知道如何计算其平面上的 C 与通过点 A 的 AB 平面的法向量之间的距离。

以下是模型的图片: 流经模型 中的环点

现在我有一个比我聪明的朋友,他想出了一个 matlab 代码来平移和旋转模型,然后计算 AB 和 AnormC 的大小。但是,它不起作用,因为它使 C 的半径大于 B。我也意识到解决这个问题的方法不止一种。

代码如下。有什么想法我们哪里出错了吗?或者也许有更好的方法来做到这一点?我想到了矢量,但我的涂鸦一无所获。

谢谢你。

托比

%Origin
O = [0 0 0]';           Ox = [O' 1]';
%Vector co-ordinates of 1 (A - Origin centreline), ...
% 2 (B - Radius of artery), and 3 (C - Radius of Peak Velocity)
A = [13.3856 -60.0377 15.8443]';           Ax = [A' 1]';
B = [26.9486 -51.0653 20.9265]';           Bx = [B' 1]';
C = [16.2240 -92.5594 40.8687]';           Cx = [C' 1]';
%Find the new i unit vector in the old co-ords (the unit vector along the new x axis)
AB = B - A;
magAB = sqrt(sum(AB.^2));
new_i=AB./magAB;
%Calculate the angle to rotate through Z when transforming
thetaZ = atan(new_i(2)/new_i(1));
%Hence, define the translation matrix (to move the origin to A) and ...
% the rotation matrixes (to align the new x axis with AB and new_i)
T = [1 0 0 -A(1) ; 0 1 0  -A(2) ; 0 0 1 -A(3) ; 0 0 0 1];
Rz = [cos(thetaZ) sin(thetaZ) 0 0 ; -sin(thetaZ) cos(thetaZ) 0 0 ; 0 0 1 0 ; 0 0 0 1];
Transform = Rz * T;
%transform Cx to the new co-ordinates by translation and rotation in Z
A_dash = round(Transform * Ax,10);
B_dash = round(Transform * Bx,10);
C_dash = round(Transform * Cx,10);
new_i_t = round(Transform * [new_i' 1]',4); new_i_t = new_i_t(1:3);
new_O = round(Transform * Ox,4); new_O = new_O(1:3);
A_dash = A_dash(1:3); B_dash = B_dash(1:3); C_dash = C_dash(1:3);
%Perform a final rotation in Y
thetaY = atan(B_dash(3)/B_dash(1));
Ry = [cos(thetaY) 0 sin(thetaY) ; 0 1 0 ; -sin(thetaY) 0 cos(thetaY)];
B_dash = Ry * B_dash;
C_dash = Ry * C_dash;
%Taking point C onto the plane of AB
C_dashflat = C_dash.*[1 1 0]';
%Find Radius of Peak Flow 
Radius_Peak_Flow = sqrt(sum(C_dashflat.^2));
%Find Radius of Artery  
Radius_Artery = magAB;
%Ratio (between 0 -1)
Ratio = Radius_Peak_Flow/Radius_Artery
4

0 回答 0