title: texture mapping using bilinear interpolation
body: <p>I have been trying to achieve texture mapping using the bilinear interpolation method.I have been trying to rasterize a triangle thus i first find the barycentric weights and then try to interpolate the uv co-ordinates but have got no success. Could some one suggest me if i am doing something wrong?</p>
  
  <pre><code>   void baryWeights(int x4,int y4)
    {
  b1=(float)((x4*y2)-(x4*y3)-(x2*y4)+(x2*y3)+(x3*y4)-(x3*y2))/((x1*y2)-(x1*y3)-(x2*y1z)+(x2*y3)+(x3*y1z)-(x3*y2));
  b2=(float)((x1*y4)-(x1*y3)-(x4*y1z)+(x4*y3)+(x3*y1z)-(x3*y4))/((x1*y2)-(x1*y3)-(x2*y1z)+(x2*y3)+(x3*y1z)-(x3*y2));
  b3=(float)((x1*y2)-(x1*y4)-(x2*y1z)+(x2*y4)+(x4*y1z)-(x4*y2))/((x1*y2)-(x1*y3)-(x2*y1z)+(x2*y3)+(x3*y1z)-(x3*y2));
   }
    void linearinterpolation()
   {
  uc=b1*v1u+b2*v2u+b3*v3u;
  vc=b1*v1v+b2*v2v+b3*v3v;
    }
  </code></pre>
  
  <p>I get distorted texture mapping for this code that i am using</p>