绕特定点旋转(例如,绕0,0,0旋转) [英] Rotation around a specific point (eg, rotate around 0,0,0)

查看:112
本文介绍了绕特定点旋转(例如,绕0,0,0旋转)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索这个问题,但我找不到合适的答案。

我需要围绕给定点旋转圆柱体(例如,0,0) ,0),但是默认情况下给出了圆柱的枢轴。我该怎么改变?

I've been searching a lot on this problem, but I couldn't really find an answer that would fit.
I need to rotate a cylinder around a given point (eg, 0,0,0), but the pivot of the cylinder is given by default. How do i change that?

我发现这个主题,这是我想要做的,但我不知道如何用java做。

I found this topic, and it's quite what I would want to do, but I don't know how to do it with java.

为了更好地解释我想做什么,我将展示3张图片。(v)

To explain better what I would like to do, I'll show 3 images.(v)

imageshack.us/photo /my-images/259/aintgood.jpg

imageshack.us/photo/my-images/259/aintgood.jpg

imageshack.us/photo/my-images/840/whatineed.jpg

imageshack.us/photo/my-images/840/whatineed.jpg

imageshack.us/photo/my-images/705/nogoodn.jpg

imageshack.us/photo/my-images/705/nogoodn.jpg

所以,第一张图片显示我的基本问题,圆柱应定位结束在球体的中心,让我们说(0,0,0)。用户给出两个角度。第一个是rotX命令,第二个是rotZ命令。圆柱体的枢轴位于其中心,因此,如图3所示,即使我将圆柱体平移,使其末端位于球体的中心,当它旋转时,整个物体也会消失。

So, the first image shows my basic problem, the cylinder should be positioned with the end at the center of the sphere, let's say (0,0,0). The user gives two angles. The first one is for a rotX command, the second one for a rotZ one. The pivot of the cylinder is at its center, so, as image 3 shows, even if i translate the cylinder so its end is at the center of the sphere, when it rotates, the whole thing ruins.

图2显示了圆柱体组的外观,无论给定的角度如何。
图像不是基于算法获得的,而是基于微积分和mouserotated。

Image 2 shows what the cylinder-sphere group should look like, regardless the given angles. The image is not obtained based on an algorithm, but based on calculus, and mouserotated.

推荐答案

一般程序旋转任意点P是:

The general procedure for rotation about an arbitrary point P is:


  1. 翻译-P(所以P是(0,0,0))

  2. 围绕原点旋转

  3. 翻译P(将原点带回P的原始位置)

最简单的方法是在同类中表示所有内容坐标并用矩阵表示翻译和旋转。组合上述三个变换(translate-rotate-translate)是通过矩阵乘法完成的。如果旋转由两个或更多更简单的旋转组成,则旋转矩阵本身是矩阵的乘积,用于更简单的旋转。

The easiest way to do this is to represent everything in homogeneous coordinates and represent translations and rotations by matrices. Composing the above three transformations (translate-rotate-translate) is done by matrix multiplication. If the rotation is composed of two or more simpler rotations, then the rotation matrix itself is a product of the matrices for the simpler rotations.

这篇关于绕特定点旋转(例如,绕0,0,0旋转)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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