# How much does a normal change during a rotation?

Hi, I am still new here and have what sounds like should be a relatively simple question. I have a drawing that I can rotate, following the Discover Three.js book, by specifying arbitrary angles of rotation about the x, y, and z axes. In my application, I am rotating the entire Scene so that everything rotates together. Now, suppose I start out knowing a normal vector pointing along the X axis (1, 0, 0). Because it’s not an Object3D, it’s not part of the Scene and doesn’t rotate with everything else. After an arbitrary rotation, the Scene has a rotation value specified as Euler coordinates and a quaternion value specified as a Quaternion. How can I use one of those to know the new coordinates of my normal vector?

Is this a local vs. world coordinates question or a quaternion rotation question or something else? I suppose the normal vector, if it had rotated with the Scene, might still be pointing right along the (new) X axis in the Scene’s coordinate system. That’s pretty useless information to me. What I need to know are the x, y, z coordinates of a normal that would have rotated with the Scene. For a very simple example, if I rotate by 90 degrees about the Z axis, the old normal pointing along the X axis (1, 0, 0) would now be pointing along the Y axis (0, 1, 0). Sure, the Scene’s X and Y axes have probably changed, so that what I’m calling the Y axis is really the rotated X axis, but what I need is to know how the normal would have rotated in a fixed coordinate system that did not rotate along with the Scene. For simple rotations about a single axis, knowing how the normal changed should be pretty simple, but I’m guessing that arbitrary rotations about two or more axes will involve knowing what to do with the quaternion. But what?

And to be clear, the reason I need this is to implement clipping planes so that they “do the right thing” during, or at least after, a rotation. I.e, so the clipping planes rotate along with the Scene. In my current implementation, because a clipping pane is not an Object3D and not part of the scene, my clipping planes stay put in the original coordinate system rather than rotate with the scene, causing a quite undesirable effect by clipping where I don’t want them to.

Thanks for any advice you can offer.

Given you have the original orientation(`srcV`) and the final orientation(`tgtV`), you could use something like this to reorient the vector to the intended orientation.

``````let vec = new THREE.Vector3(1, 0, 0);
let qt = new THREE.Quaternion().setFromUnitVectors(srcV, tgtV);
vec.applyQuaternion(qt);
``````

Many thanks for your reply, but I don’t think I know the final orientation vector. That’s kind-of what I’m looking for. All I have is a quaternion representing how the entire scene has rotated (or the equivalent Euler angles).

To be specific, what I am calling a “rotation” actually adjusts the Euler angles like this:

``````scene.rotation.x += <some arbitrary amount>
scene.rotation.y += <some other arbitrary amount>
scene.rotation.z += <ditto>
``````

after which the scene has a new set of Euler angles (and a quaternion that somehow magically encodes the complete rotation change), but I don’t know how to go from an arbitrary change in Euler angles along all three axes (or the equivalent quaternion) to a change in unit vectors that started out pointing along the original X, Y, and Z axes before the scene was rotated.

Thanks for any additional insight anyone can shed onto this newbie.

If I understand that right seems like you have everything and all you need is `vec.applyQuaternion(qt);` where `vec` can be “the original X, Y, and Z axes” individually and `qt` is the “quaternion representing how the entire scene has rotated”.
A codepen/jsfiddle might help if that’s not what you are looking for .

Yes indeed, you are correct. Thanks so much. I just needed a little help knowing how to use the quaternion. Meanwhile, I also learned I could use the localToWorld() method on my unit vectors. Thanks again.