@pilotlab/lux-attributes
Version:
A luxurious user experience framework, developed by your friends at Pilot.
63 lines • 3.01 kB
JavaScript
;
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, label) {
if (x === void 0) { x = 0; }
if (y === void 0) { y = 0; }
if (z === void 0) { z = 0; }
var _this = _super.call(this, type, null, lux_attributes_1.DataType.COLLECTION, label) || this;
_this.p_x = _this.children.get('x', x, lux_attributes_1.DataType.NUMBER_DOUBLE, label, lux_attributes_1.AttributeChangeOptions.zero);
_this.p_y = _this.children.get('y', y, lux_attributes_1.DataType.NUMBER_DOUBLE, label, lux_attributes_1.AttributeChangeOptions.zero);
_this.p_z = _this.children.get('z', z, lux_attributes_1.DataType.NUMBER_DOUBLE, label, lux_attributes_1.AttributeChangeOptions.zero);
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.save.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.save.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.save.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