how to find vertices for a box

1 view (last 30 days)
imola
imola on 11 Oct 2014
Answered: SK on 11 Oct 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

Accepted Answer

SK
SK on 11 Oct 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]);

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!