# How to recalculate AABB after rotation?

I'm facing a problem trying to calculate the AABB on my models after rotation is applied. The rotation is not applied on the vertex positions directly, but in a seperate rotation matrix - just multiplied with the projection matrix and set as uniform. Currently I'm calculating the min/max of the vertexes on all three axes (x, y, z) to calculate the AABB. This works well, as long as the model is unrotated.

AABB calculateAabb() {
glm::vec3 center, extend;
glm::vec3 min, max;
for (size_t i = 0; i < getVertexCount(); ++i) {
if (positions[i * 3] < min.x){
min.x = positions[i * 3];
}
if (positions[i * 3 + 1] < min.y) {
min.y = positions[i * 3 + 1];
}
if (positions[i * 3 + 2] < min.z) {
min.z = positions[i * 3 + 2];
}
if (positions[i * 3] > max.x) {
max.x = positions[i * 3];
}
if (positions[i * 3 + 1] > max.y) {
max.y = positions[i * 3 + 1];
}
if (positions[i * 3 + 2] > max.z) {
max.z = positions[i * 3 + 2];
}
}
extend = (max - min) * 0.5f;
center = min + extend;
return AABB(center, extend);
}


The std::vector positions[] contains all vertexes in the order x, y, z - getVertexCount() returns positions.size()/3. My rotation matrix is described by a single angle on the y axis glm::eulerAngleY(glm::radians(angle));.

My question is: is there any way to calculate the AABB for the rotated model without applying the rotation matrix to all the vertexes individually? How can I get min/max values on the axes from a rotated coordinate system?