旋转精灵的AABB? [英] AABB of rotated sprite?

查看:144
本文介绍了旋转精灵的AABB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个精灵。它的轴对齐包围盒(AABB)是很容易找到,因为我知道的宽度和高度。说我旋转45度,我不认为AABB将大到足以覆盖它,所以我需要一个新的AABB。我该如何计算旋转矩形的边框? (给定的一个中心点,角度,以及它的宽度和高度)。

Say I have a sprite. Its axis-aligned bounding box (AABB) is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I calculate the bounding rectangle of a rotated rectangle? (given a center point, an angle, and its width and height).

需要注意的是OpenGL的不旋转,所以我没有访问到顶点的信息。

Note that OpenGL does the rotation so I do not have access to the vertex information.

我想要做的就是这样的AABB我可以做2D扑杀进行渲染。

What I'm trying to do is get AABBs so I can do 2D culling for rendering.

有没有可能找到满足任意角度的AABB的贪婪的方法是什么?

Is there possibly a greedy way of finding the AABB that satisfies any angle?

感谢

推荐答案

这篇关于旋转精灵的AABB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆