<commit_before>// Simple example effect:
// Draws a noise pattern modulated by an expanding sine wave.

#include <math.h>
#include "color.h"
#include "effect.h"
#include "noise.h"

class MyEffect : public Effect
{
public:
    MyEffect()
        : angle (0) {}

    float angle;

    virtual void nextFrame(float timeDelta)
    {
        const float speed = 10.0;
        angle = fmodf(angle + timeDelta * speed, 2 * M_PI);
    }

    virtual void calculatePixel(float rgb[3], const PixelInfo &p)
    {
        float distance = sqrtf(p.x * p.x + p.y * p.y + p.z * p.z);
        float wave = sinf(3.0 * distance - angle) + noise3(p.x, p.y, p.z);
        hsv2rgb(rgb, 0.2, 0.3, wave);
    }
};

int main(int argc, char **argv)
{
    EffectRunner r;

    MyEffect e;
    r.setEffect(&e);

    // Defaults, overridable with command line options
    r.setMaxFrameRate(100);
    r.setLayout("../layouts/grid32x16z.json");

    return r.main(argc, argv);
}<commit_msg>Use sq() for square in simple.cpp<commit_after>// Simple example effect:
// Draws a noise pattern modulated by an expanding sine wave.

#include <math.h>
#include "color.h"
#include "effect.h"
#include "noise.h"

class MyEffect : public Effect
{
public:
    MyEffect()
        : angle (0) {}

    float angle;

    virtual void nextFrame(float timeDelta)
    {
        const float speed = 10.0;
        angle = fmodf(angle + timeDelta * speed, 2 * M_PI);
    }

    virtual void calculatePixel(float rgb[3], const PixelInfo &p)
    {
        float distance = sqrtf(sq(p.x) + sq(p.y) + sq(p.z));
        float wave = sinf(3.0 * distance - angle) + noise3(p.x, p.y, p.z);
        hsv2rgb(rgb, 0.2, 0.3, wave);
    }
};

int main(int argc, char **argv)
{
    EffectRunner r;

    MyEffect e;
    r.setEffect(&e);

    // Defaults, overridable with command line options
    r.setMaxFrameRate(100);
    r.setLayout("../layouts/grid32x16z.json");

    return r.main(argc, argv);
}
{'fraction_non_alphanumeric': 0.1421923474663909, 'fraction_numerical': 0.02171664943123061, 'mean_word_length': 2.5701107011070112, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7521832', 'n_tokens_mistral': 725, 'n_tokens_neox': 683, 'n_words': 190}