UNPKG

vector2d

Version:

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

53 lines 1.73 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 a Float32Array * * ``` * const v = new Vec2D.Float32Vector(2, 5) * ``` */ var Float32Vector = /** @class */ (function (_super) { __extends(Float32Vector, _super); function Float32Vector(x, y) { var _this = _super.call(this, Float32Vector) || this; _this.axes = new Float32Array(2); _this.axes[0] = x; _this.axes[1] = y; return _this; } Object.defineProperty(Float32Vector.prototype, "x", { get: function () { return this.axes[0]; }, set: function (x) { this.axes[0] = x; }, enumerable: true, configurable: true }); Object.defineProperty(Float32Vector.prototype, "y", { get: function () { return this.axes[1]; }, set: function (y) { this.axes[1] = y; }, enumerable: true, configurable: true }); return Float32Vector; }(AbstractVector_1.AbstractVector)); exports.Float32Vector = Float32Vector; //# sourceMappingURL=Float32Vector.js.map