can someone help me optimize this function.
it fills a triangle, defined by the the points xa through yc, with the color r g b.
voiddraw_triangle(float xa, float ya, float xb, float yb, float xc, float yc, byte r, byte g, byte b){ // to make fmaxf work you need to compile with the flag -lm float mostLeft = fminf(fminf(xa, xb), xc); float mostRight = fmaxf(fmaxf(xa, xb), xc); float highest = fmaxf(fmaxf(ya, yb), yc); float lowest = fminf(fminf(ya, yb), yc); float fAlpha = lineFunction(xb, yb, xc, yc, xa, ya); float fBeta = lineFunction(xc, yc, xa, ya, xb, yb); float fGamma = lineFunction(xa, ya, xb, yb, xc, yc); float fAf12 = fAlpha * lineFunction(xb, yb, xc, yc, - 1, - 1); float fBf20 = fBeta * lineFunction(xc, yc, xa, ya, - 1, - 1); float fGf01 = fGamma * lineFunction(xa, ya, xb, yb, - 1, - 1); for (int x = mostLeft; x < mostRight; ++x) { for (int y = lowest; y < highest; ++y) { float alpha = lineFunction(xb, yb, xc, yc, x, y) / fAlpha; float beta = lineFunction(xc, yc, xa, ya, x, y) / fBeta; float gamma = lineFunction(xa, ya, xb, yb, x, y) / fGamma; if (alpha >= 0 && beta >= 0 && gamma >= 0) { if ((alpha > 0 || fAf12 > 0) && (beta > 0 || fBf20 > 0) && (gamma > 0 || fGf01 > 0)) { PutPixel(x, y, r, g, b); } } } }}