# How to calculate the inclination angle of whole box which their 4 vertices are stored in cell array with respect to the horizontal x-axis?

2 visualizaciones (últimos 30 días)
M el 12 de Mayo de 2022
Editada: Matt J el 13 de Mayo de 2022
How to calculate the inclination angle of whole box which their 4 vertices are stored in cell array with respect to the horizontal x-axis?
There is cell with size 1*23 , In each part of cell there are four (x,y) coordinates stored (23 Bounding boxes coordinates )as the following:
c = {{[x1 , y1], [x2, y2], [x3 , y3 ], [x4 , y4 ]}, {[x1 , y1], [x2, y2], [x3 , y3 ], [x4 , y4 ]}, ........... }
The attached file is xy coordinates of the vertices of the boxes.
The coordinates are in the order:
(left-bottom), (right-bottom), (left-top), (right-top).where each coordinate is an (x, y) pair.. i.e([x1 , y1], [x2, y2], [x3 , y3 ], [x4 , y4 ])
##### 2 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
M el 12 de Mayo de 2022
Editada: M el 12 de Mayo de 2022
@Image Analyst, I have attached the file please check it.

Iniciar sesión para comentar.

Matt J el 12 de Mayo de 2022
Editada: Matt J el 12 de Mayo de 2022
boxes = cellfun(@(z) cell2mat(z(:)) ,c ,'UniformOutput' ,false)
boxes=cat(3,boxes{:});
rays=normalize( boxes(4,:,:)-boxes(3,:,:) ,2 ,'n');
angles= squeeze( acosd( rays(:,1,:) ) );
##### 11 comentariosMostrar 10 comentarios más antiguosOcultar 10 comentarios más antiguos
M el 13 de Mayo de 2022
@Matt J I got it, Thank you very much .

Iniciar sesión para comentar.

### Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by