<commit_before>// TODO: sub Segments?

(function(global, undefined) {
    "use strict";

    // TODO: test if this is there (i.e. don't just assume, handle it
    // when it's not there)
    var Raphael = global.Raphael,

    // but this is very much a temporary thing until I understand a better
    // way to pass this in
      r = Raphael("canvas", 600, 400),

      pub = {};

    /*** Objects ***/

    pub.Point = function( x, y ) {
        this.x = x;
        this.y = y;
    };

    pub.Point.prototype.draw = function() {
        if ( !this.display ) {
            var attr = {fill: "#000"};
            this.display = r.circle(this.x, this.y, 2).attr(attr);
        }
    };

    pub.Segment = function( pt1, pt2 ) {
        // ugly, but some other logic depends on left-most being the first point
        if ( pt1.x <= pt2.x ) {
            this.A = pt1;
            this.B = pt2;
        } else {
            this.A = pt2;
            this.B = pt1;
        }

        this.length = Math.sqrt(Math.pow(this.B.x - this.A.x, 2) +
                                Math.pow(this.B.y - this.A.y, 2));
    };

    pub.Segment.prototype.draw = function(stroke) {
        var pt2String = function( pt ) {
            return pt.x+", "+pt.y;
        };

        if ( !this.display ) {
            var path = "M"+pt2String(this.A)+"L"+pt2String(this.B),
                attr = {
                    "stroke-width": 2,
                    "stroke": stroke || "#000"
                };
            
            this.display = r.path(path).attr(attr);
        }
    };

    // get change from A to B
    pub.Segment.prototype.getChangePerLength = function( coord ) {
        if ( coord === "x" ) {
            return (this.B.x - this.A.x) / this.length;
        } else {
            return (this.B.y - this.A.y) / this.length;
        }
    };

    
    pub.Segment.prototype.drawA = function() {
        this.A.draw();
    };

    pub.Segment.prototype.drawB = function() {
        this.B.draw();
    };

    pub.Circle = function( point, rad ) {
        this.center = point;
        this.cx = point.x;
        this.cy = point.y;
        this.rad = rad;
    };


    pub.Circle.prototype.draw = function(stroke) {
        if ( !this.display ) {<commit_msg>add space around stroke params in the draw functions for Segment and Circle (i forgot i was doing that)<commit_after>// TODO: sub Segments?

(function(global, undefined) {
    "use strict";

    // TODO: test if this is there (i.e. don't just assume, handle it
    // when it's not there)
    var Raphael = global.Raphael,

    // but this is very much a temporary thing until I understand a better
    // way to pass this in
      r = Raphael("canvas", 600, 400),

      pub = {};

    /*** Objects ***/

    pub.Point = function( x, y ) {
        this.x = x;
        this.y = y;
    };

    pub.Point.prototype.draw = function() {
        if ( !this.display ) {
            var attr = {fill: "#000"};
            this.display = r.circle(this.x, this.y, 2).attr(attr);
        }
    };

    pub.Segment = function( pt1, pt2 ) {
        // ugly, but some other logic depends on left-most being the first point
        if ( pt1.x <= pt2.x ) {
            this.A = pt1;
            this.B = pt2;
        } else {
            this.A = pt2;
            this.B = pt1;
        }

        this.length = Math.sqrt(Math.pow(this.B.x - this.A.x, 2) +
                                Math.pow(this.B.y - this.A.y, 2));
    };

    pub.Segment.prototype.draw = function( stroke ) {
        var pt2String = function( pt ) {
            return pt.x+", "+pt.y;
        };

        if ( !this.display ) {
            var path = "M"+pt2String(this.A)+"L"+pt2String(this.B),
                attr = {
                    "stroke-width": 2,
                    "stroke": stroke || "#000"
                };
            
            this.display = r.path(path).attr(attr);
        }
    };

    // get change from A to B
    pub.Segment.prototype.getChangePerLength = function( coord ) {
        if ( coord === "x" ) {
            return (this.B.x - this.A.x) / this.length;
        } else {
            return (this.B.y - this.A.y) / this.length;
        }
    };

    
    pub.Segment.prototype.drawA = function() {
        this.A.draw();
    };

    pub.Segment.prototype.drawB = function() {
        this.B.draw();
    };

    pub.Circle = function( point, rad ) {
        this.center = point;
        this.cx = point.x;
        this.cy = point.y;
        this.rad = rad;
    };


    pub.Circle.prototype.draw = function( stroke ) {
        if ( !this.display ) {
{'fraction_non_alphanumeric': 0.14695652173913043, 'fraction_numerical': 0.011739130434782608, 'mean_word_length': 1.4228541337546077, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, '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': '1008657', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1454, 'n_words': 362}