UNPKG

@pilotlab/lux-types

Version:

A luxurious user experience framework, developed by your friends at Pilot.

60 lines 3.02 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 lux_is_1 = require("@pilotlab/lux-is"); var lux_attributes_1 = require("@pilotlab/lux-attributes"); var PointBase = (function (_super) { __extends(PointBase, _super); function PointBase(type, x, y, z) { var _this = _super.call(this, type, null, lux_attributes_1.DataType.COLLECTION, null, false) || this; _this.p_x = _this.children.set('x', lux_is_1.default.notEmpty(x) ? x : 0, lux_attributes_1.DataType.NUMBER_DOUBLE, lux_attributes_1.AttributeChangeOptions.zero).node; _this.p_y = _this.children.set('y', lux_is_1.default.notEmpty(y) ? y : 0, lux_attributes_1.DataType.NUMBER_DOUBLE, lux_attributes_1.AttributeChangeOptions.zero).node; _this.p_z = _this.children.set('z', lux_is_1.default.notEmpty(z) ? z : 0, lux_attributes_1.DataType.NUMBER_DOUBLE, lux_attributes_1.AttributeChangeOptions.zero).node; return _this; } Object.defineProperty(PointBase.prototype, "x", { get: function () { return this.p_x.value; }, set: function (value) { this.p_x.set(value, lux_attributes_1.AttributeChangeOptions.saveAndSignal.durationZero); }, enumerable: true, configurable: true }); Object.defineProperty(PointBase.prototype, "y", { get: function () { return this.p_y.value; }, set: function (value) { this.p_y.set(value, lux_attributes_1.AttributeChangeOptions.saveAndSignal.durationZero); }, enumerable: true, configurable: true }); Object.defineProperty(PointBase.prototype, "z", { get: function () { return this.p_z.value; }, set: function (value) { this.p_z.set(value, lux_attributes_1.AttributeChangeOptions.saveAndSignal.durationZero); }, enumerable: true, configurable: true }); Object.defineProperty(PointBase.prototype, "isEmpty", { get: function () { return lux_is_1.default.empty(this.x) || lux_is_1.default.empty(this.y) || lux_is_1.default.empty(this.z); }, enumerable: true, configurable: true }); PointBase.prototype.distance = function (point) { var e = 0.0; var d = 0.0; for (var i = 0; i < 3; i++) { d = (this.children.list.item(i).value - point.children.list.item(i).value); e += d * d; } return Math.sqrt(e); }; return PointBase; }(lux_attributes_1.Attribute)); exports.PointBase = PointBase; exports.default = PointBase; //# sourceMappingURL=pointBase.js.map