在C++中,我们可以围绕任意轴旋转一个点:
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) ) );
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时,这会围绕你正在旋转的轴周围的"单位圆"
我们如何才能使它成为theta 0 - > 2PI,结果是关于宽度a,高度b 的椭圆?
我不想在围绕轴旋转它们之后将变换矩阵应用到点 - 我正在寻找的是一个"椭圆"旋转矩阵,如果有人知道这样的话!