Rotating normals - help

My linear algebra is failing me (and I'm distracted by this prof in the front of the room talking) so I need some assistance.



I have noticed while debugging some collision code that when I calculate the normals for triangles involed in a collision, the normals do not take into account that the object may be rotated.



Example: I create a box, initially a specific side of the box has a normal facing (1,0,0) out along the X+, now I rotate the box about the y axis -90 degrees, so the side is now pointing out along the Z+. So, really the new normal for that side is (0,0,1), but when I request the normal it still returns (1,0,0).



So I need to recalculate the normal relative to the rotation of the object. How do I do it?



I have access to all the usual collision data (targetMesh) and can get the rotation, I don't know how to apply it.



This is where it needs to happen:


   Triangle t = triangles[i];
   t.calculateNormal();
   Vector3f tNorm = t.getNormal();

   // HERE I need to do some math on tNorm for rotation

   normal.addLocal(t.getNormal());


Ok, now that I'm not distracted anymore.



I figured out my own problem and the solution is simple. Just multiply the normal by the rotation quaternion (duh). :-o



My own solution:


   Triangle t = triangles[i];
   t.calculateNormal();
   normal.addLocal(triData.getTargetMesh().getLocalRotation().mult(t.getNormal()));



Sorry if I made anyone's brain hurt.