translation matrix in OXY plane
2 ビュー (過去 30 日間)
古いコメントを表示
Let's say: I have matrix A=[x y z] with ~3.000 point data . Please see attachment file, and figure:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197654/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197656/image.png)
My question is: how can I translate all points with distance 1 in the black arrow direction (// with the long edge of the points), as illustrate figure?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197658/image.png)
![download.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197667/download.jpeg)
0 件のコメント
採用された回答
KSSV
2018 年 11 月 30 日
編集済み: KSSV
2018 年 11 月 30 日
You need to add that value to the coordinates. If you want to move along x-axes add 1 unit to x coordinates.
data = importdata('A.txt') ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
plot3(x,y,z,'.r')
hold on
%% Translate along x axis by unit 1
dx = 1. ;
x = x+dx ;
plot3(x,y,z,'.b')
view(2)
4 件のコメント
KSSV
2018 年 11 月 30 日
data = importdata('A.txt') ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
plot(x,y,'.r')
hold on
%%
idx = boundary(x,y) ;
p = polyshape(x(idx),y(idx)) ;
v = p.Vertices(1:2,:) ;
v = diff(v) ;
u = -0.1 ; % move by this unit
x = x+u*v(1) ; y = y+u*v(2) ;
plot(x,y,'.b')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!