<commit_before>//Copyright (c) 2017 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include "SierpinskiFillTest.h"
#include "../src/infill/ImageBasedDensityProvider.h"

namespace cura
{
    CPPUNIT_TEST_SUITE_REGISTRATION(SierpinskiFillTest);

void SierpinskiFillTest::setUp()
{
    // no dothing
}

void SierpinskiFillTest::tearDown()
{
    // no dothing
}

void SierpinskiFillTest::debugCheck()
{
    AABB aabb(Point(0,0), Point(1024, 1024)*32);
    //aabb.expand(512);
    SVG svg("output/sierpinski.html", aabb, Point(1000, 1000)*2);
    
    
    DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/simple.png", aabb);
//     subdivider = new UniformSubdivider();
//     srand(1);
    int max_depth = 12;
    bool dithering = true;
    {
        SierpinskiFill f(*subdivider, aabb, max_depth, 400, dithering);
        SVG::Color color = SVG::Color::GREEN;
        switch (max_depth % 4)
        {
            default:
            case 0: color = SVG::Color::GREEN; break;
            case 1: color = SVG::Color::RED; break;
            case 2: color = SVG::Color::BLUE; break;
            case 3: color = SVG::Color::YELLOW; break;
        }
        color = SVG::Color::RAINBOW;
        color = SVG::Color::BLACK;
        svg.writePolygon(f.generateCross(1200, 16), color, 4);
//         svg.writePolygon(f.generateCross(), color, 8);
//         svg.writePoints(f.generateCross());<commit_msg>lil sierpinski test changes<commit_after>//Copyright (c) 2017 Ult<NAME>.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include "SierpinskiFillTest.h"
#include "../src/infill/ImageBasedDensityProvider.h"

namespace cura
{
    CPPUNIT_TEST_SUITE_REGISTRATION(SierpinskiFillTest);

void SierpinskiFillTest::setUp()
{
    // no dothing
}

void SierpinskiFillTest::tearDown()
{
    // no dothing
}

void SierpinskiFillTest::debugCheck()
{
    coord_t line_width = 400;
    AABB aabb(Point(0,0), Point(line_width, line_width)*512);
    //aabb.expand(512);
    Point canvas_size = Point(1000, 1000) * 2;
    SVG svg("output/sierpinski.svg", aabb, canvas_size);
    
    
    int drawing_line_width = line_width * canvas_size.X / aabb.max.X;
    
    DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/lena.png", aabb);
//     DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/gradient.png", aabb);
//     DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/slight_gradient.png", aabb);
//     DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/simple.png", aabb);
//     DensityProvider* subdivider = new ImageBasedDensityProvider("/home/t.kuipers/Documents/PhD/Cross Fractal/gray.png", aabb);
//     subdivider = new UniformSubdivider();
//     srand(1);
    int max_depth = 1;
    for (coord_t size = line_width; size < aabb.max.X; size = size << 1)
    {
        max_depth += 2;
    }
    bool dithering = true;
    {
        SierpinskiFill f(*subdivider, aabb, max_depth, line_width, dithering);
        SVG::Color color = SVG::Color::GREEN;
        switch (max_depth % 4)
        {
            default:
            case 0: color = SVG::Color::GREEN; break;
            case 1: color = SVG::Color::RED; break;
            case 2: color = SVG::Color::BLUE; break;
            case 3: color = SVG::Color::YELLOW; break;
        }
        color = SVG::Color::RAINBOW;
        color = SVG::Color::BLACK;
//         svg.writePolygon(f.generateCross(1200, 16), color, 4);
//         svg.writePolygon(f.generateCross(), color, drawing_line_width);
        svg.writeAreas(f.generateCross(), SVG::Color::WHITE, color, drawing_line_width);
//         svg.writePoints(f.generateCross());
{'fraction_non_alphanumeric': 0.1367017183893306, 'fraction_numerical': 0.022826365734803795, 'mean_word_length': 3.1357370095440085, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7373532', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1333, 'n_words': 260}