Translate Point By Pitch/Roll

This isn’t really Java dev related, however it is graphics dev related. I’m drawing an axis aligned bounding box and I need to be able to translate it by pitch and roll. I’ve already got yaw working but I’m not sure how to add in the others. Also, this must be without any matrices or quaternions.

Here’s what I have so far, corners array is just the vector positions of the AABB corners (C# but easily understandable):


public void Setup(float yaw, float pitch = 0, float roll = 0)
{
    float cosY = (float)Math.Cos(yaw + (float)((Math.PI / 180) * (90)));
    float sinY = (float)Math.Sin(yaw + (float)((Math.PI / 180) * (90))); // adding 90 degrees to just rotate the box around a bit to fit better. Not necessary in pitch and roll

    for (int i = 0; i < 8; ++i)
    {
        float x = (corners[i].Z * cosY - corners[i].X * sinY);
        float y = (corners[i].X * cosY + corners[i].Z * sinY);
        corners[i] = new Vector3D(x, corners[i].Y, y);
        corners[i] += origin;
    }
}

This works fine to rotate the AABB on the Y axis. How would I add in the x and z axis rotations? Thanks a bunch.

Why are you trying to make things difficult for yourself? If there is a good reason I will be happy to help you out but I cannot imagine a situation where using matrices wouldn’t make this task a whole lot easier.

Seriously, try and imagine rotating a vector about the y axis, the about the x axis and finally about the z axis? Confused yet? No, try drawing down a diagram for each stage with a nice little right angled triangle so you can work out the trigonometry. I say these things because I have tried and it is not worth the effort.

Edit: Solved, I was being stupid and lazy last night. Just had to code out matrix multiplication and transposition then created pitch roll and yaw matrices. Easy. This topic can be deleted.