<commit_before>/**
 * Created by <NAME> on 11.2.2015 г..
 */

var LightSourceManager = function () {

    this.lightSources = [];
    this.idCounter = 0;

    this.update = function () {
        for (var i = 0; i < this.lightSources.length; i++) {
            if (this.lightSources[i]) {
                this.lightSources[i].update();
            }
        }
    }

    setInterval((function(self) { return function() { self.update(); } })(this), 200);


    this.addLightSource = function (ls) {
        this.lightSources[this.idCounter] = ls;
        return this.idCounter++;
    }

    this.removeLightSource = function (id) {
        this.lightSources[id] = undefined;
    }

    this.renderLayer = function (ctx, i) {
        for (var j = 0; j < this.lightSources.length; j++) {
            if (this.lightSources[j]) {
                this.lightSources[j].render(ctx, i);
            }
        }
    }
}

var LightSource = function (x, y, r, rflicker) {
    this.x = x;
    this.y = y;
    this.r = r;
    this.fr = r.slice;
    this.rflicker = rflicker;

    this.update = function () {
        var flicker = Math.random() * this.rflicker * 2 - this.rflicker;
        for (var i = 0; i < 3; i++) {
            this.fr[i] = this.r[i] + ( this.r[i] / 100 ) * flicker;
        }
    };

    this.render = function (ctx, i) {
        if(i==0){console.log("x:"+this.x+" r:"+this.fr[i]);}
        ctx.arc(this.x, this.y, this.fr[i], 0, Math.PI * 2);
    }
};<commit_msg>Fixed radius issues with light sources.<commit_after>/**
 * Created by <NAME> on 11.2.2015 г..
 */

var LightSourceManager = function () {

    this.lightSources = [];
    this.idCounter = 0;

    this.update = function () {
        for (var i = 0; i < this.lightSources.length; i++) {
            if (this.lightSources[i]) {
                this.lightSources[i].update();
            }
        }
    }

    setInterval((function(self) { return function() { self.update(); } })(this), 200);


    this.addLightSource = function (ls) {
        this.lightSources[this.idCounter] = ls;
        return this.idCounter++;
    }

    this.removeLightSource = function (id) {
        this.lightSources[id] = undefined;
    }

    this.renderLayer = function (ctx, i) {
        for (var j = 0; j < this.lightSources.length; j++) {
            if (this.lightSources[j]) {
                this.lightSources[j].render(ctx, i);
            }
        }
    }
}

var LightSource = function (x, y, r, rflicker) {
    this.x = x;
    this.y = y;
    this.r = r;
    this.fr = this.r.slice();
    this.rflicker = rflicker;

    this.update = function () {
        var flicker = Math.random() * this.rflicker * 2 - this.rflicker;
        for (var i = 0; i < 3; i++) {
            this.fr[i] = this.r[i] + ( this.r[i] / 100 ) * flicker;
        }
    };

    this.render = function (ctx, i) {
        console.log(this);
        ctx.moveTo(this.x, this.y);
        ctx.arc(this.x, this.y, this.fr[i], 0, Math.PI * 2);
    }
};
{'fraction_non_alphanumeric': 0.16806722689075632, 'fraction_numerical': 0.014453781512605042, 'mean_word_length': 1.8837209302325582, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4353066', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1017, 'n_words': 220}