All files / src/extensions extensionsVector3.js

100% Statements 20/20
100% Branches 6/6
100% Functions 4/4
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  1x 1x 1x 1x 1x 1x   1x 3x       1x 2x 2x 2x 1x 2x 1x 2x 1x 2x   1x 1x    
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vector3_1 = require("../models/vector3");
vector3_1.Vector3.prototype.set = function (vector) {
    this.x = vector.x;
    this.y = vector.y;
    this.z = vector.z;
};
vector3_1.Vector3.prototype.getLength = function () {
    return Math.sqrt((this.x * this.x) +
        (this.y * this.y) +
        (this.z * this.z));
};
vector3_1.Vector3.prototype.getNormalize = function () {
    const length = this.getLength();
    const nomalized = new vector3_1.Vector3();
    if (this.x != 0)
        nomalized.x = this.x / length;
    if (this.y != 0)
        nomalized.y = this.y / length;
    if (this.z != 0)
        nomalized.z = this.z / length;
    return nomalized;
};
vector3_1.Vector3.prototype.getScalar = function (vector) {
    return this.x * vector.x + this.y * vector.y + this.z * vector.z;
};