現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
rectangle intersect with line and display which line or point got intersect?
1 回表示 (過去 30 日間)
古いコメントを表示
Prakash Choudhary
2019 年 6 月 4 日
Dwy0 = 200;
Dwy = 100;
B1x = data(:,2);
B2x = data(:,2)+4*7.*D;
B3x = data(:,2)+4*7.*D;
B4x = data(:,2);
B1y = data(:,3) + (D/2);
B2y = data(:,3) + (Dwy/2);
B3y = data(:,3) - (Dwy/2);
B4y = data(:,3) - (D/2);
xv = [B3x,B4x,B1x,B2x];
yv = [B3y,B4y,B1y,B2y];
x2v = [B4x B1x];
y2v = [B4y B1y];
AA=intersect([xv,yv],[x2v,y2v])
plot(AA,'b.')
hold on;grid on
plot(xv,yv,'.')
% plot(x2v,y2v)
20 件のコメント
Prakash Choudhary
2019 年 6 月 5 日
In this code how can i show that the line x2v,y2v intersected by the rectangle and its for n rectangle with n lines the realtion between that i cant be able to display in here or simulate this thing!!!
Prakash Choudhary
2019 年 6 月 5 日
data(:,2) is x coordinates for N numbers
data(:,3) is y coordinates for N numbers
sir!!! you can consider random points and the code will give you the rectangle and line segments but the intersect part is not satisfying to me so i need help SOS!!!
Adam Danz
2019 年 6 月 5 日
Yes, we could generate our own fake data to help you solve your problem. But there's always a risk that the data we generate in the dark aren't similar enough to your actual data and that leads to a lot of wasted time and a lot of unnecessary dialogue. So it's your responsibility to produce some kind of data for people to work with that reproduces the problem.
Prakash Choudhary
2019 年 6 月 5 日
Yes sir but how can i attach the xlfile here i can just copy the coordinates here
xaxis yaxis
0 1148
1100 0
480 287
1300 700
220 2500
800 1600
2000 1100
1600 2000
2500 0
1000 3000
0 3500
480 4000
2250 2500
1600 3500
2500 4000
2900 560
3400 1600
2900 3000
4000 287
3700 2000
Adam Danz
2019 年 6 月 5 日
There we go; we can work with that. However,
- your 'data' matrix has 3 columns so we're missing a column of data
- We're also missing the value of 'D'.
Prakash Choudhary
2019 年 6 月 5 日
Sorry for That The value of D=200 however i missed to mention that before
Prakash Choudhary
2019 年 6 月 5 日
and the value of x2v,y2v however is same come from the rectangle one side lines
Adam Danz
2019 年 6 月 5 日
編集済み: Adam Danz
2019 年 6 月 5 日
Ok, what about the 3rd column of 'data'?
" how can i show that the line x2v,y2v intersected by the rectangle"
x2v and y2v are both [20 x 2] matrices so they will produce two lines. And what rectangle do you expect those two lines to intersect?
I might be helpful to include an image of the intersection.
Prakash Choudhary
2019 年 6 月 5 日
i atteched the picture which can help you to understand my situation for the rectangle intersect.
Adam Danz
2019 年 6 月 5 日
I don't see any rectangles nor do I see any intersections.
Are you asking for the coordinates where the orange vertcial line that is circled and labeled "2" would intersect the blue lines if it extended vertically?
I can't help without reproducible code and that still hasn't been provided.
Prakash Choudhary
2019 年 6 月 5 日
yes i want to know that coordinates where it overlaps/ intersect the 2 or 3 by 1
Prakash Choudhary
2019 年 6 月 5 日
and its more like a polyshape object i consider as a rectangle because it made of a four different points
Adam Danz
2019 年 6 月 5 日
The solution probably isn't that complicated. You have to find the x value of the vertical lines; then, given that x value, find the y value on the blue line (interpolate if needed). The solution probably would have taken less time to write than the time spent going back and forth trying to understand your data. There has already been 20 comments on this and still, no data. We could exchange comments for the next few months and I still won't be able to help until you attach some data for me to work with.
You already produced a figure. That's impossible to do without data. So you have the data. You just need to save it to a mat file and attach it. Unfortunately I have other obligations today but I might have time to help you later (if there are data to work with).
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Elementary Polygons についてさらに検索
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 (한국어)