how to find vertices for a box

3 visualizaciones (últimos 30 días)
imola
imola el 11 de Oct. de 2014
Respondida: SK el 11 de Oct. de 2014
Dear All,
I have a box represent by centre, height, width and length as follow
centre =[xc,yc,zc]
box =[21.7873 39.9046 20.4403 34.9405 2.8089 39.5015];
xmin = box(:,1);
xmax = box(:,2);
ymin = box(:,3);
ymax = box(:,4);
zmin = box(:,5);
zmax = box(:,6);
h=xmax-xmin;
w=ymax-ymin;
l=zmax-zmin;
then I rotate the box now I want to find again the new vertices
[xmin xmax ymin ymax zmin zmax]
can anybody help me and show me how to find them.
regards

Respuesta aceptada

SK
SK el 11 de Oct. de 2014
How is your rotation expressed? Is it two angles t1 and t2 that are rotations in two planes (say xy plane and xz plane)? In that case use the rotz() and roty() functions. Alternatively use the rotation matrices:
Rxy = [cos(t1) -sin(t1), 0; sin(t1), cos(t1), 0; 0, 0, 1];
and
Rxz = [cos(t2) -sin(t2), 0; 0, 0, 1; sin(t2), cos(t2), 0];
newmin = Rxy*Rxz*([xmin; ymin; zmin]);
newmax = Rxy*Rxz*([xmax; ymax; zmax]);

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by