이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to find the line of intersection between the following two planes and plot the intersected line on the same two planes?
조회 수: 32 (최근 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일 15:20
편집: M
2024년 7월 14일 16:40
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일 16:39
Matt J
2024년 7월 14일 20:08
편집: Matt J
2024년 7월 14일 20:08
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일 11:42
편집: M
2024년 7월 15일 11:43
@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에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)