フィルターのクリア

How can I use a cube as the boundaries for a line ?

2 ビュー (過去 30 日間)
Jonathan Salazar
Jonathan Salazar 2017 年 8 月 31 日
回答済み: KSSV 2017 年 8 月 31 日
I have x,y and z extremes which i need to use to create a box (xlo,xhi,ylo,yhi,zlo,zhi). I need to then draw a random line inside the box and figure out the length of this line. I was thinking about manually creating the equations for the planes describing the box and finding out when they intersect with the line but I am not entirely sure how to accomplish this on matlab. Thank you!

回答 (1 件)

KSSV
KSSV 2017 年 8 月 31 日
To get (xlo,xhi,ylo,yhi,zlo,zhi):
[min(x) max(x) min(y) max(y) min(z) max(z)] ;
As you have (x,y,z) data, select any two points in random and plot line. You may select random point using randsample or randperm. Once you get two points, you can get length using norm. Or by calculating the distance between them.

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by