title: Yaw rotation: recalculate mins/maxs based on zero based mins/maxs
body: <p><em>Edit by kriegaex:</em> This question is about <a href="https://en.m.wikipedia.org/wiki/Yaw_(rotation)" rel="nofollow noreferrer">yaw rotation</a> as opposed to pitch or roll.</p>
  
  <hr>
  
  <p>So, <code>X = y = z = 0 - mins {105.0, -75.0, 0.0}</code>, <code>maxs {225.0, -15.0, 50.0}</code></p>
  
  <p>So, that's what im doing (it's wrong, or it's just AABB calculating instead needed stuff).</p>
  
  <pre class="lang-cpp prettyprint-override"><code>float fMins[3]; float fMaxs[3];
  float yaw = angles2[1] * (3.14 / 180.0);
  
  float xvector[3]; float yvector[3];
  xvector[0] = floatcos(yaw);
  xvector[1] = floatsin(yaw);
  yvector[0] = -floatsin(yaw);
  yvector[1] = floatcos(yaw);
  float rmin[3] = { 9999.0, 9999.0, 9999.0 };
  float rmax[3] = { -9999.0, -9999.0, -9999.0 };
  float base[3];
  float transformed[3];
  
  for (int i = 0; i &lt;= 1; i++) {
    base[0] = i == 0 ? mins[0] : maxs[0];
    for (int j = 0; j &lt;= 1; j++) {
      base[1] = j == 0 ? mins[1] : maxs[1];
      for (int k = 0; k &lt;= 1; k++) {
        base[2] = k == 0 ? mins[2] : maxs[2];
        transformed[0] = xvector[0]*base[0] + yvector[0]*base[1];
        transformed[1] = xvector[1]*base[0] + yvector[1]*base[1];
        transformed[2] = base[2];
        /*
        if (transformed[0] &lt; rmin[0]) rmin[0] = transformed[0];
        if (transformed[0] &gt; rmax[0]) rmax[0] = transformed[0];
        if (transformed[1] &lt; rmin[1]) rmin[1] = transformed[1];
        if (transformed[1] &gt; rmax[1]) rmax[1] = transformed[1];
        if (transformed[2] &lt; rmin[2]) rmin[2] = transformed[2];
        if (transformed[2] &gt; rmax[2]) rmax[2] = transformed[2];
        */
        for (int l = 0; l &lt; 3; l++) {
          if (transformed[l] &lt; rmin[l]) rmin[l] = transformed[l];
          if (transformed[l] &gt; rmax[l]) rmax[l] = transformed[l];
        }
      }
    }
  }
  
  fMins[0] = rmin[0]; fMaxs[0] = rmax[0];
  fMins[1] = rmin[1]; fMaxs[1] = rmax[1];
  fMins[2] = rmin[2]; fMaxs[2] = rmax[2];
  
  fMins[0] += origin2[0];
  fMins[1] += origin2[1];
  fMins[2] += origin2[2];
  fMaxs[0] += origin2[0];
  fMaxs[1] += origin2[1];
  fMaxs[2] += origin2[2];
  </code></pre>
  
  <p>So, on <code>0 0 0</code> angle's <code>mins maxs</code> are <code>{105.0, -75.0, 0.0}</code> and <code>{225.0, -15.0, 50.0}</code>.</p>
  
  <p>How i can calculate same sizes on <code>0 53 0</code> angles?</p>
  
  <p>I need same sized box, just equalent. Only mins/maxs based solutions.</p>