- #1
Adder_Noir
- 239
- 0
Hi!,
I'm well into the world of computer graphics. Love to say it was great but well, it isn't.
I would like to know how I can take any object and have it orientate so its centre aligns perfectly with any arbitrary axis.
Think of a cylinder at the origin pointing down the x-axis. Well I would like to know how I can rotate it so it points directly down an axis denoted by say (1,1,0) essentially in this theoretical case rotating it 45 degress. I haven't got a clue how to do this and I'm a bit thick too at times.
I know it has something to do with inverse matrices and such. I can get all the required inverse, determinant stuff from DirectX hard-coded functions so I don't even need to do much math I just need the solution method.
Any ideas? Naturally I can get a unit vector pointing down the required axis easily enough but how do I go about acquiring the necessary transform matrix to get something to go from its present position to be aligned with a new axis? Sure I know it's a concoction of X,Y, & Z rotations but hell which order to apply them in even if I did have the necessary rotations? I'm proper confused!
Thanks a lot for any help offered
I'm well into the world of computer graphics. Love to say it was great but well, it isn't.
I would like to know how I can take any object and have it orientate so its centre aligns perfectly with any arbitrary axis.
Think of a cylinder at the origin pointing down the x-axis. Well I would like to know how I can rotate it so it points directly down an axis denoted by say (1,1,0) essentially in this theoretical case rotating it 45 degress. I haven't got a clue how to do this and I'm a bit thick too at times.
I know it has something to do with inverse matrices and such. I can get all the required inverse, determinant stuff from DirectX hard-coded functions so I don't even need to do much math I just need the solution method.
Any ideas? Naturally I can get a unit vector pointing down the required axis easily enough but how do I go about acquiring the necessary transform matrix to get something to go from its present position to be aligned with a new axis? Sure I know it's a concoction of X,Y, & Z rotations but hell which order to apply them in even if I did have the necessary rotations? I'm proper confused!
Thanks a lot for any help offered