UNPKG

gs-json

Version:

gs-JSON is a domain agnostic unifying 3D file format for geometric and semantic modelling (hence the 'gs').

69 lines (54 loc) 2.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ray = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _entity_obj = require("./entity_obj"); var _entity_point = require("./entity_point"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * Class Ray. * A ray is displayed as one wire and no faces. * The wire has two vertices. * A ray may be part of a group and may have attributes. */ var Ray = exports.Ray = function (_Obj) { _inherits(Ray, _Obj); function Ray() { _classCallCheck(this, Ray); return _possibleConstructorReturn(this, (Ray.__proto__ || Object.getPrototypeOf(Ray)).apply(this, arguments)); } _createClass(Ray, [{ key: "getObjType", /** * Get the object type: "ray". * @return Ray object type. */ value: function getObjType() { return 1 /* ray */; } /** * Get the origin of the ray. * @return Plane object type. */ }, { key: "getOrigin", value: function getOrigin() { return new _entity_point.Point(this._kernel, this._kernel.objGetOnePoint(this._id)); } /** * Gets the direction vector for this ray. * @return Return the xyz. */ }, { key: "getVector", value: function getVector() { return this._kernel.objGetParams(this._id)[1]; } }]); return Ray; }(_entity_obj.Obj); //# sourceMappingURL=entity_obj_ray.js.map