how to create an arc path from 3 points(x, y, z) in plane?

23 ビュー (過去 30 日間)
hadis ensafi
hadis ensafi 2022 年 5 月 17 日
編集済み: Torsten 2022 年 5 月 22 日
I want to create an arc trajectory cross over n=3 points P(n)=(x, y, z), I decided to draw a circle over 3 points in plane. so I have center, radius, theta (angle in x, y plane) and phi(angle around z axis), and I know the position of 3 points (x, y, z), How can I calculate theta in parametric equation of the circle for each points? then extract an arc between p1 , p2 and p3 from this circle? I implemented this program in MATLAB.. Thanks a lot.

採用された回答

Torsten
Torsten 2022 年 5 月 17 日
Determine the center of the circle:
Determine the parametric equation of the circle:
Determine the range of theta to represent only the arc connecting the three points.
Up to you.
  6 件のコメント
hadis ensafi
hadis ensafi 2022 年 5 月 22 日
Hi !! thanks for your answer! my circle equation is: (center+sin(thetai)*rad.*v1+cos(thetai)*rad.*v2;) in 3D plane for each point on the circle!
I want to calculate theta for P1 and P2 and P3 to extract only sector from P1 to P3 that passes through P2, generally!
According to you, should I put my point (P!,P2,P3) coordinate instead of pi/2 thar you wrote? like this:
funX = @(thetai) center(:,1)+sin(thetai)*rad.*v1(:,1)+cos(thetai)*rad.*v2(:,1);
theta = fsolve(funX,p1);
I did it, but did not work.
please please guide me ! thanks a lot!
Torsten
Torsten 2022 年 5 月 22 日
編集済み: Torsten 2022 年 5 月 22 日
theta1init = ...;
theta2init = ...;
theta3init = ...;
funX = @(thetai) center(:,1)+sin(thetai)*rad.*v1(:,1)+cos(thetai)*rad.*v2(:,1)-P1;
theta1 = fsolve(funX,theta1init);
theta1 = mod(theta1,2*pi);
funX = @(thetai) center(:,1)+sin(thetai)*rad.*v1(:,1)+cos(thetai)*rad.*v2(:,1)-P2;
theta2 = fsolve(funX,theta2init);
theta2 = mod(theta2,2*pi)
funX = @(thetai) center(:,1)+sin(thetai)*rad.*v1(:,1)+cos(thetai)*rad.*v2(:,1)-P3;
theta3 = fsolve(funX,theta3init);
theta3 = mod(theta3,2*pi);
thetamin = min(theta1,theta2,theta3);
thetamax = max(theta1,theta2,theta3);
If this does not work, please report the error message or explain why the result is unexpected.
Here is some code in 2d:
P1 = [0.5*sqrt(2) 0.5*sqrt(2)];
theta1init = 0.7;
fun = @(theta) cos(theta)*[1 0] + sin(theta)*[0 1] - P1;
theta1 = fsolve(fun,theta1init);
theta1 = mod(theta1,2*pi)
fun(theta1)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by