title: clipping the mesh against user defined region
body: <p>I am implementing clipping algorithm for a mesh where clipping region is a rectangle in normalized space [-1 , 1]. 
  So my algorithm is as follows:</p>
  
  <ol>
  <li><p>Create bounding box of a region to be used for a clipping, these coordinates will be in normalized space.</p></li>
  <li><p>Create bounding box of a mesh in local space. transform them to clip coordinate space using MVP matrix. Divide by w to transform them into normalized space. </p>
  
  <pre><code>vec4 transformed_coords = MVP * vec4(vertex,1.0);
  transformed_coords.xyz /= transformed_coords.w;
  </code></pre></li>
  <li><p>Check whether the two rectangles overlap or not. Use only x-y coordinates.</p></li>
  </ol>
  
  <p>With this algorithm I am getting incorrect output.</p>
  
  <pre><code>model matrix
    1.000000  0.000000  0.000000  0.000000
    0.000000  0.000000 -1.000000  0.000000
    0.000000  1.000000  0.000000  0.000000
    0.000000  0.000000  0.000000  1.000000
  
  view * projection
    0.920664 -0.285565 -0.266194 -0.266141
    0.039495  0.746434 -0.664418 -0.664286
   -0.388354 -0.601072 -0.698633 -0.698493
   -0.063192 -1.194295  0.894055  1.093857
  
  MVP matrix 
    0.920664 -0.285565 -0.266194 -0.266141
    0.388354  0.601072  0.698633  0.698493
    0.039495  0.746434 -0.664418 -0.664286
   -0.063192 -1.194295  0.894055  1.093857
  
  bounding box in object space
    -23.376505 -23.376505 -0.023644
     23.376505 -23.376505 -0.023644
    -23.376505  23.376505 -0.023644
     23.376505  23.376505 -0.023644
    -23.376505 -23.376505  1.430214
     23.376505 -23.376505  1.430214
    -23.376505  23.376505  1.430214
     23.376505  23.376505  1.430214
  
  after transformation with MVP
    -30.664371  -8.587399  -9.199142  -8.997323
     12.379420 -21.938423 -21.644522 -21.440216
    -12.507672  19.514534  23.464052  23.659344
     30.536121   6.163512  11.018670  11.216449
    -30.606953  -7.502190 -10.165111  -9.963099
     12.436841 -20.853212 -22.610493 -22.405994
    -12.450252  20.599745  22.498081  22.693565
     30.593540   7.248722  10.052701  10.250672
  
   the bounding box after MinMax NDC min -0.577393 0.549507 1.000000 max 3.408166 1.023237 1.000000 
   after NDC 
     3.408166 0.954439 1.022431 1.000000
    -0.577393 1.023237 1.009529 1.000000
    -0.528657 0.824813 0.991746 1.000000
     2.722441 0.549507 0.982367 1.000000
     3.072031 0.752998 1.020276 1.000000
    -0.555068 0.930698 1.009127 1.000000
    -0.548625 0.907735 0.991386 1.000000
     2.984540 0.707146 0.980687 1.000000
  
  .min -0.577393 0.549507 max 3.408166 1.023237
  </code></pre>
  
  <p>Whereas min and max corner for region is min: -0.53, -0.53 max: 0.53, 0.53.</p>
  
  <p>What could be going wrong here?</p>