UNPKG

x_ite

Version:

X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.

1,403 lines (1,227 loc) 152 kB
/* X_ITE v11.5.0 */ const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.5.0")]; /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ // UNUSED EXPORTS: default ;// external "__X_ITE_X3D__ .Components" const external_X_ITE_X3D_Components_namespaceObject = __X_ITE_X3D__ .Components; var external_X_ITE_X3D_Components_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Components_namespaceObject); ;// external "__X_ITE_X3D__ .Fields" const external_X_ITE_X3D_Fields_namespaceObject = __X_ITE_X3D__ .Fields; var external_X_ITE_X3D_Fields_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Fields_namespaceObject); ;// external "__X_ITE_X3D__ .X3DFieldDefinition" const external_X_ITE_X3D_X3DFieldDefinition_namespaceObject = __X_ITE_X3D__ .X3DFieldDefinition; var external_X_ITE_X3D_X3DFieldDefinition_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DFieldDefinition_namespaceObject); ;// external "__X_ITE_X3D__ .FieldDefinitionArray" const external_X_ITE_X3D_FieldDefinitionArray_namespaceObject = __X_ITE_X3D__ .FieldDefinitionArray; var external_X_ITE_X3D_FieldDefinitionArray_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_FieldDefinitionArray_namespaceObject); ;// external "__X_ITE_X3D__ .X3DNode" const external_X_ITE_X3D_X3DNode_namespaceObject = __X_ITE_X3D__ .X3DNode; var external_X_ITE_X3D_X3DNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DNode_namespaceObject); ;// external "__X_ITE_X3D__ .X3DCoordinateNode" const external_X_ITE_X3D_X3DCoordinateNode_namespaceObject = __X_ITE_X3D__ .X3DCoordinateNode; var external_X_ITE_X3D_X3DCoordinateNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCoordinateNode_namespaceObject); ;// external "__X_ITE_X3D__ .X3DConstants" const external_X_ITE_X3D_X3DConstants_namespaceObject = __X_ITE_X3D__ .X3DConstants; var external_X_ITE_X3D_X3DConstants_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DConstants_namespaceObject); ;// external "__X_ITE_X3D__ .Namespace" const external_X_ITE_X3D_Namespace_namespaceObject = __X_ITE_X3D__ .Namespace; var external_X_ITE_X3D_Namespace_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Namespace_namespaceObject); ;// ./src/standard/Math/Geometry/Spheroid3.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ function Spheroid3 (semiMajorAxis, semiMinorAxis) { switch (arguments .length) { case 0: this .semiMajorAxis = 0; // a this .semiMinorAxis = 0; // c break; case 2: this .semiMajorAxis = semiMajorAxis; // a this .semiMinorAxis = semiMinorAxis; // c break; case 3: const f_1 = arguments [1]; this .semiMajorAxis = semiMajorAxis; // a this .semiMinorAxis = semiMajorAxis * (1 - 1 / f_1); // c break; } } Object .assign (Spheroid3 .prototype, { getSemiMajorAxis () { // Returns the semi-major axis (a) return this .semiMajorAxis; // a }, getSemiMinorAxis () { // Returns the semi-minor axis (c) return this .semiMinorAxis; // c }, toString () { return `${this .semiMajorAxis} ${this .semiMinorAxis}`; }, }); const __default__ = Spheroid3; ; /* harmony default export */ const Geometry_Spheroid3 = (external_X_ITE_X3D_Namespace_default().add ("Spheroid3", __default__)); ;// ./src/standard/Geospatial/ReferenceEllipsoids.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const ReferenceEllipsoids = new Map ([ // Earth // X3D Specification ["AA", new Geometry_Spheroid3 (6377563.396, 299.3249646, true)], // Airy 1830 ["AM", new Geometry_Spheroid3 (6377340.189, 299.3249646, true)], // Modified Airy ["AN", new Geometry_Spheroid3 (6378160, 298.25, true)], // Australian National ["BN", new Geometry_Spheroid3 (6377483.865, 299.1528128, true)], // Bessel 1841 (Namibia) ["BR", new Geometry_Spheroid3 (6377397.155, 299.1528128, true)], // Bessel 1841 (Ethiopia Indonesia...) ["CC", new Geometry_Spheroid3 (6378206.4, 294.9786982, true)], // Clarke 1866 ["CD", new Geometry_Spheroid3 (6378249.145, 293.465, true)], // Clarke 1880 ["EA", new Geometry_Spheroid3 (6377276.345, 300.8017, true)], // Everest (India 1830) ["EB", new Geometry_Spheroid3 (6377298.556, 300.8017, true)], // Everest (Sabah & Sarawak) ["EC", new Geometry_Spheroid3 (6377301.243, 300.8017, true)], // Everest (India 1956) ["ED", new Geometry_Spheroid3 (6377295.664, 300.8017, true)], // Everest (W. Malaysia 1969) ["EE", new Geometry_Spheroid3 (6377304.063, 300.8017, true)], // Everest (W. Malaysia & Singapore 1948) ["EF", new Geometry_Spheroid3 (6377309.613, 300.8017, true)], // Everest (Pakistan) ["FA", new Geometry_Spheroid3 (6378155, 298.3, true)], // Modified Fischer 1960 ["HE", new Geometry_Spheroid3 (6378200, 298.3, true)], // Helmert 1906 ["HO", new Geometry_Spheroid3 (6378270, 297, true)], // Hough 1960 ["ID", new Geometry_Spheroid3 (6378160, 298.247, true)], // Indonesian 1974 ["IN", new Geometry_Spheroid3 (6378388, 297, true)], // International 1924 ["KA", new Geometry_Spheroid3 (6378245, 298.3, true)], // Krassovsky 1940 ["RF", new Geometry_Spheroid3 (6378137, 298.257222101, true)], // Geodetic Reference System 1980 (GRS 80) ["SA", new Geometry_Spheroid3 (6378160, 298.25, true)], // South American 1969 ["WD", new Geometry_Spheroid3 (6378135, 298.26, true)], // WGS 72 ["WE", new Geometry_Spheroid3 (6378137, 298.257223563, true)], // WGS 84 // Solar System // https:,//en.wikipedia.de // Can someone give me more accurate parameters. ["SUN", new Geometry_Spheroid3 (696342000, 1 / 9e-6, true)], ["MERCURY", new Geometry_Spheroid3 (2439700, 2439700)], ["VENUS", new Geometry_Spheroid3 (6051800, 6051800)], ["MOON", new Geometry_Spheroid3 (1738140, 1735970)], ["MARS", new Geometry_Spheroid3 (3395428, 3377678)], // https",//adsabs.harvard.edu/abs/2010EM%26P..106....1A ["JUPITER", new Geometry_Spheroid3 (71492000, 66854000)], ["SATURN", new Geometry_Spheroid3 (60268000, 54364000)], ["URANUS", new Geometry_Spheroid3 (2555000, 24973000)], ["NEPTUNE", new Geometry_Spheroid3 (24764000, 24341000)], ["PLUTO", new Geometry_Spheroid3 (1153000, 1153000)], ]); const ReferenceEllipsoids_default_ = ReferenceEllipsoids; ; /* harmony default export */ const Geospatial_ReferenceEllipsoids = (external_X_ITE_X3D_Namespace_default().add ("ReferenceEllipsoids", ReferenceEllipsoids_default_)); ;// ./src/standard/Geospatial/Geodetic.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const EPS_H = 1e-3, EPS_P = 1e-10, IMAX = 30; function Geodetic (spheroid, latitudeFirst, radians) { this .longitudeFirst = ! latitudeFirst; this .degrees = ! radians; this .a = spheroid .getSemiMajorAxis (); this .c = spheroid .getSemiMinorAxis (); this .c2a2 = (spheroid .getSemiMinorAxis () / this .a) ** 2; this .ecc2 = 1 - this .c2a2; } Object .assign (Geodetic .prototype, { convert (geodetic, result) { const elevation = geodetic .z; if (this .longitudeFirst) { var latitude = geodetic .y, longitude = geodetic .x; } else { var latitude = geodetic .x, longitude = geodetic .y; } if (this .degrees) { latitude *= Math .PI / 180; longitude *= Math .PI / 180; } return this .convertRadians (latitude, longitude, elevation, result); }, convertRadians (latitude, longitude, elevation, result) { const slat = Math .sin (latitude), slat2 = slat ** 2, clat = Math .cos (latitude), N = this .a / Math .sqrt (1 - this .ecc2 * slat2), Nhl = (N + elevation) * clat; return result .set (Nhl * Math .cos (longitude), Nhl * Math .sin (longitude), (N * this .c2a2 + elevation) * slat); }, apply (geocentric, result) { this .applyRadians (geocentric, result); if (this .degrees) { result .x *= 180 / Math .PI; // latitude result .y *= 180 / Math .PI; // longitude } if (this .longitudeFirst) { const tmp = result .x; result .x = result .y; // latitude result .y = tmp; // longitude } return result; }, applyRadians (geocentric, result) { const x = geocentric .x, y = geocentric .y, z = geocentric .z; const P = Math .sqrt (x * x + y * y); // Handle pole case. if (P == 0) return result .set (Math .PI, 0, z - this .c); let latitude = 0, longitude = Math .atan2 (y, x), elevation = 0; let a = this .a, N = a, ecc2 = this .ecc2; for (let i = 0; i < IMAX; ++ i) { const h0 = elevation, b0 = latitude; latitude = Math .atan (z / P / (1 - ecc2 * N / (N + elevation))); const sin_p = Math .sin (latitude); N = a / Math .sqrt (1 - ecc2 * sin_p * sin_p); elevation = P / Math .cos (latitude) - N; if (Math .abs (elevation - h0) < EPS_H && Math .abs (latitude - b0) < EPS_P) break; } return result .set (latitude, longitude, elevation); }, normal (geocentric, result) { const geodetic = this .applyRadians (geocentric, result); const latitude = geodetic .x, longitude = geodetic .y; const clat = Math .cos (latitude); const nx = Math .cos (longitude) * clat, ny = Math .sin (longitude) * clat, nz = Math .sin (latitude); return result .set (nx, ny, nz); }, }); const Geodetic_default_ = Geodetic; ; /* harmony default export */ const Geospatial_Geodetic = (external_X_ITE_X3D_Namespace_default().add ("Geodetic", Geodetic_default_)); ;// external "__X_ITE_X3D__ .Algorithm" const external_X_ITE_X3D_Algorithm_namespaceObject = __X_ITE_X3D__ .Algorithm; var external_X_ITE_X3D_Algorithm_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Algorithm_namespaceObject); ;// ./src/standard/Geospatial/UniversalTransverseMercator.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const N0 = 1.0e7, E0 = 5.0e5, k0 = 0.9996; function UniversalTransverseMercator (spheroid, zone, northernHemisphere, northingFirst) { const a = spheroid .getSemiMajorAxis (), ecc2 = 1 - (spheroid .getSemiMinorAxis () / a) ** 2, EE = ecc2 / (1 - ecc2), e1 = (1 - Math .sqrt (1 - ecc2)) / (1 + Math .sqrt (1 - ecc2)); this .southernHemisphere = ! northernHemisphere; this .eastingFirst = ! northingFirst; this .a = a; this .ecc2 = ecc2; this .EE = EE; this .E8 = 8 * EE; this .E9 = 9 * EE; this .E252 = 252 * EE; this .e1 = e1; this .A = k0 * (a * (1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256)); this .B = 3 * e1 / 2 - 7 * e1 * e1 * e1 / 32; this .C = 21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32; this .D = 151 * e1 * e1 * e1 / 96; this .E = a * (1 - ecc2); this .W = 1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256; this .X = 3 * ecc2 / 8 + 3 * ecc2 * ecc2 / 32 + 45 * ecc2 * ecc2 * ecc2 / 1024; this .Y = 15 * ecc2 * ecc2 / 256 + 45 * ecc2 * ecc2 * ecc2 / 1024; this .Z = 35 * ecc2 * ecc2 * ecc2 / 3072; this .longitude0 = external_X_ITE_X3D_Algorithm_default().radians (zone * 6 - 183); this .geodeticConverter = new Geospatial_Geodetic (spheroid, true, true); } Object .assign (UniversalTransverseMercator .prototype, { convert (utm, result) { // https://gist.github.com/duedal/840476 if (this .eastingFirst) { var northing = utm .y, easting = utm .x; } else { var northing = utm .x, easting = utm .y; } // Check for southern hemisphere and remove offset from easting. let S = this .southernHemisphere; if (northing < 0) { S = ! this .southernHemisphere; northing = -northing; } if (S) northing -= N0; easting -= E0; // Begin calculation. const mu = northing / this .A, phi1 = mu + this .B * Math .sin (2 * mu) + this .C * Math .sin (4 * mu) + this .D * Math .sin (6 * mu); const sinphi1 = Math .sin (phi1) ** 2, cosphi1 = Math .cos (phi1), tanphi1 = Math .tan (phi1); const N1 = this .a / Math .sqrt (1 - this .ecc2 * sinphi1), T2 = tanphi1 ** 2, T8 = tanphi1 ** 8, C1 = this .EE * T2, C2 = C1 * C1, R1 = this .E / (1 - this .ecc2 * sinphi1) ** 1.5, I = easting / (N1 * k0); const J = (5 + 3 * T2 + 10 * C1 - 4 * C2 - this .E9) * I ** 4 / 24, K = (61 + 90 * T2 + 298 * C1 + 45 * T8 - this .E252 - 3 * C2) * I ** 6 / 720, L = (5 - 2 * C1 + 28 * T2 - 3 * C2 + this .E8 + 24 * T8) * I ** 5 / 120; const latitude = phi1 - (N1 * tanphi1 / R1) * (I * I / 2 - J + K), longitude = this .longitude0 + (I - (1 + 2 * T2 + C1) * I ** 3 / 6 + L) / cosphi1; return this .geodeticConverter .convertRadians (latitude, longitude, utm .z, result); }, apply (geocentric, result) { // https://gist.github.com/duedal/840476 const geodetic = this .geodeticConverter .applyRadians (geocentric, result), latitude = geodetic .x, longitude = geodetic .y; const tanlat = Math .tan (latitude), coslat = Math .cos (latitude); const EE = this .EE, N = this .a / Math .sqrt (1 - this .ecc2 * Math .sin (latitude) ** 2), T = tanlat * tanlat, T6 = T * T * T, C = EE * coslat * coslat, A = coslat * (longitude - this .longitude0); const M = this .a * (this .W * latitude - this .X * Math .sin (2 * latitude) + this .Y * Math .sin (4 * latitude) - this .Z * Math .sin (6 * latitude)); const easting = k0 * N * (A + (1 - T + C) * A ** 3 / 6 + (5 - 18 * T6 + 72 * C - 58 * EE) * A ** 5 / 120) + E0; let northing = k0 * (M + N * tanlat * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A ** 4 / 24 + (61 - 58 * T6 + 600 * C - 330 * EE) * A ** 6 / 720)); if (latitude < 0) { northing += N0; if (! this .southernHemisphere) northing = -northing; } else { if (this .southernHemisphere) northing = -northing; } if (this .eastingFirst) return result .set (easting, northing, geodetic .z); return result .set (northing, easting, geodetic .z); }, }); const UniversalTransverseMercator_default_ = UniversalTransverseMercator; ; /* harmony default export */ const Geospatial_UniversalTransverseMercator = (external_X_ITE_X3D_Namespace_default().add ("UniversalTransverseMercator", UniversalTransverseMercator_default_)); ;// ./src/x_ite/Browser/Geospatial/Geocentric.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ function Geocentric () { } Object .assign (Geocentric .prototype, { convert (geocentric, result) { return result .assign (geocentric); }, apply (geocentric, result) { return result .assign (geocentric); }, slerp (source, destination, t) { const sourceLength = source .magnitude (), destinationLength = destination .magnitude (); source .normalize (); destination .normalize (); return external_X_ITE_X3D_Algorithm_default().simpleSlerp (source, destination, t) .multiply (external_X_ITE_X3D_Algorithm_default().lerp (sourceLength, destinationLength, t)); }, }); const Geocentric_default_ = Geocentric; ; /* harmony default export */ const Geospatial_Geocentric = (external_X_ITE_X3D_Namespace_default().add ("Geocentric", Geocentric_default_)); ;// ./src/x_ite/Browser/Geospatial/GeospatialObject.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ let i = 0; const GD = i ++, UTM = i ++, GC = i ++; const CoordinateSystems = new Map ([ ["GD", GD], ["GDC", GD], ["UTM", UTM], ["GC", GC], ["GCC", GC], ["GS", GC], ]); const Zone = /^Z(\d+)$/; const GeospatialObject = { GD: GD, UTM: UTM, GC: GC, getReferenceFrame (geoSystem, radians) { switch (this .getCoordinateSystem (geoSystem)) { case GD: { return new Geospatial_Geodetic (this .getEllipsoid (geoSystem), this .getLatitudeFirst (geoSystem), radians); } case UTM: { return new Geospatial_UniversalTransverseMercator (this .getEllipsoid (geoSystem), this .getZone (geoSystem), this .getNorthernHemisphere (geoSystem), this .getNorthingFirst (geoSystem)); } case GC: { return new Geospatial_Geocentric (); } } return new Geospatial_Geodetic (Geospatial_ReferenceEllipsoids .get ("WE"), true, radians); }, getElevationFrame (geoSystem, radians) { return new Geospatial_Geodetic (this .getEllipsoid (geoSystem), true, radians); }, getCoordinateSystem (geoSystem) { for (const gs of geoSystem) { const coordinateSystem = CoordinateSystems .get (gs); if (coordinateSystem !== undefined) return coordinateSystem; } return GD; }, getEllipsoid (geoSystem) { for (const gs of geoSystem) { const ellipsoid = Geospatial_ReferenceEllipsoids .get (gs); if (ellipsoid !== undefined) return ellipsoid; } return Geospatial_ReferenceEllipsoids .get ("WE"); }, // getEllipsoidString (geoSystem) // { // for (const gs of geoSystem) // { // const ellipsoid = ReferenceEllipsoids .get (gs); // if (ellipsoid !== undefined) // return gs; // } // return "WE"; // }, isStandardOrder (geoSystem) { switch (this .getCoordinateSystem (geoSystem)) { case GD: { return this .getLatitudeFirst (geoSystem); } case UTM: { return this .getNorthingFirst (geoSystem); } case GC: { return true; } } return this .getLatitudeFirst (geoSystem); }, getLatitudeFirst (geoSystem) { for (const gs of geoSystem) { if (gs === "longitude_first") return false; } return true; }, getNorthingFirst (geoSystem) { for (const gs of geoSystem) { if (gs === "easting_first") return false; } return true; }, getZone (geoSystem) { for (const gs of geoSystem) { const match = gs .match (Zone); if (match) return parseInt (match [1]); } return 1; }, getNorthernHemisphere (geoSystem) { for (const gs of geoSystem) { if (gs === "S") return false; } return true; }, }; const GeospatialObject_default_ = GeospatialObject; ; /* harmony default export */ const Geospatial_GeospatialObject = (external_X_ITE_X3D_Namespace_default().add ("GeospatialObject", GeospatialObject_default_)); ;// external "__X_ITE_X3D__ .X3DCast" const external_X_ITE_X3D_X3DCast_namespaceObject = __X_ITE_X3D__ .X3DCast; var external_X_ITE_X3D_X3DCast_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCast_namespaceObject); ;// external "__X_ITE_X3D__ .Vector3" const external_X_ITE_X3D_Vector3_namespaceObject = __X_ITE_X3D__ .Vector3; var external_X_ITE_X3D_Vector3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Vector3_namespaceObject); ;// external "__X_ITE_X3D__ .Matrix4" const external_X_ITE_X3D_Matrix4_namespaceObject = __X_ITE_X3D__ .Matrix4; var external_X_ITE_X3D_Matrix4_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Matrix4_namespaceObject); ;// ./src/x_ite/Components/Geospatial/X3DGeospatialObject.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const vector = new (external_X_ITE_X3D_Vector3_default()) (), result = new (external_X_ITE_X3D_Vector3_default()) (), t = new (external_X_ITE_X3D_Vector3_default()) (), x = new (external_X_ITE_X3D_Vector3_default()) (), y = new (external_X_ITE_X3D_Vector3_default()) (), z = new (external_X_ITE_X3D_Vector3_default()) (); function X3DGeospatialObject (executionContext) { this .addType ((external_X_ITE_X3D_X3DConstants_default()).X3DGeospatialObject); this .radians = false; this .origin = new (external_X_ITE_X3D_Vector3_default()) (); this .originMatrix = new (external_X_ITE_X3D_Matrix4_default()) (); this .invOriginMatrix = new (external_X_ITE_X3D_Matrix4_default()) (); } Object .assign (X3DGeospatialObject .prototype, { initialize () { this ._geoSystem .addInterest ("set_geoSystem__", this); this ._geoOrigin .addInterest ("set_geoOrigin__", this); this .set_geoSystem__ (); this .set_geoOrigin__ (); }, set_geoSystem__ () { this .coordinateSystem = Geospatial_GeospatialObject .getCoordinateSystem (this ._geoSystem); this .referenceFrame = Geospatial_GeospatialObject .getReferenceFrame (this ._geoSystem, this .radians); this .elevationFrame = Geospatial_GeospatialObject .getElevationFrame (this ._geoSystem, this .radians); this .standardOrder = Geospatial_GeospatialObject .isStandardOrder (this ._geoSystem); }, set_geoOrigin__ () { if (this .geoOriginNode) { this .geoOriginNode .removeInterest ("set_origin__", this); this .geoOriginNode .removeInterest ("set_rotateYUp__", this); this .geoOriginNode .removeInterest ("addNodeEvent", this); } this .geoOriginNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).GeoOrigin, this ._geoOrigin); if (this .geoOriginNode) { this .geoOriginNode .addInterest ("set_origin__", this); this .geoOriginNode .addInterest ("set_rotateYUp__", this); this .geoOriginNode .addInterest ("addNodeEvent", this); } this .set_origin__ (); this .set_rotateYUp__ (); }, set_origin__ () { if (this .geoOriginNode) this .geoOriginNode .getOrigin (this .origin); else this .origin .set (0, 0, 0); this .set_originMatrix__ (); }, set_originMatrix__ () { if (this .geoOriginNode) { // Position const t = this .origin; // Let's work out the orientation at that location in order // to maintain a view where +Y is in the direction of gravitational // up for that region of the planet's surface. This will be the // value of the rotation matrix for the transform. this .elevationFrame .normal (t, y); x .set (0, 0, 1) .cross (y); // Handle pole cases. if (x .equals ((external_X_ITE_X3D_Vector3_default()).Zero)) x .set (1, 0, 0); z .assign (x) .cross (y); x .normalize (); z .normalize (); this .originMatrix .set (x .x, x .y, x .z, 0, y .x, y .y, y .z, 0, z .x, z .y, z .z, 0, t .x, t .y, t .z, 1); this .invOriginMatrix .assign (this .originMatrix) .inverse (); } }, set_rotateYUp__ () { if (this .geoOriginNode && this .geoOriginNode ._rotateYUp .getValue ()) { this .getCoord = getCoordRotateYUp; this .getGeoCoord = getGeoCoordRotateYUp; this .getGeoUpVector = getGeoUpVectorRotateYUp; this .getLocationMatrix = getLocationMatrixRotateYUp; } else { delete this .getCoord; delete this .getGeoCoord; delete this .getGeoUpVector; delete this .getLocationMatrix; } }, getReferenceFrame () { return this .referenceFrame; }, getStandardOrder () { return this .standardOrder; }, getCoord (geoPoint, result) { return this .referenceFrame .convert (geoPoint, result) .subtract (this .origin); }, getGeoCoord (point, result) { return this .referenceFrame .apply (vector .assign (point) .add (this .origin), result); }, getGeoElevation (point) { return this .getGeoCoord (point, result) .z; }, getGeoUpVector (point, result) { return this .elevationFrame .normal (vector .assign (point) .add (this .origin), result); }, getLocationMatrix (geoPoint, result) { const origin = this .origin, locationMatrix = getStandardLocationMatrix .call (this, geoPoint, result); // translateRight (-origin) locationMatrix [12] -= origin .x; locationMatrix [13] -= origin .y; locationMatrix [14] -= origin .z; return locationMatrix; }, dispose () { }, }); function getCoordRotateYUp (geoPoint, result) { return this .invOriginMatrix .multVecMatrix (this .referenceFrame .convert (geoPoint, result)); } function getGeoCoordRotateYUp (point, result) { return this .referenceFrame .apply (this .originMatrix .multVecMatrix (vector .assign (point)), result); } function getGeoUpVectorRotateYUp (point, result) { return this .invOriginMatrix .multDirMatrix (this .elevationFrame .normal (this .originMatrix .multVecMatrix (vector .assign (point)), result)); } function getLocationMatrixRotateYUp (geoPoint, result) { return getStandardLocationMatrix .call (this, geoPoint, result) .multRight (this .invOriginMatrix); } function getStandardLocationMatrix (geoPoint, result) { // Position this .referenceFrame .convert (geoPoint, t); // Let's work out the orientation at that location in order // to maintain a view where +Y is in the direction of gravitional // up for that region of the planet's surface. This will be the // value of the rotation matrix for the transform. this .elevationFrame .normal (t, y); x .set (0, 0, 1) .cross (y); // Handle pole cases. if (x .equals ((external_X_ITE_X3D_Vector3_default()).Zero)) x .set (1, 0, 0); z .assign (x) .cross (y); x .normalize (); z .normalize (); return result .set (x .x, x .y, x .z, 0, y .x, y .y, y .z, 0, z .x, z .y, z .z, 0, t .x, t .y, t .z, 1); } Object .defineProperties (X3DGeospatialObject, external_X_ITE_X3D_X3DNode_default().getStaticProperties ("X3DGeospatialObject", "Geospatial", 1)); const X3DGeospatialObject_default_ = X3DGeospatialObject; ; /* harmony default export */ const Geospatial_X3DGeospatialObject = (external_X_ITE_X3D_Namespace_default().add ("X3DGeospatialObject", X3DGeospatialObject_default_)); ;// external "__X_ITE_X3D__ .Triangle3" const external_X_ITE_X3D_Triangle3_namespaceObject = __X_ITE_X3D__ .Triangle3; var external_X_ITE_X3D_Triangle3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Triangle3_namespaceObject); ;// ./src/x_ite/Components/Geospatial/GeoCoordinate.js /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ function GeoCoordinate (executionContext) { external_X_ITE_X3D_X3DCoordinateNode_default().call (this, executionContext); Geospatial_X3DGeospatialObject .call (this, executionContext); this .addType ((external_X_ITE_X3D_X3DConstants_default()).GeoCoordinate); } Object .assign (Object .setPrototypeOf (GeoCoordinate .prototype, (external_X_ITE_X3D_X3DCoordinateNode_default()).prototype), Geospatial_X3DGeospatialObject .prototype, { initialize () { external_X_ITE_X3D_X3DCoordinateNode_default().prototype .initialize .call (this); Geospatial_X3DGeospatialObject .prototype .initialize .call (this); }, set1Point: (() => { const result = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, point) { this ._point [index] = this .getGeoCoord (point, result); }; })(), get1Point: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, result) { if (index < this .length) { const point = this .point; index *= 3; return this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), result); } else { return result .set (0, 0, 0); } }; })(), addPoint: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (), g = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, array) { if (index < this .length) { const point = this .point; index *= 3; this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), g); array .push (g [0], g [1], g [2], 1); } else { array .push (0, 0, 0, 1); } }; })(), addPoints: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (), g = new (external_X_ITE_X3D_Vector3_default()) (); return function (array) { const point = this .point, length = this .length * 3; for (let index = 0; index < length; index += 3) { this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), g); array .push (g [0], g [1], g [2], 1); } return array; }; })(), getNormal: (() => { const point1 = new (external_X_ITE_X3D_Vector3_default()) (), point2 = new (external_X_ITE_X3D_Vector3_default()) (), point3 = new (external_X_ITE_X3D_Vector3_default()) (); return function (index1, index2, index3) { // The index[1,2,3] cannot be less than 0. const length = this .length; if (index1 < length && index2 < length && index3 < length) { return external_X_ITE_X3D_Triangle3_default().normal (this .get1Point (index1, point1), this .get1Point (index2, point2), this .get1Point (index3, point3), new (external_X_ITE_X3D_Vector3_default()) ()); } return new (external_X_ITE_X3D_Vector3_default()) (); }; })(), getQuadNormal: (() => { const point1 = new (external_X_ITE_X3D_Vector3_default()) (), point2 = new (external_X_ITE_X3D_Vector3_default()) (), point3 = new (external_X_ITE_X3D_Vector3_default()) (), point4 = new (external_X_ITE_X3D_Vector3_default()) (); return function (index1, index2, index3, index4) { // The index[1,2,3,4] cannot be less than 0. const length = this .length; if (index1 < length && index2 < length && in