在C++中,我们可以绕任意轴旋转一个点:
如何使得当theta从0变化到2PI时,结果围绕一椭圆形状,宽度为a,高度为b?
我不想在旋转点之后应用变换矩阵 - 我要找的是一个“椭圆形”旋转矩阵,如果有人知道这样的东西!
void radRotateAxis( float a, float b, float c, float theta ) { float newX = ( x*( a*a*(1-cos(theta)) + cos(theta) ) + y*( a*b*(1-cos(theta)) - c*sin(theta) ) + z*( a*c*(1-cos(theta)) + b*sin(theta) ) );但是当我们将theta从0变化到2PI时,这会使得该点沿着您旋转的轴周围的“单位圆”移动。
float newY = ( x*( a*b*(1-cos(theta)) + c*sin(theta) ) + y*( b*b*(1-cos(theta)) + cos(theta) ) + z*( b*c*(1-cos(theta)) - a*sin(theta) ) );
float newZ = ( x*( a*c*(1-cos(theta)) - b*sin(theta) ) + y*( b*c*(1-cos(theta)) + a*sin(theta) ) + z*( c*c*(1-cos(theta)) + cos(theta) ) );
x = newX ; y = newY ; z = newZ ; }
如何使得当theta从0变化到2PI时,结果围绕一椭圆形状,宽度为a,高度为b?
我不想在旋转点之后应用变换矩阵 - 我要找的是一个“椭圆形”旋转矩阵,如果有人知道这样的东西!