<commit_before>package hx.geom;

class Matrix
{
    public var a:Float;
    public var b:Float;
    public var c:Float;
    public var d:Float;
    public var tx:Float;
    public var ty:Float;

    public function new(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0)
    {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
        this.tx = tx;
        this.ty = ty;
    }

    public function rotate(angle:Float):Void 
    {
        var cos = Math.cos(angle);
        var sin = Math.sin(angle);
        var a1 = a * cos - b * sin;
        b = a * sin + b * cos;
        a = a1;
        var c1 = c * cos - d * sin;
        d = c * sin + d * cos;
        c = c1;
        //var tx1 = this.tx * cos - this.ty * sin;
        //this.ty = this.tx * sin + this.ty * cos;
        //this.tx = tx1;
    }

    public function scale(x:Float, y:Float):Void 
    {
        a *= x;
        b *= y;
        c *= x;
        d *= y;
        //tx *= x;
        //ty *= y;
    }

    public function setSkew(x:Float, y:Float):Void 
    {
        a = Math.cos(y);
        b = Math.sin(y);
        c = -Math.sin(x);
        d = Math.cos(x);
    }

    public function skew(x:Float, y:Float):Void 
    {
        var cosY = Math.cos(y);
        var sinY = Math.sin(y);
        var a1 = a * cosY - sinY * b;
        b = b * cosY + a * sinY;
        a = a1;
        var cosX = Math.cos(x);
        var sinX = Math.sin(x);
        var c1 = c * cosX - d * sinX;
        d = d * cosX + c * sinX;
        c = c1;
    }

    public function translate(?x=0.0, ?y=0.0, point=null):Void 
    {
        if (null == point) {
            tx += x;
            ty += y;
        }else {
            tx += point.x;
            ty += point.y;
        }
    }

    public function deltaTransformPoint(point:{x:Float, y:Float}):{x:Float, y:Float}
    {
        return new Point(point.x * a + point.y * c, point.x * b + point.y * d);
    }

    public function transformPoint(point:{x:Float, y:Float}):{x:Float, y:Float}
    {
        return new Point(point.x * a + point.y * c + tx, point.x * b + point.y * d + ty);
    }

    public function sub(matrix:Matrix):Matrix
    {
        return new Matrix(a - matrix.a, b - matrix.b, c - matrix.c, d - matrix.d, tx - matrix.tx, ty - matrix.ty);
    }

    public function add(matrix:Matrix):Matrix
    {
        return new Matrix(a + matrix.a, b + matrix.b, c + matrix.c, d + matrix.d, tx + matrix.tx, ty + matrix.ty);
    }

    public function multi(num:Float):Matrix
    {
        return new Matrix(a * num, b * num, c * num, d * num, tx * num, ty * num);
    }

    public function div(num:Float):Matrix
    {
        return new Matrix(a / num, b / num, c / num, d / num, tx / num, ty / num);
    }

    public function toFlashMatrix():flash.geom.Matrix
    {
        return new flash.geom.Matrix(a, b, c, d, tx, ty);
    }
}<commit_msg>添加Matrix克隆函数<commit_after>package hx.geom;

class Matrix
{
    public var a:Float;
    public var b:Float;
    public var c:Float;
    public var d:Float;
    public var tx:Float;
    public var ty:Float;

    public function new(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0)
    {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
        this.tx = tx;
        this.ty = ty;
    }

    public function rotate(angle:Float):Void 
    {
        var cos = Math.cos(angle);
        var sin = Math.sin(angle);
        var a1 = a * cos - b * sin;
        b = a * sin + b * cos;
        a = a1;
        var c1 = c * cos - d * sin;
        d = c * sin + d * cos;
        c = c1;
        //var tx1 = this.tx * cos - this.ty * sin;
        //this.ty = this.tx * sin + this.ty * cos;
        //this.tx = tx1;
    }

    public function scale(x:Float, y:Float):Void 
    {
        a *= x;
        b *= y;
        c *= x;
        d *= y;
        //tx *= x;
        //ty *= y;
    }

    public function setSkew(x:Float, y:Float):Void 
    {
        a = Math.cos(y);
        b = Math.sin(y);
        c = -Math.sin(x);
        d = Math.cos(x);
    }

    public function skew(x:Float, y:Float):Void 
    {
        var cosY = Math.cos(y);
        var sinY = Math.sin(y);
        var a1 = a * cosY - sinY * b;
        b = b * cosY + a * sinY;
        a = a1;
        var cosX = Math.cos(x);
        var sinX = Math.sin(x);
        var c1 = c * cosX - d * sinX;
        d = d * cosX + c * sinX;
        c = c1;
    }

    public function translate(?x=0.0, ?y=0.0, point=null):Void 
    {
        if (null == point) {
            tx += x;
            ty += y;
        }else {
            tx += point.x;
            ty += point.y;
        }
    }

    public function deltaTransformPoint(point:{x:Float, y:Float}):{x:Float, y:Float}
    {
        return new Point(point.x * a + point.y * c, point.x * b + point.y * d);
    }

    public function transformPoint(point:{x:Float, y:Float}):{x:Float, y:Float}
    {
        return new Point(point.x * a + point.y * c + tx, point.x * b + point.y * d + ty);
    }

    public function sub(matrix:Matrix):Matrix
    {
        return new Matrix(a - matrix.a, b - matrix.b, c - matrix.c, d - matrix.d, tx - matrix.tx, ty - matrix.ty);
    }

    public function add(matrix:Matrix):Matrix
    {
        return new Matrix(a + matrix.a, b + matrix.b, c + matrix.c, d + matrix.d, tx + matrix.tx, ty + matrix.ty);
    }

    public function multi(num:Float):Matrix
    {
        return new Matrix(a * num, b * num, c * num, d * num, tx * num, ty * num);
    }

    public function div(num:Float):Matrix
    {
        return new Matrix(a / num, b / num, c / num, d / num, tx / num, ty / num);
    }

    public function toFlashMatrix():flash.geom.Matrix
    {
        return new flash.geom.Matrix(a, b, c, d, tx, ty);
    }

    public function clone():hx.geom.Matrix
    {
        var matrix = new Matrix();
        matrix.a = this.a;
        matrix.b = this.b;
        matrix.c = this.c;
        matrix.d = this.d;
        matrix.tx = this.tx;
        matrix.ty = this.ty;
        return matrix;
    }
}
{'fraction_non_alphanumeric': 0.15223533322253616, 'fraction_numerical': 0.00864218048861559, 'mean_word_length': 1.5137844611528821, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2320036', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2207, 'n_words': 597}