how to find vertices for a box

3 visualizzazioni (ultimi 30 giorni)
imola
imola il 11 Ott 2014
Risposto: SK il 11 Ott 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

Risposta accettata

SK
SK il 11 Ott 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]);

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by