Пример #1
0
int main(int, char**){

    MyImage image;
    
    //Set up parameters for the triangl

    vec2 v0(100, 100);
    vec2 v1(200, 300);
    vec2 v2(400, 50);

    float TotalArea = triangleArea(v0, v1, v2);
    //rasterize the triangle   
    for (int row = 0; row < image.rows; ++row) {
        for (int col = 0; col < image.cols; ++col) {
            vec2 pt(col, row);

            /// Calculate the barycentric coordinates using the triangle area

       }
    }

   
    image.show();
    // image.save("output.png"); ///< Does not work on Windows!

    return EXIT_SUCCESS;
}
Пример #2
0
int main(int, char**){

    MyImage image;
    
    //Set up parameters for the line segment 
    vec2 lineStart(100, 200);
    vec2 lineEnd(500, 220);   
    //Line drawing - midpoint algorithm
    //determine if we do a x-loop or y-loop
    //TODO: Rasterize the line using the mid-point algorithm
    
    image.show();
    // image.save("output.png"); ///< Does not work on Windows!

    return EXIT_SUCCESS;
}