私の数学 (および matlab) はこれにまで達していないため、謙虚にあなたの助けを求めます:
私は環を通る流れのモデルを持っています。ピーク フロー ポイントの半径と中心線までの円環の半径を取得したいと考えています。
したがって、3D モデルには 3 点 ABC があり、その座標はわかっていますが、xyz に位置合わせされていません。AB を平面上の 2 点とし、点 A を原点 (環の中心) にします。ポイント C は、前の平面 (ピーク フロー ポイント) に平行な平面上にあります。その平面上の C と、点 A を通る AB 平面の法線ベクトルとの間の距離を計算する方法を知りたいです。
モデルの写真は次のとおりです。 環形を通るフローモデル 内のポイント
今では、モデルを変換して回転させ、AB と AnormC の大きさを計算するための matlab コードを考え出すよりも賢い友人がいます。ただし、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