line a(x,y,z) b(x-10,y,z) parallel on axis X.
point c(0,0,0).
i need line ab rotation around point a to line bc.
photo:
i try code:
Code: Select all
void rotateVectorAroundAxis(vector3df& vector, const vector3df& axis, f32 radians)
{
quaternion MrQuaternion;
matrix4 MrMatrix;
(void)MrQuaternion.fromAngleAxis(radians, axis);
MrQuaternion.getMatrix(MrMatrix);
MrMatrix.rotateVect(vector);
}
vector3df CenterAxisRotation(vector3df a, vector3df b, vector3df c)
{
vector3df linea = (b - a);
vector3df lineb = (c - a);
vector3df cp = linea.crossProduct(lineb);
f32 radians = acos(a / sqrt(pow(a.x,2)+pow(a.y,2)+pow(a.z,2)));
vector3df ResRot = a;
rotateVectorAroundAxis(ResRot, cp, radians);
return ResRot;
}
thanks all!