<commit_before>//  Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog)

var Class = require('../../utils/Class');
var FromPoints = require('../../geom/rectangle/FromPoints');
var Rectangle = require('../../geom/rectangle/Rectangle');
var Vector2 = require('../../math/Vector2');

//  Local cache vars

var tmpVec2A = new Vector2();
var tmpVec2B = new Vector2();

//  Our Base Curve which all other curves extend

var Curve = new Class({

    initialize:

    function Curve ()
    {
        this.defaultDivisions = 5;

        this.arcLengthDivisions = 100;

        this.cacheArcLengths = [];

        this.needsUpdate = true;

        this.active = true;
    },

    getBounds: function (out)
    {
        if (out === undefined) { out = new Rectangle(); }

        //  The length of the curve in pixels
        //  So we'll have 1 spaced point per 10 pixels

        var spaced = Math.max(1, Math.round(this.getLength() / 10));

        return FromPoints(this.getSpacedPoints(spaced), out);
    },

    getStartPoint: function (out)
    {
        if (out === undefined) { out = new Vector2(); }

        return this.getPointAt(0, out);
    },
<commit_msg>Added accuracy argument to getBounds and made sure it wasn't > curve length.<commit_after>//  Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog)

var Class = require('../../utils/Class');
var FromPoints = require('../../geom/rectangle/FromPoints');
var Rectangle = require('../../geom/rectangle/Rectangle');
var Vector2 = require('../../math/Vector2');

//  Local cache vars

var tmpVec2A = new Vector2();
var tmpVec2B = new Vector2();

//  Our Base Curve which all other curves extend

var Curve = new Class({

    initialize:

    function Curve ()
    {
        this.defaultDivisions = 5;

        this.arcLengthDivisions = 100;

        this.cacheArcLengths = [];

        this.needsUpdate = true;

        this.active = true;
    },

    getBounds: function (out, accuracy)
    {
        if (out === undefined) { out = new Rectangle(); }
        if (accuracy === undefined) { accuracy = 16; }

        var len = this.getLength();

        if (accuracy > len)
        {
            accuracy = len / 2;
        }

        //  The length of the curve in pixels
        //  So we'll have 1 spaced point per 'accuracy' pixels

        var spaced = Math.max(1, Math.round(len / accuracy));

        return FromPoints(this.getSpacedPoints(spaced), out);
    },

    getStartPoint: function (out)
    {
        if (out === undefined) { out = new Vector2(); }

        return this.getPointAt(0, out);
    },

{'fraction_non_alphanumeric': 0.14058355437665782, 'fraction_numerical': 0.017051913603637742, 'mean_word_length': 2.308270676691729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2107799', 'n_tokens_mistral': 838, 'n_tokens_neox': 780, 'n_words': 230}