UNPKG

vector2d

Version:

2D Vector library offering Float32Array, Array or standard Object based vectors.

52 lines 1.67 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var AbstractVector_1 = require("./AbstractVector"); /** * A vector representation that stores the axes in an Array * * ``` * const v = new Vec2D.ArrayVector(2, 5) * ``` */ var ArrayVector = /** @class */ (function (_super) { __extends(ArrayVector, _super); function ArrayVector(x, y) { var _this = _super.call(this, ArrayVector) || this; _this.axes = [x, y]; _this.ctor = ArrayVector; return _this; } Object.defineProperty(ArrayVector.prototype, "x", { get: function () { return this.axes[0]; }, set: function (x) { this.axes[0] = x; }, enumerable: true, configurable: true }); Object.defineProperty(ArrayVector.prototype, "y", { get: function () { return this.axes[1]; }, set: function (y) { this.axes[1] = y; }, enumerable: true, configurable: true }); return ArrayVector; }(AbstractVector_1.AbstractVector)); exports.ArrayVector = ArrayVector; //# sourceMappingURL=ArrayVector.js.map