"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils");
class Vec {
    constructor(x, y) {
        this.x = x || 0;
        this.y = y || 0;
    }
    ;
    trim(min_value, max_value) {
        return new Vec(utils_1.trim(this.x, min_value, max_value), utils_1.trim(this.y, min_value, max_value));
    }
    ;
    div(a) {
        if (typeof a === 'number') {
            return new Vec(this.x / a, this.y / a);
        }
        else {
            return new Vec(this.x / a.x, this.y / a.y);
        }
    }
    ;
    invert() {
        this.x = -1 * this.x;
        this.y = -1 * this.y;
    }
    ;
    add(right) {
        return new Vec(this.x + right.x, this.y + right.y);
    }
    ;
    add_to(right) {
        this.x += right.x;
        this.y += right.y;
    }
    ;
    sub_to(right) {
        this.x -= right.x;
        this.y -= right.y;
    }
    ;
    sub(right) {
        return new Vec(this.x - right.x, this.y - right.y);
    }
    ;
    mult(value) {
        if (typeof value === 'number') {
            return new Vec(this.x * value, this.y * value);
        }
        else {
            return new Vec(this.x * value.x, this.y * value.y);
        }
    }
    ;
    dot_mult(right) {
        return this.x * right.x + this.y * right.y;
    }
    ;
    calc_dist(p2) {
        const p1 = this;
        return Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y));
    }
    ;
    calc_dist_vec(p2) {
        const p1 = this;
        const dist = new Vec(p2.x - p1.x, p2.y - p1.y);
        return dist;
    }
    ;
    magnitude() {
        return Math.sqrt((this.x * this.x) + (this.y * this.y));
    }
    copy() {
        return new Vec(this.x, this.y);
    }
}
exports.Vec = Vec;
