Box クラスから AABB (軸に合わせたバウンディング ボックス) を計算したいと考えています。
ボックスクラス:
Box{
Point3D center; //x,y,z
Point3D halfSize; //x,y,z
Point3D rotation; //x,y,z rotation
};
AABB クラス (ボックス、ローテーションなし):
BoundingBox{
Point3D center; //x,y,z
Point3D halfSize; //x,y,z
};
ああ、いつrotation = (0,0,0), BoundingBox = Box
。しかし、Box のすべてを含む最小の BoundingBox を計算する方法はrotation = (rx,ry,rz)
?
誰かが尋ねた場合: 回転はラジアンで、私はそれを DirectX マトリックス回転で使用します:
XMMATRIX rotX = XMMatrixRotationX( rotation.getX() );
XMMATRIX rotY = XMMatrixRotationY( rotation.getY() );
XMMATRIX rotZ = XMMatrixRotationZ( rotation.getZ() );
XMMATRIX scale = XMMatrixScaling( 1.0f, 1.0f, 1.0f );
XMMATRIX translate = XMMatrixTranslation( center.getX(), center.getY(), center.getZ() );
XMMATRIX worldM = scale * rotX * rotY * rotZ * translate;