Orientation of Point form matrix center in Matlab -
in matlab i've got simple 2d matrix. calculate orientation of points of matrix center of same matrix. maybe simple diagram it's clearer: 
i've got several points (point in blue, green, yellow , brown). calculate angles of orientation of each point. p1 (blue) 45 degrees, yellow 180, brown 250-270 , green 0 degrees. looks pretty easy i've been stuck long time , code doesn't works in situations.
in example i'm showing matrix pair number of rows , columns (my matrix square matrix), should done in cases in matrix has odd dimensions? thank in advance
you can use cart2pol convert polar coordinates, example blue point @ position (3,3) center:
[angle, ~]=cart2pol(3,3); angle= 0.7854 which angle in radians.
you can create dataset cartesian coordinates (clockwise blue one):
coordinates=[3 3; 4 0; -1 -4; -4 0; -2, 2]; [angle, dist]=cart2pol(coordinates(:, 1), coordinates(:, 2)); and convert angle in degrees:
degangle=(angle/(2*pi))*360; degangle = 45.0000 0 -104.0362 180.0000 135.0000 note: position of each point relative center can use coordtopleft -floor(size(yourmatrix)) coordtopleft standard coordinates relative top left corner.
Comments
Post a Comment