how to find vertices for a box

조회 수: 2 (최근 30일)
imola
imola 2014년 10월 11일
답변: SK 2014년 10월 11일
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

채택된 답변

SK
SK 2014년 10월 11일
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]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by