将 3d 角度分成等量

发布于 2024-12-06 21:28:27 字数 288 浏览 0 评论 0 原文

假设您有一个 2d 对象,只需围绕中心以 15 度增量旋转,您就可以轻松地将其划分为 15 度旋转。

如果我想计算 3d 对象的所有可能的角度,并且每个角度之间的间距相等,我将如何去做呢?

虽然对每个都进行 p*r*y 会起作用,但它是相当任意的并且有大量的重叠。我也非常想要一个四元数解决方案。

我正在为我目前正在开发的一个视频游戏项目做这个,本质上是一个老式的飞行模拟游戏,尽管游戏中的 3D 被渲染为 2D 精灵。我正在寻找一种简单的方法来以等间隔的角度(包括每个正交角度)按程序渲染飞机模型的所有可能角度。

Say you have a 2d object, you could easily divide this into 15 degree rotations by simply rotating around the centre in 15 degree increments.

If I want to calculate for a 3d object all the angles possible with equal spacing between each one how would I go about doing this.

although doing p*r*y for each would work it'd be fairly arbitrary and have a huge amount of overlap. I'd really like a quaternion solution too.

I'm doing this for a video game project I'm currently working on, essentially an old school flight sim which although 3d in game-play is rendered as 2d sprites. I'm looking for a simple way to render all the possible angles of my aeroplane model procedurally with equally spaced angles including each orthogonal one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕梦 2024-12-13 21:28:27

有多种方法可以做到这一点;解决方案并不是根据所提供的信息唯一定义的。另请注意,短语“所有可能的角度”具有误导性,因为角度是无限的。

然而,如果“3d 角度”的字面意思是 立体角(以球面度为单位) ,那么 柏拉图立体 会将球体分为相等的立体角。 (从技术上讲,你想要球形多面体,但它们“几乎”是相同的我们可以采取多面体解决方案并“放松”它。)

请记住您希望“[包括]每个正交[角度]”的条件(应该有是一些彼此正交的视图的三元组),我们悲伤地注意到只有一种柏拉图立体满足这一点,即八面体:

在此处输入图像描述

遗憾的是,这相当于仅采用正交视图(并且仅是那些视图)。那会很无聊,而且可能不是您想要的。然而,您可以做的是建立在这个解决方案的基础上,并细分八面体。这里有两种可能性:

  1. 对于八面体中的每个面,您可以在该面的中心创建一个新视图(将其星化)。结果将是每个顶点的视图,如图 this 4 -查看折纸(奇怪的是我能找到的最好的图片)。因此,除了正交角度之外,您还可以在每个轴之间获得 8 个角度,其形式为 (±1,±1,±1)。将视图数量保持在可管理的大小。

  2. 如果您想要更多视图,您可以做一些事情,例如构建测地圆顶,只不过您从八面体而不是二十面体开始。在第一个示例中,我们将每个三角形面细分为细分力的“三角力”,以获得“2频八面体测地球”。

在此处输入图像描述“在此处输入图像描述"*

* 原链接

算法:对每个相邻顶点取数学平均值来产生新的顶点。

这可能无法完美地划分角度,但会相当接近。如果您想要更加“平等”的立体角,请参阅链接以获取“三频八面体测地球体”的示例。

算法:对于第一个近似值,您可以通过获取向量(A+2B)/3来三等分角度,反之亦然。如果您还寻求极高的精度,而不是显式计算方程,则可以使用四面体的立体角公式作为精度的度量,并执行 松弛您最初的猜测,慢慢地扰动三等分朝向或远离原点。

此外,谷歌搜索结果在数学上有点密集,但您也许可以从 等面积球形多面体

There are various ways to do this; the solution isn't uniquely defined from the information given. Also note that the phrase "all possible angles" is misleading because there are infinite angles.

Nevertheless if by "3d angle" you literally mean a solid-angle (in units of steradians), then the platonic solids will divide the sphere into equal solid-angles. (Technically you want spherical polyhedra, but they're "almost" the same in the sense that we can take a polyhedral solution and "relax" it.)

Keeping in mind your condition that you want "[to include] each orthogonal [angle]" (that there should be some triplet of views which are orthogonal to each other), we are saddened to notice that there is only one platonic solid which satisfies this, namely the octahedron:

enter image description here

Sadly this would correspond to just taking the orthogonal views (and only those views). That would be boring and probably not what you intended to ask for. What you can do however is build upon this solution, and subdivide the octahedron. Here are two possibilities:

  1. For each face in the octahedron, you could create a new view at the center of that face (stellate it). The result would be a view from each of the vertices as pictured in this 4-view origami (oddly the best picture I could find). Thus in addition to the orthogonal angles, you gain 8 angles between each axis, of the form (±1,±1,±1). Keeps the number of views down to a manageable size.

  2. If you desire more views, you can do something like building a geodesic dome, except you start with an octahedron rather than an icosahedron. In the first example, we subdivide the triangular faces each into a "triforce" of subdivisive power, to obtain a "2-frequency octahedral geodesic sphere".

enter image description hereenter image description here*

* original link

Algorithm: take the mathematical average of each adjacent vertex to produce the new vertices.

This may not perfectly divide the angles, but it will come fairly close. If you would like even more "equality" of solid angles, see the link for an example of a "3-frequency octahedral geodesic sphere".

Algorithm: To a first approximation, you can trisect an angle by taking the vectors (A+2B)/3, or vice versa. If you furthermore seek extreme precision, rather than explicitly calculating the equations, you can use the solid-angle formula for a tetrahedron as a measure of accuracy, and perform a relaxation on your initial guess, where you slowly perturb the trisections towards or away from the origin.

Additionally the google search results are a bit mathematically dense, but you may be able to glean some use out of equal area spherical polyhedra.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文