Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

3D Rotation

ShkaboinkaShkaboinka Member Posts: 79
I am writing my own 3D classes and stuff using nothing but 2D java graphics, so PLEASE don't tell me anything to do with any 3D libraries!!

I need to know how to track the rotation of a 3D object SEPARATELY; Lets just say that a 3D object is defined by a bunch of {x,y,z} points, and I just rotate all of the points to rotate the object. I want to be able to track how an object is rotated without rotating the object, so that I can rotate the ORIGINAL object into it's current position when I draw it and stuff.

I have thought of a few ways: keeping track of 3 angles (one for each perpendicular plane: xy, xz, yz) or just a 3D point to describe it's orientation from {0,0,0}. The problem there is that I'd need to know how the object is rotated around the axis described by the from this point to {0,0,0}, but I don't know how to do that. I also don't know how to rotate around such an axis (I only can rotate around the x,y, or z axis).

ALSO, I need the option of being able to rotate an object from it's own point of view, or from the "world's" point of view. I can do world's point of view. Can any of this be explained WITHOUT matrices?
I know many of you CANT do that, but watch me do it:

[code]
simple rotation:
X = X*cos(angle) + Y*sin(angle)
Y = Y*cos(angle) - X*sin(angle)
where X and Y are the axis that are on the plane of rotation (rotating around Z where Z is the axis of rotation, though it is not used)
[/code]

Now I know that nobody actually uses matrices to do the work in their code, so why can't they explain without them?

Comments

  • CroWCroW Member Posts: 348
    wow,youve got defintly a hard job to do.

    first thing: youre using java,which isnt that fast,so you definitly need some maths-optimizations to get some usable performance.without matrices,you do double the work for each vertex you want to rotate/translate/scale.you should learn about matrices and vectors,otherwise you wont be able to render realtime on slower machines and stay at very low vertice-numbers per frame.

    btw,i think it is possible to access opengl with java,it does lots of the basic matrices-stuff for you (like building rotation/scale/translation-matrices,multiply them,etc) and is on hardware-accelerated on most platforms.
Sign In or Register to comment.