現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How to find the line of intersection between the following two planes and plot the intersected line on the same two planes?
1 回表示 (過去 30 日間)
古いコメントを表示
M
2023 年 2 月 2 日
How to find the line of intersection between the following two planes and plot the intersected line on the same two planes?
The following points contain the following points:
The first plane:
P1 = 177668442.453315 -102576923.076923 0
P2 = -102576923.076923 177668442.453315 -102576923.076923
P3= 0 -102576923.076923 88834221.2266576
The secod Plane:
P1= 152763459.308716 -102576923.076923 0
P2= -102576923.076923 183536536.231793 -102576923.076923
P3= 0 -102576923.076923 91768268.1158967
採用された回答
Matt J
2023 年 2 月 2 日
編集済み: Matt J
2023 年 2 月 2 日
A=null([[P11;P21;P31],ones(3,1)]); %plane 1
B=null([[P12;P22;P32],ones(3,1)]); %plane 2
L=A*B.' - B*A.'; %line of intersection
However, for this to work well, you must re-express your P data in larger units, as Torsten suggests.
25 件のコメント
Matt J
2023 年 2 月 2 日
編集済み: Matt J
2023 年 2 月 2 日
P1=[177668442.453315 -102576923.076923 0
-102576923.076923 177668442.453315 -102576923.076923
0 -102576923.076923 88834221.2266576]/100000000;
P2=[152763459.308716 -102576923.076923 0
-102576923.076923 183536536.231793 -102576923.076923
0 -102576923.076923 91768268.1158967]/100000000 *[0 1 0;1 0 0; 0 0 1];
A=null([P1,ones(3,1)]); %plane 1
B=null([P2,ones(3,1)]); %plane 2
L=A*B.' - B*A.'; %line of intersection
N=null(L);
t=linspace(-.1,.1);
xyz=N(:,1) + N(:,2)*t;
xyz=num2cell(xyz(1:3,:)./xyz(4,:),2);
line(xyz{:}); grid on; view(3)
plotPlane(A)
plotPlane(B)
axis([-1,1,-1,1,-1,1]*200)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1282516/image.png)
function plotPlane(H)
hold on;
fimplicit3(@(x,y,z)H(1)*x+H(2)*y+H(3)*z+H(4),'EdgeColor','none','FaceAlpha',0.3,'FaceColor','r')
hold off
end
Matt J
2023 年 2 月 2 日
I dont to rescale the numbers, because they have meaning
What meaning? That's like saying centimeters have more meaning than kilometers.
Matt J
2023 年 2 月 2 日
編集済み: Matt J
2023 年 2 月 2 日
In any case, it still works with the P data as originally scaled:
P1 =[177668442.453315 ,-102576923.076923, 0];
P2 =[ -102576923.076923 ,177668442.453315 ,-102576923.076923];
P3= [0, -102576923.076923, 88834221.2266576];
P11= [152763459.308716 , -102576923.076923, 0];
P22=[ -102576923.076923, 183536536.231793 , -102576923.076923];
P33= [0, -102576923.076923, 91768268.1158967];
hold on
A=null([[P1;P2;P3],ones(3,1)]); %plane 1
B=null([[P11;P22;P33],ones(3,1)]); %plane 2
L=A*B.' - B*A.'; %line of intersection
N=null(L);
t=linspace(-0.1,0.1);
xyz=N(:,1) + N(:,2)*t;
xyz=num2cell(xyz(1:3,:)./xyz(4,:),2);
plot3(xyz{:}); grid on
line(xyz{:}); grid on; view(3)
plotPlane(A)
plotPlane(B)
axis([-1,1,-1,1,-1,1]*200)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1282616/image.png)
function plotPlane(H)
hold on;
fimplicit3(@(x,y,z)H(1)*x+H(2)*y+H(3)*z+H(4),'EdgeColor','none','FaceAlpha',0.3,'FaceColor','r')
hold off
end
Matt J
2023 年 2 月 2 日
line() takes the same kind of arguments as patch()
Example: line(x,y,'Color','red','LineWidth',3) creates a red line that is 3 points wide.
M
2023 年 2 月 4 日
編集済み: M
2023 年 2 月 4 日
For example they became 4 instead of 3 , I edited the code as the follwoing, and I got the intersected line
P4 = [0 0 -136769230.769231 126358292.985005]
P44= [0 0 -136769230.769231 127179926.292009]
A=null([[P1;P2;P3;P4],ones(4,1)]); %plane 1
B=null([[P11;P22;P44],ones(4,1)]); %plane 2
L=A*B.' - B*A.'; %line of intersection
But I faced errors in ploting part and I didnt know how to edit 'xyz' ?
could you please tell me what is the 'xyz' and based on what I should edit it ?
N=null(L);
t=linspace(-0.1,0.1);
xyz=N(:,1) + N(:,2)*t;
xyz=num2cell(xyz(1:3,:)./xyz(4,:),2);
plot3(xyz{:}); grid on
line(xyz{:}); grid on; view(3)
plotPlane(A)
plotPlane(B)
axis([-1,1,-1,1,-1,1]*200)
Matt J
2023 年 2 月 4 日
But I faced errors in ploting part and I didnt know how to edit 'xyz' ?
I don't think so. The code you posted doesn't even run to the creation of A and B. It also doesn't really make sense that you would be adding a 4th point. Four points are not generally coplanar.
P1 =[177668442.453315 ,-102576923.076923, 0];
P2 =[ -102576923.076923 ,177668442.453315 ,-102576923.076923];
P3= [0, -102576923.076923, 88834221.2266576];
P11= [152763459.308716 , -102576923.076923, 0];
P22=[ -102576923.076923, 183536536.231793 , -102576923.076923];
P33= [0, -102576923.076923, 91768268.1158967];
P4 = [0 0 -136769230.769231 126358292.985005]
P4 = 1×4
1.0e+08 *
0 0 -1.3677 1.2636
P44= [0 0 -136769230.769231 127179926.292009]
P44 = 1×4
1.0e+08 *
0 0 -1.3677 1.2718
A=null([[P1;P2;P3,P4],ones(4,1)]) %plane 1
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
Dimensions of arrays being concatenated are not consistent.
B=null([[P11;P22;P44],ones(4,1)]) %plane 2
M
2023 年 2 月 4 日
P1 =[252716585.970010 -136769230.769231 0 0];
P2 =[ -136769230.769231 252716585.970010 -136769230.769231 0];
P3= [0 -136769230.769231 252716585.970010 -136769230.769231];
P11= [233844467.968633 -136769230.769231 0 0];
P22=[ -136769230.769231 254359852.584018 -136769230.769231 0];
P33= [0 -136769230.769231 254359852.584018 -136769230.769231];
P4 = [0 0 -136769230.769231 126358292.985005];
P44= [0 0 -136769230.769231 127179926.292009];
A=null([[P1;P2;P3;P4],ones(4,1)]) %plane 1
A = 5×1
0.2420
0.4472
0.5843
0.6325
0.0000
B=null([[P11;P22;P33;P44],ones(4,1)]) %plane 2
B = 5×1
0.2657
0.4542
0.5791
0.6227
0.0000
L=A*B.' - B*A.' %line of intersection
L = 5×5
0 -0.0089 -0.0151 -0.0173 -0.0000
0.0089 0 -0.0064 -0.0088 -0.0000
0.0151 0.0064 0 -0.0024 -0.0000
0.0173 0.0088 0.0024 0 -0.0000
0.0000 0.0000 0.0000 0.0000 0
M
2024 年 7 月 14 日
編集済み: M
2024 年 7 月 14 日
Hi @Matt J, could you please elaborate to me why did you scale P1 and P2 as the following? why did you transform P2 only??
Also, Why do the planes have six vertices in the plot?
Thanks
P1=[177668442.453315 -102576923.076923 0
-102576923.076923 177668442.453315 -102576923.076923
0 -102576923.076923 88834221.2266576]/100000000;
P2=[152763459.308716 -102576923.076923 0
-102576923.076923 183536536.231793 -102576923.076923
0 -102576923.076923 91768268.1158967]/100000000 *[0 1 0;1 0 0; 0 0 1];
M
2024 年 7 月 14 日
Matt J
2024 年 7 月 14 日
編集済み: Matt J
2024 年 7 月 14 日
could you please elaborate to me why did you scale P1 and P2 as the following?
Because in these lines, the ones(3,1) become vanishingly small compared to the Pij data if you don't scale them.
A=null([[P11;P21;P31],ones(3,1)]); %plane 1
B=null([[P12;P22;P32],ones(3,1)]); %plane 2
why did you transform P2 only??
I think I just didn't like the P2 that you gave. I wanted a different P2 data set for the example.
Also, Why do the planes have six vertices in the plot?
Becase the plot box has 12 edges, but the planes only intersect 6 of them.
M
2024 年 7 月 15 日
編集済み: M
2024 年 7 月 15 日
@Matt J Thanks for your reply.
Becase the plot box has 12 edges, but the planes only intersect 6 of them.
Regarding this, Is there a way to control the vertices? for example to have only 4 vertices in the plot? or that will affect the meaning or so ? I need the plots only for visualization purposes in my research, having 6 vertices looks weird
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)