Let's say: I have matrix A=[x y z] with ~3.000 point data . Please see attachment file, and figure:
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?
download.jpg

 Réponse acceptée

KSSV
KSSV le 30 Nov 2018
Modifié(e) : KSSV le 30 Nov 2018

0 votes

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 commentaires

ha ha
ha ha le 30 Nov 2018
Thanks @ KSSV
I hope my translation points is move along the direction parallel with the long edge of the rectangle (NOT ranslate along x axis)
Capture.JPG
KSSV
KSSV le 30 Nov 2018
YOu need to split that into two components...and add that to every point along x and y.
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')
ha ha
ha ha le 30 Nov 2018
Modifié(e) : ha ha le 30 Nov 2018
Thanks @ KSSV .
You are correct.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Descriptive Statistics and Insights dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by