@vcmap/ui 5.0.0-rc.8 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -64
- package/app.config.json +3 -0
- package/build/.eslintrc +3 -0
- package/build/build.js +302 -165
- package/build/buildCesium.js +39 -19
- package/build/buildHelpers.js +279 -88
- package/build/buildPreview.js +16 -6
- package/build/bundle.js +57 -0
- package/build/commonViteConfig.js +7 -16
- package/build/determineHost.js +17 -4
- package/build/generateOLLib.js +15 -18
- package/build/getPluginProxies.js +35 -3
- package/build/info/conf.json +21 -19
- package/build/info/publish.js +16 -5
- package/config/aerowest.config.json +47 -54
- package/config/base.config.json +597 -662
- package/config/codes.config.json +401 -0
- package/config/dev.config.json +460 -14
- package/config/graphFeatureInfo.config.json +141 -0
- package/config/projects.config.json +29 -0
- package/config/www.config.json +1801 -0
- package/dist/assets/@mdi/font/LICENSE +20 -0
- package/dist/assets/@mdi/font/css/materialdesignicons.css.map +16 -0
- package/dist/assets/@mdi/font/css/materialdesignicons.min.e3f476.css +3 -0
- package/dist/assets/@mdi/font/fonts/materialdesignicons-webfont.woff2 +0 -0
- package/dist/assets/cesium/ThirdParty/Workers/basis_transcoder.js +21 -0
- package/dist/assets/cesium/ThirdParty/Workers/package.json +1 -0
- package/dist/assets/cesium/ThirdParty/Workers/pako_deflate.min.js +2 -0
- package/dist/assets/cesium/ThirdParty/Workers/pako_inflate.min.js +2 -0
- package/dist/assets/cesium/ThirdParty/Workers/z-worker-pako.js +1 -0
- package/dist/assets/cesium/ThirdParty/basis_transcoder.wasm +0 -0
- package/dist/assets/cesium/ThirdParty/draco_decoder.wasm +0 -0
- package/dist/assets/cesium/ThirdParty/google-earth-dbroot-parser.js +8337 -0
- package/dist/assets/cesium/Workers/chunk-227AJNOA.js +59 -0
- package/dist/assets/cesium/Workers/chunk-2R5O53JW.js +157 -0
- package/dist/assets/cesium/Workers/chunk-34YUDLRP.js +781 -0
- package/dist/assets/cesium/Workers/chunk-3W63OHNJ.js +100 -0
- package/dist/assets/cesium/Workers/chunk-4MFFIWUA.js +163 -0
- package/dist/assets/cesium/Workers/chunk-66QLLS45.js +218 -0
- package/dist/assets/cesium/Workers/chunk-6BTKZDRG.js +77 -0
- package/dist/assets/cesium/Workers/chunk-A4JVFBQ3.js +101 -0
- package/dist/assets/cesium/Workers/chunk-ABADGKYE.js +58 -0
- package/dist/assets/cesium/Workers/chunk-AFFLIKOH.js +353 -0
- package/dist/assets/cesium/Workers/chunk-AHKEZ2OE.js +629 -0
- package/dist/assets/cesium/Workers/chunk-C3SXRKRW.js +476 -0
- package/dist/assets/cesium/Workers/chunk-CCFQRR6D.js +55 -0
- package/dist/assets/cesium/Workers/chunk-CHHNOC2C.js +1860 -0
- package/dist/assets/cesium/Workers/chunk-CTELOFLA.js +196 -0
- package/dist/assets/cesium/Workers/chunk-DUHWWBQQ.js +3273 -0
- package/dist/assets/cesium/Workers/chunk-EW2GWJYB.js +44 -0
- package/dist/assets/cesium/Workers/chunk-GLZBE3ML.js +421 -0
- package/dist/assets/cesium/Workers/chunk-HARLBUOL.js +236 -0
- package/dist/assets/cesium/Workers/chunk-HQF437NJ.js +117 -0
- package/dist/assets/cesium/Workers/chunk-IPA4EACJ.js +368 -0
- package/dist/assets/cesium/Workers/chunk-J3JY6I2C.js +1009 -0
- package/dist/assets/cesium/Workers/chunk-JB2LWGH4.js +390 -0
- package/dist/assets/cesium/Workers/chunk-JS3AW5BK.js +634 -0
- package/dist/assets/cesium/Workers/chunk-K36FEYS7.js +452 -0
- package/dist/assets/cesium/Workers/chunk-KD4Y7CZL.js +400 -0
- package/dist/assets/cesium/Workers/chunk-KTJSNCK4.js +842 -0
- package/dist/assets/cesium/Workers/chunk-LLUNNUJV.js +258 -0
- package/dist/assets/cesium/Workers/chunk-MPAZH4BF.js +37 -0
- package/dist/assets/cesium/Workers/chunk-MYZB7C4T.js +1258 -0
- package/dist/assets/cesium/Workers/chunk-N3JIFFX2.js +501 -0
- package/dist/assets/cesium/Workers/chunk-O5AMBQ36.js +430 -0
- package/dist/assets/cesium/Workers/chunk-OAVNIRB4.js +124 -0
- package/dist/assets/cesium/Workers/chunk-OYFCF4PL.js +171 -0
- package/dist/assets/cesium/Workers/chunk-OZJDGN5F.js +1477 -0
- package/dist/assets/cesium/Workers/chunk-PCJWUS4M.js +2041 -0
- package/dist/assets/cesium/Workers/chunk-PFQBCKBM.js +8644 -0
- package/dist/assets/cesium/Workers/chunk-QIKODV5G.js +305 -0
- package/dist/assets/cesium/Workers/chunk-QJ3DFBH3.js +73 -0
- package/dist/assets/cesium/Workers/chunk-QMEMZIJI.js +138 -0
- package/dist/assets/cesium/Workers/chunk-QT3MPEMI.js +102 -0
- package/dist/assets/cesium/Workers/chunk-RP2A7BR5.js +289 -0
- package/dist/assets/cesium/Workers/chunk-RW6LU2CJ.js +138 -0
- package/dist/assets/cesium/Workers/chunk-TFC6TZ3S.js +757 -0
- package/dist/assets/cesium/Workers/chunk-V3NGATMV.js +693 -0
- package/dist/assets/cesium/Workers/chunk-VLGOATD6.js +1075 -0
- package/dist/assets/cesium/Workers/chunk-WXTV4ATB.js +39 -0
- package/dist/assets/cesium/Workers/chunk-X4SU25DT.js +302 -0
- package/dist/assets/cesium/Workers/chunk-XTY7B2N6.js +2716 -0
- package/dist/assets/cesium/Workers/chunk-XY7MGBKC.js +513 -0
- package/dist/assets/cesium/Workers/chunk-Z24VKNDO.js +834 -0
- package/dist/assets/cesium/Workers/chunk-ZA25DG4Y.js +684 -0
- package/dist/assets/cesium/Workers/chunk-ZFOBYDGF.js +73 -0
- package/dist/assets/cesium/Workers/combineGeometry.js +67 -1
- package/dist/assets/cesium/Workers/createBoxGeometry.js +57 -1
- package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +234 -1
- package/dist/assets/cesium/Workers/createCircleGeometry.js +196 -1
- package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +146 -1
- package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +506 -1
- package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +224 -1
- package/dist/assets/cesium/Workers/createCorridorGeometry.js +1262 -1
- package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +567 -1
- package/dist/assets/cesium/Workers/createCylinderGeometry.js +59 -1
- package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +231 -1
- package/dist/assets/cesium/Workers/createEllipseGeometry.js +70 -1
- package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +63 -1
- package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +58 -1
- package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +60 -1
- package/dist/assets/cesium/Workers/createFrustumGeometry.js +57 -1
- package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +234 -1
- package/dist/assets/cesium/Workers/createGeometry.js +150 -1
- package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +1607 -1
- package/dist/assets/cesium/Workers/createPlaneGeometry.js +223 -1
- package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +123 -1
- package/dist/assets/cesium/Workers/createPolygonGeometry.js +1134 -1
- package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +542 -1
- package/dist/assets/cesium/Workers/createPolylineGeometry.js +495 -1
- package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +379 -1
- package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +277 -1
- package/dist/assets/cesium/Workers/createRectangleGeometry.js +1273 -1
- package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +480 -1
- package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +399 -1
- package/dist/assets/cesium/Workers/createSphereGeometry.js +117 -1
- package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +117 -1
- package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +32 -1
- package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +492 -1
- package/dist/assets/cesium/Workers/createVectorTileGeometries.js +386 -1
- package/dist/assets/cesium/Workers/createVectorTilePoints.js +112 -1
- package/dist/assets/cesium/Workers/createVectorTilePolygons.js +384 -1
- package/dist/assets/cesium/Workers/createVectorTilePolylines.js +262 -1
- package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +568 -1
- package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2277 -3
- package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +745 -1
- package/dist/assets/cesium/Workers/createWallGeometry.js +489 -1
- package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +337 -1
- package/dist/assets/cesium/Workers/decodeDraco.js +369 -1
- package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +2650 -1
- package/dist/assets/cesium/Workers/decodeI3S.js +835 -0
- package/dist/assets/cesium/Workers/transcodeKTX2.js +3425 -1
- package/dist/assets/cesium/Workers/transferTypedArrayTest.js +41 -1
- package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +818 -1
- package/dist/assets/cesium.4137c8.js +164897 -0
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/core.306872.js +19286 -0
- package/dist/assets/core.js +1 -1
- package/dist/assets/favicon-128.4c4ce5.png +0 -0
- package/dist/assets/favicon-180.5b99c0.png +0 -0
- package/dist/assets/favicon-192.0e205e.png +0 -0
- package/dist/assets/favicon-32.6b9add.png +0 -0
- package/dist/assets/favicon.d5ec97.svg +10 -0
- package/dist/assets/font/OFL.txt +93 -0
- package/dist/assets/font/TitilliumWeb-Regular.9ca076.woff2 +0 -0
- package/dist/assets/index-cfed33b1.js +1 -0
- package/dist/assets/ol.328bbf.js +60117 -0
- package/dist/assets/ol.js +1 -1
- package/dist/assets/style/icon-marker-blue.534e37.png +0 -0
- package/dist/assets/style/icon-marker-green.0b6a92.png +0 -0
- package/dist/assets/style/icon-marker-o-blue.7b6d62.png +0 -0
- package/dist/assets/style/icon-marker-o-green.c863c0.png +0 -0
- package/dist/assets/style/icon-marker-o-red.93ff58.png +0 -0
- package/dist/assets/style/icon-marker-o.036477.png +0 -0
- package/dist/assets/style/icon-marker-red.313d03.png +0 -0
- package/dist/assets/style/icon-marker.70960f.png +0 -0
- package/dist/assets/style/icon-pin-blue.7be369.png +0 -0
- package/dist/assets/style/icon-pin-green.cbb935.png +0 -0
- package/dist/assets/style/icon-pin-red.3f25b2.png +0 -0
- package/dist/assets/style/icon-pin.b7ce77.png +0 -0
- package/dist/assets/ui.e84ce9.css +5 -0
- package/dist/assets/ui.e84ce9.js +16488 -0
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.1c8696.js +4911 -0
- package/dist/assets/vue.js +5 -1
- package/dist/assets/vuetify.008fac.css +5 -0
- package/dist/assets/vuetify.008fac.js +21262 -0
- package/dist/assets/vuetify.js +5 -2
- package/dist/index.html +90 -8
- package/index.html +111 -0
- package/index.js +203 -18
- package/lib/cesium.js +1 -1
- package/lib/core.js +1 -1
- package/lib/olLib.js +861 -843
- package/lib/ui.js +1 -1
- package/lib/vue.js +2 -1
- package/lib/vuetify.js +2 -2
- package/package.json +53 -34
- package/plugins/.eslintrc +9 -0
- package/plugins/@vcmap-show-case/README.md +28 -0
- package/plugins/@vcmap-show-case/buttons-example/README.md +4 -0
- package/plugins/@vcmap-show-case/buttons-example/package.json +5 -0
- package/plugins/@vcmap-show-case/buttons-example/src/ButtonsExample.vue +282 -0
- package/plugins/@vcmap-show-case/buttons-example/src/index.js +51 -0
- package/plugins/@vcmap-show-case/category-tester/README.md +3 -0
- package/plugins/@vcmap-show-case/category-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/category-tester/src/CategoriesExample.vue +135 -0
- package/plugins/@vcmap-show-case/category-tester/src/CollectionComponentOptions.vue +209 -0
- package/plugins/@vcmap-show-case/category-tester/src/index.js +73 -0
- package/plugins/@vcmap-show-case/collection-manager-example/README.md +3 -0
- package/plugins/@vcmap-show-case/collection-manager-example/package.json +5 -0
- package/plugins/@vcmap-show-case/collection-manager-example/src/CollectionManagerExample.vue +182 -0
- package/plugins/@vcmap-show-case/collection-manager-example/src/index.js +79 -0
- package/plugins/@vcmap-show-case/config-editor/README.md +3 -0
- package/plugins/@vcmap-show-case/config-editor/package.json +5 -0
- package/plugins/@vcmap-show-case/config-editor/src/ConfigEditor.vue +62 -0
- package/plugins/@vcmap-show-case/config-editor/src/index.js +49 -0
- package/plugins/@vcmap-show-case/context-menu-tester/README.md +3 -0
- package/plugins/@vcmap-show-case/context-menu-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/context-menu-tester/src/index.js +41 -0
- package/plugins/@vcmap-show-case/form-inputs-example/README.md +4 -0
- package/plugins/@vcmap-show-case/form-inputs-example/config.json +5 -0
- package/plugins/@vcmap-show-case/form-inputs-example/package.json +5 -0
- package/plugins/@vcmap-show-case/form-inputs-example/src/FormInputsExample.vue +516 -0
- package/plugins/@vcmap-show-case/form-inputs-example/src/exampleActions.js +36 -0
- package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example/src}/index.js +123 -39
- package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example/src}/validation.js +14 -2
- package/plugins/@vcmap-show-case/hello-world/README.md +31 -0
- package/plugins/@vcmap-show-case/hello-world/package.json +6 -0
- package/plugins/@vcmap-show-case/hello-world/plugin-assets/vcs_logo.png +0 -0
- package/plugins/@vcmap-show-case/hello-world/src/defaultOptions.js +4 -0
- package/plugins/@vcmap-show-case/hello-world/src/helloWorld.vue +69 -0
- package/plugins/@vcmap-show-case/hello-world/src/index.js +142 -0
- package/plugins/@vcmap-show-case/hello-world/tests/helloWorld.spec.js +53 -0
- package/plugins/@vcmap-show-case/icons-example/README.md +5 -0
- package/plugins/@vcmap-show-case/icons-example/package.json +5 -0
- package/plugins/@vcmap-show-case/icons-example/src/AllIconsComponent.vue +51 -0
- package/plugins/@vcmap-show-case/icons-example/src/index.js +46 -0
- package/plugins/@vcmap-show-case/list-example/README.md +3 -0
- package/plugins/@vcmap-show-case/list-example/package.json +5 -0
- package/plugins/@vcmap-show-case/list-example/src/ListExample.vue +411 -0
- package/plugins/@vcmap-show-case/list-example/src/index.js +46 -0
- package/plugins/@vcmap-show-case/notifier-tester/README.md +3 -0
- package/plugins/@vcmap-show-case/notifier-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/notifier-tester/src/NotifierTester.vue +82 -0
- package/plugins/@vcmap-show-case/notifier-tester/src/index.js +42 -0
- package/plugins/@vcmap-show-case/plugin-editors/README.md +4 -0
- package/plugins/@vcmap-show-case/plugin-editors/package.json +5 -0
- package/plugins/@vcmap-show-case/plugin-editors/src/PluginEditors.vue +119 -0
- package/plugins/@vcmap-show-case/plugin-editors/src/index.js +41 -0
- package/plugins/@vcmap-show-case/project-selector/README.md +25 -0
- package/plugins/@vcmap-show-case/project-selector/config.json +15 -0
- package/plugins/@vcmap-show-case/project-selector/package.json +13 -0
- package/plugins/@vcmap-show-case/project-selector/src/ModulesListComponent.vue +65 -0
- package/plugins/@vcmap-show-case/project-selector/src/ProjectSelectorComponent.vue +102 -0
- package/plugins/@vcmap-show-case/project-selector/src/de.json +10 -0
- package/plugins/@vcmap-show-case/project-selector/src/en.json +10 -0
- package/plugins/@vcmap-show-case/project-selector/src/index.js +269 -0
- package/plugins/@vcmap-show-case/simple-graph/README.md +71 -0
- package/plugins/@vcmap-show-case/simple-graph/package.json +11 -0
- package/plugins/@vcmap-show-case/simple-graph/src/SimpleGraphComponent.vue +59 -0
- package/plugins/@vcmap-show-case/simple-graph/src/index.js +17 -0
- package/plugins/@vcmap-show-case/simple-graph/src/simpleGraphView.js +78 -0
- package/plugins/@vcmap-show-case/style-input-example/README.md +4 -0
- package/plugins/@vcmap-show-case/style-input-example/package.json +5 -0
- package/plugins/@vcmap-show-case/style-input-example/src/StyleExample.vue +190 -0
- package/plugins/@vcmap-show-case/style-input-example/src/index.js +42 -0
- package/plugins/@vcmap-show-case/switch-map-callback-example/README.md +21 -0
- package/plugins/@vcmap-show-case/switch-map-callback-example/config.json +3 -0
- package/plugins/@vcmap-show-case/switch-map-callback-example/package.json +5 -0
- package/plugins/@vcmap-show-case/switch-map-callback-example/src/index.js +34 -0
- package/plugins/@vcmap-show-case/switch-map-callback-example/src/switchMapCallback.js +47 -0
- package/plugins/@vcmap-show-case/table-example/README.md +3 -0
- package/plugins/@vcmap-show-case/table-example/package.json +5 -0
- package/plugins/@vcmap-show-case/table-example/src/DataTableExample.vue +182 -0
- package/plugins/@vcmap-show-case/table-example/src/index.js +49 -0
- package/plugins/@vcmap-show-case/textfields-example/README.md +3 -0
- package/plugins/@vcmap-show-case/textfields-example/package.json +5 -0
- package/plugins/{example/mySuperComponent.vue → @vcmap-show-case/textfields-example/src/TextfieldsExample.vue} +13 -31
- package/plugins/@vcmap-show-case/textfields-example/src/index.js +64 -0
- package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/README.md +5 -3
- package/plugins/@vcmap-show-case/theme-changer/config.json +69 -0
- package/plugins/@vcmap-show-case/theme-changer/package.json +11 -0
- package/plugins/{@vcmap/theme-changer → @vcmap-show-case/theme-changer/src}/ThemeChangerComponent.vue +36 -8
- package/plugins/{@vcmap/theme-changer → @vcmap-show-case/theme-changer/src}/index.js +20 -14
- package/plugins/@vcmap-show-case/vector-properties-example/package.json +5 -0
- package/plugins/@vcmap-show-case/vector-properties-example/src/VectorPropertiesExample.vue +128 -0
- package/plugins/@vcmap-show-case/vector-properties-example/src/index.js +40 -0
- package/plugins/@vcmap-show-case/window-tester/README.md +3 -0
- package/plugins/@vcmap-show-case/window-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/window-tester/src/EmptyComponent.vue +18 -0
- package/plugins/@vcmap-show-case/window-tester/src/MyCustomHeader.vue +31 -0
- package/plugins/@vcmap-show-case/window-tester/src/WindowExample.vue +185 -0
- package/plugins/@vcmap-show-case/window-tester/src/WindowExampleContent.vue +18 -0
- package/plugins/@vcmap-show-case/window-tester/src/WindowExampleToggleChild.vue +45 -0
- package/plugins/@vcmap-show-case/window-tester/src/index.js +80 -0
- package/plugins/@vcmap-show-case/window-tester/src/toolboxData.js +288 -0
- package/plugins/@vcmap-show-case/wizard-example/README.md +3 -0
- package/plugins/@vcmap-show-case/wizard-example/package.json +5 -0
- package/plugins/@vcmap-show-case/wizard-example/src/WizardExample.vue +127 -0
- package/plugins/@vcmap-show-case/wizard-example/src/index.js +53 -0
- package/plugins/package.json +9 -2
- package/public/assets/@mdi/font/LICENSE +20 -0
- package/public/assets/@mdi/font/css/materialdesignicons.css.map +16 -0
- package/public/assets/@mdi/font/css/materialdesignicons.min.css +3 -0
- package/public/assets/@mdi/font/fonts/materialdesignicons-webfont.woff2 +0 -0
- package/public/assets/favicon-128.png +0 -0
- package/public/assets/favicon-180.png +0 -0
- package/public/assets/favicon-192.png +0 -0
- package/public/assets/favicon-32.png +0 -0
- package/public/assets/favicon.svg +10 -0
- package/public/assets/font/OFL.txt +93 -0
- package/public/assets/font/TitilliumWeb-Regular.woff2 +0 -0
- package/public/assets/style/icon-marker-blue.png +0 -0
- package/public/assets/style/icon-marker-green.png +0 -0
- package/public/assets/style/icon-marker-o-blue.png +0 -0
- package/public/assets/style/icon-marker-o-green.png +0 -0
- package/public/assets/style/icon-marker-o-red.png +0 -0
- package/public/assets/style/icon-marker-o.png +0 -0
- package/public/assets/style/icon-marker-red.png +0 -0
- package/public/assets/style/icon-marker.png +0 -0
- package/public/assets/style/icon-pin-blue.png +0 -0
- package/public/assets/style/icon-pin-green.png +0 -0
- package/public/assets/style/icon-pin-red.png +0 -0
- package/public/assets/style/icon-pin.png +0 -0
- package/src/actions/StyleSelector.vue +121 -0
- package/src/actions/actionHelper.js +186 -50
- package/src/actions/stateRefAction.js +2 -3
- package/src/application/VcsApp.vue +539 -93
- package/src/application/VcsAppWrapper.vue +32 -0
- package/src/application/VcsAttributions.vue +83 -0
- package/src/application/VcsAttributionsFooter.vue +83 -0
- package/src/application/VcsMap.vue +22 -5
- package/src/application/VcsNavbar.vue +217 -0
- package/src/application/VcsSettings.vue +98 -0
- package/src/application/attributionsHelper.js +162 -0
- package/src/callback/activateLayersCallback.js +54 -0
- package/src/callback/applyLayerStyleCallback.js +63 -0
- package/src/callback/deactivateLayersCallback.js +54 -0
- package/src/callback/goToViewpointCallback.js +54 -0
- package/src/callback/vcsCallback.js +66 -0
- package/src/components/ImageElementInjector.vue +24 -0
- package/src/components/buttons/VcsActionButtonList.vue +129 -0
- package/src/components/buttons/VcsButton.vue +151 -0
- package/src/components/buttons/VcsFormButton.vue +178 -0
- package/src/components/buttons/VcsToolButton.vue +161 -0
- package/src/components/form-inputs-controls/VcsCheckbox.vue +115 -0
- package/src/components/form-inputs-controls/VcsChipArrayInput.vue +290 -0
- package/src/components/form-inputs-controls/VcsDatePicker.vue +156 -0
- package/src/components/form-inputs-controls/VcsFormSection.vue +150 -0
- package/src/components/form-inputs-controls/VcsLabel.vue +56 -0
- package/src/components/form-inputs-controls/VcsRadio.vue +149 -0
- package/src/components/form-inputs-controls/VcsRadioGrid.vue +175 -0
- package/src/components/form-inputs-controls/VcsSelect.vue +211 -0
- package/src/components/form-inputs-controls/VcsSlider.vue +73 -0
- package/src/components/form-inputs-controls/VcsTextArea.vue +180 -0
- package/src/components/form-inputs-controls/VcsTextField.vue +298 -0
- package/src/components/form-inputs-controls/VcsWizard.vue +137 -0
- package/src/components/form-inputs-controls/VcsWizardStep.vue +161 -0
- package/src/components/form-inputs-controls/composables.js +31 -0
- package/src/components/form-output/VcsFormattedNumber.vue +103 -0
- package/src/components/icons/+all.js +463 -0
- package/src/components/icons/2DAreaIcon.vue +58 -0
- package/src/components/icons/2DDistanceIcon.vue +24 -0
- package/src/components/icons/3DAreaIcon.vue +58 -0
- package/src/components/icons/3DDistanceIcon.vue +24 -0
- package/src/components/icons/3DHeightIcon.vue +24 -0
- package/src/components/icons/AngleIcon.vue +16 -0
- package/src/components/icons/AssociationsIcon.vue +37 -0
- package/src/components/icons/AxisIcon.vue +35 -0
- package/src/components/icons/BoundingBoxIcon.vue +38 -0
- package/src/components/icons/CheckboxCheckedIcon.vue +12 -0
- package/src/components/icons/CheckboxIcon.vue +21 -0
- package/src/components/icons/CheckboxIndeterminateIcon.vue +10 -0
- package/src/components/icons/CircleIcon.vue +25 -0
- package/src/components/icons/ClippingHorizontalIcon.vue +18 -0
- package/src/components/icons/ClippingIcon.vue +17 -0
- package/src/components/icons/ClippingVerticalIcon.vue +18 -0
- package/src/components/icons/ColorPickerIcon.vue +17 -0
- package/src/components/icons/ColorSwatchIcon.vue +21 -0
- package/src/components/icons/CommentIcon.vue +19 -0
- package/src/components/icons/CompassIcon.vue +24 -0
- package/src/components/icons/ComponentsIcon.vue +18 -0
- package/src/components/icons/ConeIcon.vue +30 -0
- package/src/components/icons/DimensionsHouseIcon.vue +20 -0
- package/src/components/icons/EditIcon.vue +17 -0
- package/src/components/icons/EditVerticesIcon.vue +35 -0
- package/src/components/icons/ElevationProfileIcon.vue +104 -0
- package/src/components/icons/ExportAreaIcon.vue +17 -0
- package/src/components/icons/ExportFlightIcon.vue +17 -0
- package/src/components/icons/ExportIcon.vue +24 -0
- package/src/components/icons/ExternalLinkIcon.vue +23 -0
- package/src/components/icons/EyeIcon.vue +17 -0
- package/src/components/icons/FastForwardIcon.vue +17 -0
- package/src/components/icons/FilterIcon.vue +18 -0
- package/src/components/icons/GlobalTerrainIcon.vue +19 -0
- package/src/components/icons/GlobeNatureIcon.vue +17 -0
- package/src/components/icons/GroundIcon.vue +27 -0
- package/src/components/icons/HealthCareIndustriesIcon.vue +113 -0
- package/src/components/icons/HelpIcon.vue +17 -0
- package/src/components/icons/HideIcon.vue +25 -0
- package/src/components/icons/HomePointIcon.vue +17 -0
- package/src/components/icons/HospitalsIcon.vue +223 -0
- package/src/components/icons/HouseIcon.vue +32 -0
- package/src/components/icons/ImportIcon.vue +18 -0
- package/src/components/icons/InfoIcon.vue +24 -0
- package/src/components/icons/KebabIcon.vue +38 -0
- package/src/components/icons/LabelIcon.vue +23 -0
- package/src/components/icons/LayersIcon.vue +28 -0
- package/src/components/icons/LegendIcon.vue +24 -0
- package/src/components/icons/LineIcon.vue +22 -0
- package/src/components/icons/LinkIcon.vue +17 -0
- package/src/components/icons/LogoutIcon.vue +17 -0
- package/src/components/icons/MapIcon.vue +18 -0
- package/src/components/icons/MenuIcon.vue +36 -0
- package/src/components/icons/MinusIcon.vue +18 -0
- package/src/components/icons/ObjectAttributeIcon.vue +18 -0
- package/src/components/icons/ObjectSelectIcon.vue +18 -0
- package/src/components/icons/ObliqueViewIcon.vue +19 -0
- package/src/components/icons/PdfIcon.vue +19 -0
- package/src/components/icons/PedestrianIcon.vue +17 -0
- package/src/components/icons/PenIcon.vue +16 -0
- package/src/components/icons/PlayCircleIcon.vue +20 -0
- package/src/components/icons/PlusIcon.vue +18 -0
- package/src/components/icons/PoiIcon.vue +23 -0
- package/src/components/icons/PointIcon.vue +40 -0
- package/src/components/icons/PointSelectIcon.vue +18 -0
- package/src/components/icons/PresentationModeIcon.vue +17 -0
- package/src/components/icons/ProgressIcon.vue +26 -0
- package/src/components/icons/QueryIcon.vue +39 -0
- package/src/components/icons/RectangleIcon.vue +24 -0
- package/src/components/icons/ReturnIcon.vue +17 -0
- package/src/components/icons/RewindIcon.vue +16 -0
- package/src/components/icons/RotateLeftIcon.vue +17 -0
- package/src/components/icons/RotateRightIcon.vue +17 -0
- package/src/components/icons/ScreenshotIcon.vue +53 -0
- package/src/components/icons/SearchIcon.vue +17 -0
- package/src/components/icons/ShadowIcon.vue +18 -0
- package/src/components/icons/ShapesIcon.vue +35 -0
- package/src/components/icons/ShareIcon.vue +22 -0
- package/src/components/icons/SimpleCircleFilledIcon.vue +18 -0
- package/src/components/icons/SimpleCircleHalfFilledIcon.vue +16 -0
- package/src/components/icons/SimpleCircleOutlinedIcon.vue +13 -0
- package/src/components/icons/SkipNextIcon.vue +18 -0
- package/src/components/icons/SkipPreviousIcon.vue +18 -0
- package/src/components/icons/SplitViewIcon.vue +19 -0
- package/src/components/icons/TerrainBoxIcon.vue +19 -0
- package/src/components/icons/TextStyleIcon.vue +17 -0
- package/src/components/icons/ThreeDimensionsIcon.vue +17 -0
- package/src/components/icons/ToolsIcon.vue +16 -0
- package/src/components/icons/TouchIcon.vue +18 -0
- package/src/components/icons/TrashCanIcon.vue +18 -0
- package/src/components/icons/TriangleIcon.vue +16 -0
- package/src/components/icons/TwoDimensionsIcon.vue +18 -0
- package/src/components/icons/UploadIcon.vue +17 -0
- package/src/components/icons/UserProfileIcon.vue +17 -0
- package/src/components/icons/UserShareIcon.vue +16 -0
- package/src/components/icons/VideoRecorderIcon.vue +23 -0
- package/src/components/icons/ViewpointFlightIcon.vue +28 -0
- package/src/components/icons/ViewpointIcon.vue +28 -0
- package/src/components/icons/Viewshed360Icon.vue +18 -0
- package/src/components/icons/ViewshedConeIcon.vue +17 -0
- package/src/components/icons/ViewshedIcon.vue +18 -0
- package/src/components/icons/WalkingIcon.vue +17 -0
- package/src/components/icons/WallIcon.vue +22 -0
- package/src/components/icons/WandIcon.vue +123 -0
- package/src/components/lists/VcsActionList.vue +132 -0
- package/src/components/lists/VcsList.vue +590 -0
- package/src/components/lists/VcsTreeview.vue +112 -0
- package/src/components/lists/VcsTreeviewLeaf.vue +81 -0
- package/src/components/lists/VcsTreeviewSearchbar.vue +148 -0
- package/src/components/notification/VcsBadge.vue +29 -0
- package/src/components/notification/VcsHelp.vue +39 -0
- package/src/components/notification/VcsTooltip.vue +160 -0
- package/src/components/notification/validation.js +19 -0
- package/src/components/plugins/AbstractConfigEditor.vue +84 -0
- package/src/components/style/MenuWrapper.vue +140 -0
- package/src/components/style/VcsFillMenu.vue +61 -0
- package/src/components/style/VcsFillSelector.vue +45 -0
- package/src/components/style/VcsImageMenu.vue +83 -0
- package/src/components/style/VcsImageSelector.vue +577 -0
- package/src/components/style/VcsStrokeMenu.vue +73 -0
- package/src/components/style/VcsStrokeSelector.vue +88 -0
- package/src/components/style/VcsTextMenu.vue +81 -0
- package/src/components/style/VcsTextSelector.vue +269 -0
- package/src/components/style/VcsVectorStyleComponent.vue +114 -0
- package/src/components/style/composables.js +84 -0
- package/src/components/tables/VcsDataTable.vue +475 -0
- package/src/components/tables/VcsTable.vue +145 -0
- package/src/components/vector-properties/VcsVectorPropertiesComponent.vue +778 -0
- package/src/components/vector-properties/composables.js +93 -0
- package/src/contentTree/LayerTree.vue +19 -15
- package/src/contentTree/contentTreeCollection.js +114 -42
- package/src/contentTree/contentTreeItem.js +109 -43
- package/src/contentTree/groupContentTreeItem.js +46 -23
- package/src/contentTree/layerContentTreeItem.js +54 -23
- package/src/contentTree/layerGroupContentTreeItem.js +58 -26
- package/src/contentTree/nodeContentTreeItem.js +19 -8
- package/src/contentTree/obliqueCollectionContentTreeItem.js +51 -22
- package/src/contentTree/subContentTreeItem.js +14 -5
- package/src/contentTree/vcsObjectContentTreeItem.js +27 -16
- package/src/contentTree/viewpointContentTreeItem.js +121 -0
- package/src/downloadHelper.js +52 -0
- package/src/featureInfo/AddressBalloonComponent.vue +58 -0
- package/src/featureInfo/BalloonComponent.vue +193 -0
- package/src/featureInfo/abstractFeatureInfoView.js +346 -0
- package/src/featureInfo/addressBalloonFeatureInfoView.js +130 -0
- package/src/featureInfo/balloonFeatureInfoView.js +159 -0
- package/src/featureInfo/balloonHelper.js +172 -0
- package/src/featureInfo/featureInfo.js +525 -0
- package/src/featureInfo/featureInfoInteraction.js +48 -0
- package/src/featureInfo/iframeFeatureInfoView.js +97 -0
- package/src/featureInfo/tableFeatureInfoView.js +120 -0
- package/src/i18n/de.js +195 -0
- package/src/i18n/en.js +195 -0
- package/src/i18n/i18nCollection.js +137 -0
- package/src/init.js +121 -36
- package/src/legend/StyleLegendItem.vue +176 -0
- package/src/legend/VcsLegend.vue +140 -0
- package/src/legend/legendHelper.js +204 -0
- package/src/logo-mobile.svg +9 -0
- package/src/logo.svg +26 -0
- package/src/manager/buttonManager.js +30 -61
- package/src/manager/collectionManager/CollectionComponent.vue +140 -0
- package/src/manager/collectionManager/CollectionComponentList.vue +77 -0
- package/src/manager/collectionManager/CollectionComponentProvider.vue +39 -0
- package/src/manager/collectionManager/CollectionManager.vue +62 -0
- package/src/manager/collectionManager/categoryManager.js +83 -0
- package/src/manager/collectionManager/collectionComponent.js +470 -0
- package/src/manager/collectionManager/collectionManager.js +432 -0
- package/src/manager/contextMenu/ContextMenuComponent.vue +43 -0
- package/src/manager/contextMenu/contextMenuInteraction.js +47 -0
- package/src/manager/contextMenu/contextMenuManager.js +220 -0
- package/src/manager/navbarManager.js +115 -0
- package/src/manager/toolbox/GroupToolboxComponent.vue +128 -0
- package/src/manager/toolbox/SelectToolboxComponent.vue +144 -0
- package/src/manager/toolbox/ToolboxManager.vue +139 -74
- package/src/manager/toolbox/toolboxManager.js +371 -0
- package/src/manager/window/WindowComponent.vue +105 -85
- package/src/manager/window/WindowComponentHeader.vue +116 -25
- package/src/manager/window/WindowManager.vue +133 -50
- package/src/manager/window/windowHelper.js +465 -0
- package/src/manager/window/windowManager.js +297 -91
- package/src/navigation/{mapNavCompass.vue → MapNavCompass.vue} +31 -11
- package/src/navigation/MapNavigation.vue +291 -0
- package/src/navigation/ObliqueRotation.vue +69 -0
- package/src/navigation/{orientationToolsButton.vue → OrientationToolsButton.vue} +14 -13
- package/src/navigation/{tiltSlider.vue → TiltSlider.vue} +40 -17
- package/src/navigation/VcsCompass.vue +69 -0
- package/src/navigation/VcsZoomButton.vue +52 -0
- package/src/navigation/overviewMap.js +142 -104
- package/src/navigation/overviewMapClickedInteraction.js +6 -1
- package/src/notifier/NotifierComponent.vue +86 -0
- package/src/notifier/notifier.js +129 -0
- package/src/pluginHelper.js +148 -20
- package/src/search/ResultItem.vue +83 -0
- package/src/search/ResultsComponent.vue +103 -0
- package/src/search/SearchComponent.vue +116 -0
- package/src/search/search.js +342 -0
- package/src/setup.js +9 -10
- package/src/state.js +272 -0
- package/src/styles/_theming.scss +69 -11
- package/src/styles/_typography.scss +3 -6
- package/src/styles/main.scss +12 -0
- package/src/styles/shades.scss +4 -0
- package/src/styles/utils/_border.scss +1 -1
- package/src/styles/utils/_cursor.scss +4 -0
- package/src/styles/utils/_display.scss +1 -1
- package/src/styles/variables.scss +138 -0
- package/src/styles/vcsFont.scss +2 -0
- package/src/styles/vcsGrid.scss +13 -0
- package/src/uiConfig.js +83 -0
- package/src/vcsUiApp.js +510 -69
- package/src/vuePlugins/i18n.js +51 -13
- package/src/vuePlugins/vuetify.js +104 -43
- package/config/berlin.config.json +0 -529
- package/dist/assets/cesium/Workers/ArcType-fc72c06c.js +0 -1
- package/dist/assets/cesium/Workers/AttributeCompression-80665726.js +0 -1
- package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-a655a4bc.js +0 -1
- package/dist/assets/cesium/Workers/BoundingRectangle-c3b79029.js +0 -1
- package/dist/assets/cesium/Workers/BoxGeometry-f8f9c981.js +0 -1
- package/dist/assets/cesium/Workers/Color-de06a177.js +0 -1
- package/dist/assets/cesium/Workers/ComponentDatatype-a15c9a19.js +0 -1
- package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-48cdc26d.js +0 -1
- package/dist/assets/cesium/Workers/CorridorGeometryLibrary-ddc027d3.js +0 -1
- package/dist/assets/cesium/Workers/CylinderGeometry-82a8cbe6.js +0 -1
- package/dist/assets/cesium/Workers/CylinderGeometryLibrary-76cda53e.js +0 -1
- package/dist/assets/cesium/Workers/EllipseGeometry-32d55454.js +0 -1
- package/dist/assets/cesium/Workers/EllipseGeometryLibrary-b2ae188a.js +0 -1
- package/dist/assets/cesium/Workers/EllipseOutlineGeometry-f05a5a27.js +0 -1
- package/dist/assets/cesium/Workers/EllipsoidGeodesic-19e75e11.js +0 -1
- package/dist/assets/cesium/Workers/EllipsoidGeometry-7c99fc81.js +0 -1
- package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-21c243df.js +0 -1
- package/dist/assets/cesium/Workers/EllipsoidRhumbLine-6145377b.js +0 -1
- package/dist/assets/cesium/Workers/EllipsoidTangentPlane-a01286f6.js +0 -1
- package/dist/assets/cesium/Workers/EncodedCartesian3-d9f5c4a4.js +0 -1
- package/dist/assets/cesium/Workers/FrustumGeometry-17776af8.js +0 -1
- package/dist/assets/cesium/Workers/GeometryAttribute-89a520b9.js +0 -1
- package/dist/assets/cesium/Workers/GeometryAttributes-32b29525.js +0 -1
- package/dist/assets/cesium/Workers/GeometryInstance-4fbf16ba.js +0 -1
- package/dist/assets/cesium/Workers/GeometryOffsetAttribute-8c5e10db.js +0 -1
- package/dist/assets/cesium/Workers/GeometryPipeline-309fad76.js +0 -1
- package/dist/assets/cesium/Workers/IndexDatatype-f1dcdf35.js +0 -1
- package/dist/assets/cesium/Workers/IntersectionTests-58aa8f80.js +0 -1
- package/dist/assets/cesium/Workers/Matrix2-47e98d76.js +0 -1
- package/dist/assets/cesium/Workers/OrientedBoundingBox-fcb5b750.js +0 -1
- package/dist/assets/cesium/Workers/Plane-3f01019d.js +0 -1
- package/dist/assets/cesium/Workers/PolygonGeometryLibrary-0b29eb16.js +0 -1
- package/dist/assets/cesium/Workers/PolygonPipeline-a934c4dd.js +0 -1
- package/dist/assets/cesium/Workers/PolylinePipeline-8095c9bc.js +0 -1
- package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-67d12fff.js +0 -1
- package/dist/assets/cesium/Workers/PrimitivePipeline-980e44c5.js +0 -1
- package/dist/assets/cesium/Workers/RectangleGeometryLibrary-621c6de8.js +0 -1
- package/dist/assets/cesium/Workers/RuntimeError-8952249c.js +0 -1
- package/dist/assets/cesium/Workers/TerrainEncoding-f96552d5.js +0 -1
- package/dist/assets/cesium/Workers/Transforms-c8cb8f43.js +0 -39
- package/dist/assets/cesium/Workers/VertexFormat-a0b706b0.js +0 -1
- package/dist/assets/cesium/Workers/WallGeometryLibrary-c03d8479.js +0 -1
- package/dist/assets/cesium/Workers/WebGLConstants-508b9636.js +0 -1
- package/dist/assets/cesium/Workers/WebMercatorProjection-79b3214e.js +0 -1
- package/dist/assets/cesium/Workers/_commonjsHelpers-3aae1032-26891ab7.js +0 -1
- package/dist/assets/cesium/Workers/_rollup_plugin_ignore_empty_module_placeholder-57d574d0.js +0 -1
- package/dist/assets/cesium/Workers/arrayRemoveDuplicates-dc2f4046.js +0 -1
- package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +0 -6
- package/dist/assets/cesium/Workers/combine-3c023bda.js +0 -1
- package/dist/assets/cesium/Workers/defaultValue-81eec7ed.js +0 -1
- package/dist/assets/cesium.6b5bb6.js +0 -9105
- package/dist/assets/core.98f9bb.js +0 -4
- package/dist/assets/index.0be2842f.js +0 -1
- package/dist/assets/index.60dea538.css +0 -1
- package/dist/assets/ol.0561aa.js +0 -318
- package/dist/assets/ui.b7c1e3.css +0 -1
- package/dist/assets/ui.b7c1e3.js +0 -39
- package/dist/assets/uicomponents.682c5f.css +0 -1
- package/dist/assets/uicomponents.682c5f.js +0 -32
- package/dist/assets/uicomponents.js +0 -1
- package/dist/assets/vue-composition-api.f926fa.js +0 -14
- package/dist/assets/vue-composition-api.js +0 -2
- package/dist/assets/vue.ddcb6b.js +0 -9
- package/dist/assets/vuetify.d21163.css +0 -5
- package/dist/assets/vuetify.d21163.js +0 -48
- package/lib/uicomponents.js +0 -1
- package/lib/vue-composition-api.js +0 -2
- package/map.config.json +0 -35
- package/plugins/@vcmap/pluginExample/config.json +0 -6
- package/plugins/@vcmap/pluginExample/package.json +0 -7
- package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +0 -374
- package/plugins/@vcmap/project-selector/ContextsListComponent.vue +0 -62
- package/plugins/@vcmap/project-selector/ProjectSelectorComponent.vue +0 -81
- package/plugins/@vcmap/project-selector/README.md +0 -29
- package/plugins/@vcmap/project-selector/config.json +0 -15
- package/plugins/@vcmap/project-selector/index.js +0 -254
- package/plugins/@vcmap/project-selector/package.json +0 -15
- package/plugins/@vcmap/theme-changer/config.json +0 -69
- package/plugins/@vcmap/theme-changer/package.json +0 -12
- package/plugins/buttonExamples/ButtonExamples.vue +0 -190
- package/plugins/buttonExamples/index.js +0 -40
- package/plugins/categoryTest/Categories.vue +0 -145
- package/plugins/categoryTest/Category.vue +0 -114
- package/plugins/categoryTest/ItemEditor.vue +0 -13
- package/plugins/categoryTest/index.js +0 -41
- package/plugins/example/index.js +0 -56
- package/plugins/test/editor.vue +0 -63
- package/plugins/test/index.js +0 -93
- package/plugins/test/myCustomHeader.vue +0 -19
- package/plugins/test/toolbox-data.js +0 -49
- package/plugins/test/vcsContent.vue +0 -23
- package/plugins/test/windowManagerExample.vue +0 -144
- package/src/actions/styleSelector.vue +0 -90
- package/src/application/Navbar.vue +0 -118
- package/src/application/empty-cmp.vue +0 -6
- package/src/assets/logo.svg +0 -26
- package/src/contentTree/viewPointContentTreeItem.js +0 -107
- package/src/lang/de.js +0 -60
- package/src/lang/en.js +0 -53
- package/src/manager/toolbox/ToolboxMultiSelectButton.vue +0 -96
- package/src/manager/toolbox/ToolboxSingleSelectButton.vue +0 -98
- package/src/manager/toolbox/toolbox-manager.js +0 -203
- package/src/navigation/mapNavigation.vue +0 -201
- package/src/navigation/obliqueRotation.vue +0 -48
- package/src/navigation/vcsCompass.vue +0 -144
- package/src/navigation/vcsZoomButton.vue +0 -27
- package/start.js +0 -3
@@ -0,0 +1,3273 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
4
|
+
* Version 1.109.3
|
5
|
+
*
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*
|
20
|
+
* Columbus View (Pat. Pend.)
|
21
|
+
*
|
22
|
+
* Portions licensed separately.
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
24
|
+
*/
|
25
|
+
|
26
|
+
import {
|
27
|
+
Cartesian3_default,
|
28
|
+
Cartographic_default,
|
29
|
+
Ellipsoid_default,
|
30
|
+
Matrix3_default
|
31
|
+
} from "./chunk-PCJWUS4M.js";
|
32
|
+
import {
|
33
|
+
Math_default
|
34
|
+
} from "./chunk-N3JIFFX2.js";
|
35
|
+
import {
|
36
|
+
RuntimeError_default
|
37
|
+
} from "./chunk-ABADGKYE.js";
|
38
|
+
import {
|
39
|
+
defaultValue_default
|
40
|
+
} from "./chunk-WXTV4ATB.js";
|
41
|
+
import {
|
42
|
+
Check_default,
|
43
|
+
DeveloperError_default
|
44
|
+
} from "./chunk-4MFFIWUA.js";
|
45
|
+
import {
|
46
|
+
defined_default
|
47
|
+
} from "./chunk-6BTKZDRG.js";
|
48
|
+
|
49
|
+
// packages/engine/Source/Core/Cartesian4.js
|
50
|
+
function Cartesian4(x, y, z, w) {
|
51
|
+
this.x = defaultValue_default(x, 0);
|
52
|
+
this.y = defaultValue_default(y, 0);
|
53
|
+
this.z = defaultValue_default(z, 0);
|
54
|
+
this.w = defaultValue_default(w, 0);
|
55
|
+
}
|
56
|
+
Cartesian4.fromElements = function(x, y, z, w, result) {
|
57
|
+
if (!defined_default(result)) {
|
58
|
+
return new Cartesian4(x, y, z, w);
|
59
|
+
}
|
60
|
+
result.x = x;
|
61
|
+
result.y = y;
|
62
|
+
result.z = z;
|
63
|
+
result.w = w;
|
64
|
+
return result;
|
65
|
+
};
|
66
|
+
Cartesian4.fromColor = function(color, result) {
|
67
|
+
Check_default.typeOf.object("color", color);
|
68
|
+
if (!defined_default(result)) {
|
69
|
+
return new Cartesian4(color.red, color.green, color.blue, color.alpha);
|
70
|
+
}
|
71
|
+
result.x = color.red;
|
72
|
+
result.y = color.green;
|
73
|
+
result.z = color.blue;
|
74
|
+
result.w = color.alpha;
|
75
|
+
return result;
|
76
|
+
};
|
77
|
+
Cartesian4.clone = function(cartesian, result) {
|
78
|
+
if (!defined_default(cartesian)) {
|
79
|
+
return void 0;
|
80
|
+
}
|
81
|
+
if (!defined_default(result)) {
|
82
|
+
return new Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
83
|
+
}
|
84
|
+
result.x = cartesian.x;
|
85
|
+
result.y = cartesian.y;
|
86
|
+
result.z = cartesian.z;
|
87
|
+
result.w = cartesian.w;
|
88
|
+
return result;
|
89
|
+
};
|
90
|
+
Cartesian4.packedLength = 4;
|
91
|
+
Cartesian4.pack = function(value, array, startingIndex) {
|
92
|
+
Check_default.typeOf.object("value", value);
|
93
|
+
Check_default.defined("array", array);
|
94
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
95
|
+
array[startingIndex++] = value.x;
|
96
|
+
array[startingIndex++] = value.y;
|
97
|
+
array[startingIndex++] = value.z;
|
98
|
+
array[startingIndex] = value.w;
|
99
|
+
return array;
|
100
|
+
};
|
101
|
+
Cartesian4.unpack = function(array, startingIndex, result) {
|
102
|
+
Check_default.defined("array", array);
|
103
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
104
|
+
if (!defined_default(result)) {
|
105
|
+
result = new Cartesian4();
|
106
|
+
}
|
107
|
+
result.x = array[startingIndex++];
|
108
|
+
result.y = array[startingIndex++];
|
109
|
+
result.z = array[startingIndex++];
|
110
|
+
result.w = array[startingIndex];
|
111
|
+
return result;
|
112
|
+
};
|
113
|
+
Cartesian4.packArray = function(array, result) {
|
114
|
+
Check_default.defined("array", array);
|
115
|
+
const length = array.length;
|
116
|
+
const resultLength = length * 4;
|
117
|
+
if (!defined_default(result)) {
|
118
|
+
result = new Array(resultLength);
|
119
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
120
|
+
throw new DeveloperError_default(
|
121
|
+
"If result is a typed array, it must have exactly array.length * 4 elements"
|
122
|
+
);
|
123
|
+
} else if (result.length !== resultLength) {
|
124
|
+
result.length = resultLength;
|
125
|
+
}
|
126
|
+
for (let i = 0; i < length; ++i) {
|
127
|
+
Cartesian4.pack(array[i], result, i * 4);
|
128
|
+
}
|
129
|
+
return result;
|
130
|
+
};
|
131
|
+
Cartesian4.unpackArray = function(array, result) {
|
132
|
+
Check_default.defined("array", array);
|
133
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
134
|
+
if (array.length % 4 !== 0) {
|
135
|
+
throw new DeveloperError_default("array length must be a multiple of 4.");
|
136
|
+
}
|
137
|
+
const length = array.length;
|
138
|
+
if (!defined_default(result)) {
|
139
|
+
result = new Array(length / 4);
|
140
|
+
} else {
|
141
|
+
result.length = length / 4;
|
142
|
+
}
|
143
|
+
for (let i = 0; i < length; i += 4) {
|
144
|
+
const index = i / 4;
|
145
|
+
result[index] = Cartesian4.unpack(array, i, result[index]);
|
146
|
+
}
|
147
|
+
return result;
|
148
|
+
};
|
149
|
+
Cartesian4.fromArray = Cartesian4.unpack;
|
150
|
+
Cartesian4.maximumComponent = function(cartesian) {
|
151
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
152
|
+
return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
153
|
+
};
|
154
|
+
Cartesian4.minimumComponent = function(cartesian) {
|
155
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
156
|
+
return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
157
|
+
};
|
158
|
+
Cartesian4.minimumByComponent = function(first, second, result) {
|
159
|
+
Check_default.typeOf.object("first", first);
|
160
|
+
Check_default.typeOf.object("second", second);
|
161
|
+
Check_default.typeOf.object("result", result);
|
162
|
+
result.x = Math.min(first.x, second.x);
|
163
|
+
result.y = Math.min(first.y, second.y);
|
164
|
+
result.z = Math.min(first.z, second.z);
|
165
|
+
result.w = Math.min(first.w, second.w);
|
166
|
+
return result;
|
167
|
+
};
|
168
|
+
Cartesian4.maximumByComponent = function(first, second, result) {
|
169
|
+
Check_default.typeOf.object("first", first);
|
170
|
+
Check_default.typeOf.object("second", second);
|
171
|
+
Check_default.typeOf.object("result", result);
|
172
|
+
result.x = Math.max(first.x, second.x);
|
173
|
+
result.y = Math.max(first.y, second.y);
|
174
|
+
result.z = Math.max(first.z, second.z);
|
175
|
+
result.w = Math.max(first.w, second.w);
|
176
|
+
return result;
|
177
|
+
};
|
178
|
+
Cartesian4.clamp = function(value, min, max, result) {
|
179
|
+
Check_default.typeOf.object("value", value);
|
180
|
+
Check_default.typeOf.object("min", min);
|
181
|
+
Check_default.typeOf.object("max", max);
|
182
|
+
Check_default.typeOf.object("result", result);
|
183
|
+
const x = Math_default.clamp(value.x, min.x, max.x);
|
184
|
+
const y = Math_default.clamp(value.y, min.y, max.y);
|
185
|
+
const z = Math_default.clamp(value.z, min.z, max.z);
|
186
|
+
const w = Math_default.clamp(value.w, min.w, max.w);
|
187
|
+
result.x = x;
|
188
|
+
result.y = y;
|
189
|
+
result.z = z;
|
190
|
+
result.w = w;
|
191
|
+
return result;
|
192
|
+
};
|
193
|
+
Cartesian4.magnitudeSquared = function(cartesian) {
|
194
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
195
|
+
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
|
196
|
+
};
|
197
|
+
Cartesian4.magnitude = function(cartesian) {
|
198
|
+
return Math.sqrt(Cartesian4.magnitudeSquared(cartesian));
|
199
|
+
};
|
200
|
+
var distanceScratch = new Cartesian4();
|
201
|
+
Cartesian4.distance = function(left, right) {
|
202
|
+
Check_default.typeOf.object("left", left);
|
203
|
+
Check_default.typeOf.object("right", right);
|
204
|
+
Cartesian4.subtract(left, right, distanceScratch);
|
205
|
+
return Cartesian4.magnitude(distanceScratch);
|
206
|
+
};
|
207
|
+
Cartesian4.distanceSquared = function(left, right) {
|
208
|
+
Check_default.typeOf.object("left", left);
|
209
|
+
Check_default.typeOf.object("right", right);
|
210
|
+
Cartesian4.subtract(left, right, distanceScratch);
|
211
|
+
return Cartesian4.magnitudeSquared(distanceScratch);
|
212
|
+
};
|
213
|
+
Cartesian4.normalize = function(cartesian, result) {
|
214
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
215
|
+
Check_default.typeOf.object("result", result);
|
216
|
+
const magnitude = Cartesian4.magnitude(cartesian);
|
217
|
+
result.x = cartesian.x / magnitude;
|
218
|
+
result.y = cartesian.y / magnitude;
|
219
|
+
result.z = cartesian.z / magnitude;
|
220
|
+
result.w = cartesian.w / magnitude;
|
221
|
+
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
|
222
|
+
throw new DeveloperError_default("normalized result is not a number");
|
223
|
+
}
|
224
|
+
return result;
|
225
|
+
};
|
226
|
+
Cartesian4.dot = function(left, right) {
|
227
|
+
Check_default.typeOf.object("left", left);
|
228
|
+
Check_default.typeOf.object("right", right);
|
229
|
+
return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
|
230
|
+
};
|
231
|
+
Cartesian4.multiplyComponents = function(left, right, result) {
|
232
|
+
Check_default.typeOf.object("left", left);
|
233
|
+
Check_default.typeOf.object("right", right);
|
234
|
+
Check_default.typeOf.object("result", result);
|
235
|
+
result.x = left.x * right.x;
|
236
|
+
result.y = left.y * right.y;
|
237
|
+
result.z = left.z * right.z;
|
238
|
+
result.w = left.w * right.w;
|
239
|
+
return result;
|
240
|
+
};
|
241
|
+
Cartesian4.divideComponents = function(left, right, result) {
|
242
|
+
Check_default.typeOf.object("left", left);
|
243
|
+
Check_default.typeOf.object("right", right);
|
244
|
+
Check_default.typeOf.object("result", result);
|
245
|
+
result.x = left.x / right.x;
|
246
|
+
result.y = left.y / right.y;
|
247
|
+
result.z = left.z / right.z;
|
248
|
+
result.w = left.w / right.w;
|
249
|
+
return result;
|
250
|
+
};
|
251
|
+
Cartesian4.add = function(left, right, result) {
|
252
|
+
Check_default.typeOf.object("left", left);
|
253
|
+
Check_default.typeOf.object("right", right);
|
254
|
+
Check_default.typeOf.object("result", result);
|
255
|
+
result.x = left.x + right.x;
|
256
|
+
result.y = left.y + right.y;
|
257
|
+
result.z = left.z + right.z;
|
258
|
+
result.w = left.w + right.w;
|
259
|
+
return result;
|
260
|
+
};
|
261
|
+
Cartesian4.subtract = function(left, right, result) {
|
262
|
+
Check_default.typeOf.object("left", left);
|
263
|
+
Check_default.typeOf.object("right", right);
|
264
|
+
Check_default.typeOf.object("result", result);
|
265
|
+
result.x = left.x - right.x;
|
266
|
+
result.y = left.y - right.y;
|
267
|
+
result.z = left.z - right.z;
|
268
|
+
result.w = left.w - right.w;
|
269
|
+
return result;
|
270
|
+
};
|
271
|
+
Cartesian4.multiplyByScalar = function(cartesian, scalar, result) {
|
272
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
273
|
+
Check_default.typeOf.number("scalar", scalar);
|
274
|
+
Check_default.typeOf.object("result", result);
|
275
|
+
result.x = cartesian.x * scalar;
|
276
|
+
result.y = cartesian.y * scalar;
|
277
|
+
result.z = cartesian.z * scalar;
|
278
|
+
result.w = cartesian.w * scalar;
|
279
|
+
return result;
|
280
|
+
};
|
281
|
+
Cartesian4.divideByScalar = function(cartesian, scalar, result) {
|
282
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
283
|
+
Check_default.typeOf.number("scalar", scalar);
|
284
|
+
Check_default.typeOf.object("result", result);
|
285
|
+
result.x = cartesian.x / scalar;
|
286
|
+
result.y = cartesian.y / scalar;
|
287
|
+
result.z = cartesian.z / scalar;
|
288
|
+
result.w = cartesian.w / scalar;
|
289
|
+
return result;
|
290
|
+
};
|
291
|
+
Cartesian4.negate = function(cartesian, result) {
|
292
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
293
|
+
Check_default.typeOf.object("result", result);
|
294
|
+
result.x = -cartesian.x;
|
295
|
+
result.y = -cartesian.y;
|
296
|
+
result.z = -cartesian.z;
|
297
|
+
result.w = -cartesian.w;
|
298
|
+
return result;
|
299
|
+
};
|
300
|
+
Cartesian4.abs = function(cartesian, result) {
|
301
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
302
|
+
Check_default.typeOf.object("result", result);
|
303
|
+
result.x = Math.abs(cartesian.x);
|
304
|
+
result.y = Math.abs(cartesian.y);
|
305
|
+
result.z = Math.abs(cartesian.z);
|
306
|
+
result.w = Math.abs(cartesian.w);
|
307
|
+
return result;
|
308
|
+
};
|
309
|
+
var lerpScratch = new Cartesian4();
|
310
|
+
Cartesian4.lerp = function(start, end, t, result) {
|
311
|
+
Check_default.typeOf.object("start", start);
|
312
|
+
Check_default.typeOf.object("end", end);
|
313
|
+
Check_default.typeOf.number("t", t);
|
314
|
+
Check_default.typeOf.object("result", result);
|
315
|
+
Cartesian4.multiplyByScalar(end, t, lerpScratch);
|
316
|
+
result = Cartesian4.multiplyByScalar(start, 1 - t, result);
|
317
|
+
return Cartesian4.add(lerpScratch, result, result);
|
318
|
+
};
|
319
|
+
var mostOrthogonalAxisScratch = new Cartesian4();
|
320
|
+
Cartesian4.mostOrthogonalAxis = function(cartesian, result) {
|
321
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
322
|
+
Check_default.typeOf.object("result", result);
|
323
|
+
const f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
|
324
|
+
Cartesian4.abs(f, f);
|
325
|
+
if (f.x <= f.y) {
|
326
|
+
if (f.x <= f.z) {
|
327
|
+
if (f.x <= f.w) {
|
328
|
+
result = Cartesian4.clone(Cartesian4.UNIT_X, result);
|
329
|
+
} else {
|
330
|
+
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
331
|
+
}
|
332
|
+
} else if (f.z <= f.w) {
|
333
|
+
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
|
334
|
+
} else {
|
335
|
+
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
336
|
+
}
|
337
|
+
} else if (f.y <= f.z) {
|
338
|
+
if (f.y <= f.w) {
|
339
|
+
result = Cartesian4.clone(Cartesian4.UNIT_Y, result);
|
340
|
+
} else {
|
341
|
+
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
342
|
+
}
|
343
|
+
} else if (f.z <= f.w) {
|
344
|
+
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
|
345
|
+
} else {
|
346
|
+
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
347
|
+
}
|
348
|
+
return result;
|
349
|
+
};
|
350
|
+
Cartesian4.equals = function(left, right) {
|
351
|
+
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
|
352
|
+
};
|
353
|
+
Cartesian4.equalsArray = function(cartesian, array, offset) {
|
354
|
+
return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
|
355
|
+
};
|
356
|
+
Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
|
357
|
+
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
358
|
+
left.x,
|
359
|
+
right.x,
|
360
|
+
relativeEpsilon,
|
361
|
+
absoluteEpsilon
|
362
|
+
) && Math_default.equalsEpsilon(
|
363
|
+
left.y,
|
364
|
+
right.y,
|
365
|
+
relativeEpsilon,
|
366
|
+
absoluteEpsilon
|
367
|
+
) && Math_default.equalsEpsilon(
|
368
|
+
left.z,
|
369
|
+
right.z,
|
370
|
+
relativeEpsilon,
|
371
|
+
absoluteEpsilon
|
372
|
+
) && Math_default.equalsEpsilon(
|
373
|
+
left.w,
|
374
|
+
right.w,
|
375
|
+
relativeEpsilon,
|
376
|
+
absoluteEpsilon
|
377
|
+
);
|
378
|
+
};
|
379
|
+
Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
|
380
|
+
Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
|
381
|
+
Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
|
382
|
+
Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
|
383
|
+
Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
|
384
|
+
Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
|
385
|
+
Cartesian4.prototype.clone = function(result) {
|
386
|
+
return Cartesian4.clone(this, result);
|
387
|
+
};
|
388
|
+
Cartesian4.prototype.equals = function(right) {
|
389
|
+
return Cartesian4.equals(this, right);
|
390
|
+
};
|
391
|
+
Cartesian4.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
|
392
|
+
return Cartesian4.equalsEpsilon(
|
393
|
+
this,
|
394
|
+
right,
|
395
|
+
relativeEpsilon,
|
396
|
+
absoluteEpsilon
|
397
|
+
);
|
398
|
+
};
|
399
|
+
Cartesian4.prototype.toString = function() {
|
400
|
+
return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
|
401
|
+
};
|
402
|
+
var scratchF32Array = new Float32Array(1);
|
403
|
+
var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
|
404
|
+
var testU32 = new Uint32Array([287454020]);
|
405
|
+
var testU8 = new Uint8Array(testU32.buffer);
|
406
|
+
var littleEndian = testU8[0] === 68;
|
407
|
+
Cartesian4.packFloat = function(value, result) {
|
408
|
+
Check_default.typeOf.number("value", value);
|
409
|
+
if (!defined_default(result)) {
|
410
|
+
result = new Cartesian4();
|
411
|
+
}
|
412
|
+
scratchF32Array[0] = value;
|
413
|
+
if (littleEndian) {
|
414
|
+
result.x = scratchU8Array[0];
|
415
|
+
result.y = scratchU8Array[1];
|
416
|
+
result.z = scratchU8Array[2];
|
417
|
+
result.w = scratchU8Array[3];
|
418
|
+
} else {
|
419
|
+
result.x = scratchU8Array[3];
|
420
|
+
result.y = scratchU8Array[2];
|
421
|
+
result.z = scratchU8Array[1];
|
422
|
+
result.w = scratchU8Array[0];
|
423
|
+
}
|
424
|
+
return result;
|
425
|
+
};
|
426
|
+
Cartesian4.unpackFloat = function(packedFloat) {
|
427
|
+
Check_default.typeOf.object("packedFloat", packedFloat);
|
428
|
+
if (littleEndian) {
|
429
|
+
scratchU8Array[0] = packedFloat.x;
|
430
|
+
scratchU8Array[1] = packedFloat.y;
|
431
|
+
scratchU8Array[2] = packedFloat.z;
|
432
|
+
scratchU8Array[3] = packedFloat.w;
|
433
|
+
} else {
|
434
|
+
scratchU8Array[0] = packedFloat.w;
|
435
|
+
scratchU8Array[1] = packedFloat.z;
|
436
|
+
scratchU8Array[2] = packedFloat.y;
|
437
|
+
scratchU8Array[3] = packedFloat.x;
|
438
|
+
}
|
439
|
+
return scratchF32Array[0];
|
440
|
+
};
|
441
|
+
var Cartesian4_default = Cartesian4;
|
442
|
+
|
443
|
+
// packages/engine/Source/Core/Matrix4.js
|
444
|
+
function Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3) {
|
445
|
+
this[0] = defaultValue_default(column0Row0, 0);
|
446
|
+
this[1] = defaultValue_default(column0Row1, 0);
|
447
|
+
this[2] = defaultValue_default(column0Row2, 0);
|
448
|
+
this[3] = defaultValue_default(column0Row3, 0);
|
449
|
+
this[4] = defaultValue_default(column1Row0, 0);
|
450
|
+
this[5] = defaultValue_default(column1Row1, 0);
|
451
|
+
this[6] = defaultValue_default(column1Row2, 0);
|
452
|
+
this[7] = defaultValue_default(column1Row3, 0);
|
453
|
+
this[8] = defaultValue_default(column2Row0, 0);
|
454
|
+
this[9] = defaultValue_default(column2Row1, 0);
|
455
|
+
this[10] = defaultValue_default(column2Row2, 0);
|
456
|
+
this[11] = defaultValue_default(column2Row3, 0);
|
457
|
+
this[12] = defaultValue_default(column3Row0, 0);
|
458
|
+
this[13] = defaultValue_default(column3Row1, 0);
|
459
|
+
this[14] = defaultValue_default(column3Row2, 0);
|
460
|
+
this[15] = defaultValue_default(column3Row3, 0);
|
461
|
+
}
|
462
|
+
Matrix4.packedLength = 16;
|
463
|
+
Matrix4.pack = function(value, array, startingIndex) {
|
464
|
+
Check_default.typeOf.object("value", value);
|
465
|
+
Check_default.defined("array", array);
|
466
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
467
|
+
array[startingIndex++] = value[0];
|
468
|
+
array[startingIndex++] = value[1];
|
469
|
+
array[startingIndex++] = value[2];
|
470
|
+
array[startingIndex++] = value[3];
|
471
|
+
array[startingIndex++] = value[4];
|
472
|
+
array[startingIndex++] = value[5];
|
473
|
+
array[startingIndex++] = value[6];
|
474
|
+
array[startingIndex++] = value[7];
|
475
|
+
array[startingIndex++] = value[8];
|
476
|
+
array[startingIndex++] = value[9];
|
477
|
+
array[startingIndex++] = value[10];
|
478
|
+
array[startingIndex++] = value[11];
|
479
|
+
array[startingIndex++] = value[12];
|
480
|
+
array[startingIndex++] = value[13];
|
481
|
+
array[startingIndex++] = value[14];
|
482
|
+
array[startingIndex] = value[15];
|
483
|
+
return array;
|
484
|
+
};
|
485
|
+
Matrix4.unpack = function(array, startingIndex, result) {
|
486
|
+
Check_default.defined("array", array);
|
487
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
488
|
+
if (!defined_default(result)) {
|
489
|
+
result = new Matrix4();
|
490
|
+
}
|
491
|
+
result[0] = array[startingIndex++];
|
492
|
+
result[1] = array[startingIndex++];
|
493
|
+
result[2] = array[startingIndex++];
|
494
|
+
result[3] = array[startingIndex++];
|
495
|
+
result[4] = array[startingIndex++];
|
496
|
+
result[5] = array[startingIndex++];
|
497
|
+
result[6] = array[startingIndex++];
|
498
|
+
result[7] = array[startingIndex++];
|
499
|
+
result[8] = array[startingIndex++];
|
500
|
+
result[9] = array[startingIndex++];
|
501
|
+
result[10] = array[startingIndex++];
|
502
|
+
result[11] = array[startingIndex++];
|
503
|
+
result[12] = array[startingIndex++];
|
504
|
+
result[13] = array[startingIndex++];
|
505
|
+
result[14] = array[startingIndex++];
|
506
|
+
result[15] = array[startingIndex];
|
507
|
+
return result;
|
508
|
+
};
|
509
|
+
Matrix4.packArray = function(array, result) {
|
510
|
+
Check_default.defined("array", array);
|
511
|
+
const length = array.length;
|
512
|
+
const resultLength = length * 16;
|
513
|
+
if (!defined_default(result)) {
|
514
|
+
result = new Array(resultLength);
|
515
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
516
|
+
throw new DeveloperError_default(
|
517
|
+
"If result is a typed array, it must have exactly array.length * 16 elements"
|
518
|
+
);
|
519
|
+
} else if (result.length !== resultLength) {
|
520
|
+
result.length = resultLength;
|
521
|
+
}
|
522
|
+
for (let i = 0; i < length; ++i) {
|
523
|
+
Matrix4.pack(array[i], result, i * 16);
|
524
|
+
}
|
525
|
+
return result;
|
526
|
+
};
|
527
|
+
Matrix4.unpackArray = function(array, result) {
|
528
|
+
Check_default.defined("array", array);
|
529
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 16);
|
530
|
+
if (array.length % 16 !== 0) {
|
531
|
+
throw new DeveloperError_default("array length must be a multiple of 16.");
|
532
|
+
}
|
533
|
+
const length = array.length;
|
534
|
+
if (!defined_default(result)) {
|
535
|
+
result = new Array(length / 16);
|
536
|
+
} else {
|
537
|
+
result.length = length / 16;
|
538
|
+
}
|
539
|
+
for (let i = 0; i < length; i += 16) {
|
540
|
+
const index = i / 16;
|
541
|
+
result[index] = Matrix4.unpack(array, i, result[index]);
|
542
|
+
}
|
543
|
+
return result;
|
544
|
+
};
|
545
|
+
Matrix4.clone = function(matrix, result) {
|
546
|
+
if (!defined_default(matrix)) {
|
547
|
+
return void 0;
|
548
|
+
}
|
549
|
+
if (!defined_default(result)) {
|
550
|
+
return new Matrix4(
|
551
|
+
matrix[0],
|
552
|
+
matrix[4],
|
553
|
+
matrix[8],
|
554
|
+
matrix[12],
|
555
|
+
matrix[1],
|
556
|
+
matrix[5],
|
557
|
+
matrix[9],
|
558
|
+
matrix[13],
|
559
|
+
matrix[2],
|
560
|
+
matrix[6],
|
561
|
+
matrix[10],
|
562
|
+
matrix[14],
|
563
|
+
matrix[3],
|
564
|
+
matrix[7],
|
565
|
+
matrix[11],
|
566
|
+
matrix[15]
|
567
|
+
);
|
568
|
+
}
|
569
|
+
result[0] = matrix[0];
|
570
|
+
result[1] = matrix[1];
|
571
|
+
result[2] = matrix[2];
|
572
|
+
result[3] = matrix[3];
|
573
|
+
result[4] = matrix[4];
|
574
|
+
result[5] = matrix[5];
|
575
|
+
result[6] = matrix[6];
|
576
|
+
result[7] = matrix[7];
|
577
|
+
result[8] = matrix[8];
|
578
|
+
result[9] = matrix[9];
|
579
|
+
result[10] = matrix[10];
|
580
|
+
result[11] = matrix[11];
|
581
|
+
result[12] = matrix[12];
|
582
|
+
result[13] = matrix[13];
|
583
|
+
result[14] = matrix[14];
|
584
|
+
result[15] = matrix[15];
|
585
|
+
return result;
|
586
|
+
};
|
587
|
+
Matrix4.fromArray = Matrix4.unpack;
|
588
|
+
Matrix4.fromColumnMajorArray = function(values, result) {
|
589
|
+
Check_default.defined("values", values);
|
590
|
+
return Matrix4.clone(values, result);
|
591
|
+
};
|
592
|
+
Matrix4.fromRowMajorArray = function(values, result) {
|
593
|
+
Check_default.defined("values", values);
|
594
|
+
if (!defined_default(result)) {
|
595
|
+
return new Matrix4(
|
596
|
+
values[0],
|
597
|
+
values[1],
|
598
|
+
values[2],
|
599
|
+
values[3],
|
600
|
+
values[4],
|
601
|
+
values[5],
|
602
|
+
values[6],
|
603
|
+
values[7],
|
604
|
+
values[8],
|
605
|
+
values[9],
|
606
|
+
values[10],
|
607
|
+
values[11],
|
608
|
+
values[12],
|
609
|
+
values[13],
|
610
|
+
values[14],
|
611
|
+
values[15]
|
612
|
+
);
|
613
|
+
}
|
614
|
+
result[0] = values[0];
|
615
|
+
result[1] = values[4];
|
616
|
+
result[2] = values[8];
|
617
|
+
result[3] = values[12];
|
618
|
+
result[4] = values[1];
|
619
|
+
result[5] = values[5];
|
620
|
+
result[6] = values[9];
|
621
|
+
result[7] = values[13];
|
622
|
+
result[8] = values[2];
|
623
|
+
result[9] = values[6];
|
624
|
+
result[10] = values[10];
|
625
|
+
result[11] = values[14];
|
626
|
+
result[12] = values[3];
|
627
|
+
result[13] = values[7];
|
628
|
+
result[14] = values[11];
|
629
|
+
result[15] = values[15];
|
630
|
+
return result;
|
631
|
+
};
|
632
|
+
Matrix4.fromRotationTranslation = function(rotation, translation, result) {
|
633
|
+
Check_default.typeOf.object("rotation", rotation);
|
634
|
+
translation = defaultValue_default(translation, Cartesian3_default.ZERO);
|
635
|
+
if (!defined_default(result)) {
|
636
|
+
return new Matrix4(
|
637
|
+
rotation[0],
|
638
|
+
rotation[3],
|
639
|
+
rotation[6],
|
640
|
+
translation.x,
|
641
|
+
rotation[1],
|
642
|
+
rotation[4],
|
643
|
+
rotation[7],
|
644
|
+
translation.y,
|
645
|
+
rotation[2],
|
646
|
+
rotation[5],
|
647
|
+
rotation[8],
|
648
|
+
translation.z,
|
649
|
+
0,
|
650
|
+
0,
|
651
|
+
0,
|
652
|
+
1
|
653
|
+
);
|
654
|
+
}
|
655
|
+
result[0] = rotation[0];
|
656
|
+
result[1] = rotation[1];
|
657
|
+
result[2] = rotation[2];
|
658
|
+
result[3] = 0;
|
659
|
+
result[4] = rotation[3];
|
660
|
+
result[5] = rotation[4];
|
661
|
+
result[6] = rotation[5];
|
662
|
+
result[7] = 0;
|
663
|
+
result[8] = rotation[6];
|
664
|
+
result[9] = rotation[7];
|
665
|
+
result[10] = rotation[8];
|
666
|
+
result[11] = 0;
|
667
|
+
result[12] = translation.x;
|
668
|
+
result[13] = translation.y;
|
669
|
+
result[14] = translation.z;
|
670
|
+
result[15] = 1;
|
671
|
+
return result;
|
672
|
+
};
|
673
|
+
Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) {
|
674
|
+
Check_default.typeOf.object("translation", translation);
|
675
|
+
Check_default.typeOf.object("rotation", rotation);
|
676
|
+
Check_default.typeOf.object("scale", scale);
|
677
|
+
if (!defined_default(result)) {
|
678
|
+
result = new Matrix4();
|
679
|
+
}
|
680
|
+
const scaleX = scale.x;
|
681
|
+
const scaleY = scale.y;
|
682
|
+
const scaleZ = scale.z;
|
683
|
+
const x2 = rotation.x * rotation.x;
|
684
|
+
const xy = rotation.x * rotation.y;
|
685
|
+
const xz = rotation.x * rotation.z;
|
686
|
+
const xw = rotation.x * rotation.w;
|
687
|
+
const y2 = rotation.y * rotation.y;
|
688
|
+
const yz = rotation.y * rotation.z;
|
689
|
+
const yw = rotation.y * rotation.w;
|
690
|
+
const z2 = rotation.z * rotation.z;
|
691
|
+
const zw = rotation.z * rotation.w;
|
692
|
+
const w2 = rotation.w * rotation.w;
|
693
|
+
const m00 = x2 - y2 - z2 + w2;
|
694
|
+
const m01 = 2 * (xy - zw);
|
695
|
+
const m02 = 2 * (xz + yw);
|
696
|
+
const m10 = 2 * (xy + zw);
|
697
|
+
const m11 = -x2 + y2 - z2 + w2;
|
698
|
+
const m12 = 2 * (yz - xw);
|
699
|
+
const m20 = 2 * (xz - yw);
|
700
|
+
const m21 = 2 * (yz + xw);
|
701
|
+
const m22 = -x2 - y2 + z2 + w2;
|
702
|
+
result[0] = m00 * scaleX;
|
703
|
+
result[1] = m10 * scaleX;
|
704
|
+
result[2] = m20 * scaleX;
|
705
|
+
result[3] = 0;
|
706
|
+
result[4] = m01 * scaleY;
|
707
|
+
result[5] = m11 * scaleY;
|
708
|
+
result[6] = m21 * scaleY;
|
709
|
+
result[7] = 0;
|
710
|
+
result[8] = m02 * scaleZ;
|
711
|
+
result[9] = m12 * scaleZ;
|
712
|
+
result[10] = m22 * scaleZ;
|
713
|
+
result[11] = 0;
|
714
|
+
result[12] = translation.x;
|
715
|
+
result[13] = translation.y;
|
716
|
+
result[14] = translation.z;
|
717
|
+
result[15] = 1;
|
718
|
+
return result;
|
719
|
+
};
|
720
|
+
Matrix4.fromTranslationRotationScale = function(translationRotationScale, result) {
|
721
|
+
Check_default.typeOf.object("translationRotationScale", translationRotationScale);
|
722
|
+
return Matrix4.fromTranslationQuaternionRotationScale(
|
723
|
+
translationRotationScale.translation,
|
724
|
+
translationRotationScale.rotation,
|
725
|
+
translationRotationScale.scale,
|
726
|
+
result
|
727
|
+
);
|
728
|
+
};
|
729
|
+
Matrix4.fromTranslation = function(translation, result) {
|
730
|
+
Check_default.typeOf.object("translation", translation);
|
731
|
+
return Matrix4.fromRotationTranslation(Matrix3_default.IDENTITY, translation, result);
|
732
|
+
};
|
733
|
+
Matrix4.fromScale = function(scale, result) {
|
734
|
+
Check_default.typeOf.object("scale", scale);
|
735
|
+
if (!defined_default(result)) {
|
736
|
+
return new Matrix4(
|
737
|
+
scale.x,
|
738
|
+
0,
|
739
|
+
0,
|
740
|
+
0,
|
741
|
+
0,
|
742
|
+
scale.y,
|
743
|
+
0,
|
744
|
+
0,
|
745
|
+
0,
|
746
|
+
0,
|
747
|
+
scale.z,
|
748
|
+
0,
|
749
|
+
0,
|
750
|
+
0,
|
751
|
+
0,
|
752
|
+
1
|
753
|
+
);
|
754
|
+
}
|
755
|
+
result[0] = scale.x;
|
756
|
+
result[1] = 0;
|
757
|
+
result[2] = 0;
|
758
|
+
result[3] = 0;
|
759
|
+
result[4] = 0;
|
760
|
+
result[5] = scale.y;
|
761
|
+
result[6] = 0;
|
762
|
+
result[7] = 0;
|
763
|
+
result[8] = 0;
|
764
|
+
result[9] = 0;
|
765
|
+
result[10] = scale.z;
|
766
|
+
result[11] = 0;
|
767
|
+
result[12] = 0;
|
768
|
+
result[13] = 0;
|
769
|
+
result[14] = 0;
|
770
|
+
result[15] = 1;
|
771
|
+
return result;
|
772
|
+
};
|
773
|
+
Matrix4.fromUniformScale = function(scale, result) {
|
774
|
+
Check_default.typeOf.number("scale", scale);
|
775
|
+
if (!defined_default(result)) {
|
776
|
+
return new Matrix4(
|
777
|
+
scale,
|
778
|
+
0,
|
779
|
+
0,
|
780
|
+
0,
|
781
|
+
0,
|
782
|
+
scale,
|
783
|
+
0,
|
784
|
+
0,
|
785
|
+
0,
|
786
|
+
0,
|
787
|
+
scale,
|
788
|
+
0,
|
789
|
+
0,
|
790
|
+
0,
|
791
|
+
0,
|
792
|
+
1
|
793
|
+
);
|
794
|
+
}
|
795
|
+
result[0] = scale;
|
796
|
+
result[1] = 0;
|
797
|
+
result[2] = 0;
|
798
|
+
result[3] = 0;
|
799
|
+
result[4] = 0;
|
800
|
+
result[5] = scale;
|
801
|
+
result[6] = 0;
|
802
|
+
result[7] = 0;
|
803
|
+
result[8] = 0;
|
804
|
+
result[9] = 0;
|
805
|
+
result[10] = scale;
|
806
|
+
result[11] = 0;
|
807
|
+
result[12] = 0;
|
808
|
+
result[13] = 0;
|
809
|
+
result[14] = 0;
|
810
|
+
result[15] = 1;
|
811
|
+
return result;
|
812
|
+
};
|
813
|
+
Matrix4.fromRotation = function(rotation, result) {
|
814
|
+
Check_default.typeOf.object("rotation", rotation);
|
815
|
+
if (!defined_default(result)) {
|
816
|
+
result = new Matrix4();
|
817
|
+
}
|
818
|
+
result[0] = rotation[0];
|
819
|
+
result[1] = rotation[1];
|
820
|
+
result[2] = rotation[2];
|
821
|
+
result[3] = 0;
|
822
|
+
result[4] = rotation[3];
|
823
|
+
result[5] = rotation[4];
|
824
|
+
result[6] = rotation[5];
|
825
|
+
result[7] = 0;
|
826
|
+
result[8] = rotation[6];
|
827
|
+
result[9] = rotation[7];
|
828
|
+
result[10] = rotation[8];
|
829
|
+
result[11] = 0;
|
830
|
+
result[12] = 0;
|
831
|
+
result[13] = 0;
|
832
|
+
result[14] = 0;
|
833
|
+
result[15] = 1;
|
834
|
+
return result;
|
835
|
+
};
|
836
|
+
var fromCameraF = new Cartesian3_default();
|
837
|
+
var fromCameraR = new Cartesian3_default();
|
838
|
+
var fromCameraU = new Cartesian3_default();
|
839
|
+
Matrix4.fromCamera = function(camera, result) {
|
840
|
+
Check_default.typeOf.object("camera", camera);
|
841
|
+
const position = camera.position;
|
842
|
+
const direction = camera.direction;
|
843
|
+
const up = camera.up;
|
844
|
+
Check_default.typeOf.object("camera.position", position);
|
845
|
+
Check_default.typeOf.object("camera.direction", direction);
|
846
|
+
Check_default.typeOf.object("camera.up", up);
|
847
|
+
Cartesian3_default.normalize(direction, fromCameraF);
|
848
|
+
Cartesian3_default.normalize(
|
849
|
+
Cartesian3_default.cross(fromCameraF, up, fromCameraR),
|
850
|
+
fromCameraR
|
851
|
+
);
|
852
|
+
Cartesian3_default.normalize(
|
853
|
+
Cartesian3_default.cross(fromCameraR, fromCameraF, fromCameraU),
|
854
|
+
fromCameraU
|
855
|
+
);
|
856
|
+
const sX = fromCameraR.x;
|
857
|
+
const sY = fromCameraR.y;
|
858
|
+
const sZ = fromCameraR.z;
|
859
|
+
const fX = fromCameraF.x;
|
860
|
+
const fY = fromCameraF.y;
|
861
|
+
const fZ = fromCameraF.z;
|
862
|
+
const uX = fromCameraU.x;
|
863
|
+
const uY = fromCameraU.y;
|
864
|
+
const uZ = fromCameraU.z;
|
865
|
+
const positionX = position.x;
|
866
|
+
const positionY = position.y;
|
867
|
+
const positionZ = position.z;
|
868
|
+
const t0 = sX * -positionX + sY * -positionY + sZ * -positionZ;
|
869
|
+
const t1 = uX * -positionX + uY * -positionY + uZ * -positionZ;
|
870
|
+
const t2 = fX * positionX + fY * positionY + fZ * positionZ;
|
871
|
+
if (!defined_default(result)) {
|
872
|
+
return new Matrix4(
|
873
|
+
sX,
|
874
|
+
sY,
|
875
|
+
sZ,
|
876
|
+
t0,
|
877
|
+
uX,
|
878
|
+
uY,
|
879
|
+
uZ,
|
880
|
+
t1,
|
881
|
+
-fX,
|
882
|
+
-fY,
|
883
|
+
-fZ,
|
884
|
+
t2,
|
885
|
+
0,
|
886
|
+
0,
|
887
|
+
0,
|
888
|
+
1
|
889
|
+
);
|
890
|
+
}
|
891
|
+
result[0] = sX;
|
892
|
+
result[1] = uX;
|
893
|
+
result[2] = -fX;
|
894
|
+
result[3] = 0;
|
895
|
+
result[4] = sY;
|
896
|
+
result[5] = uY;
|
897
|
+
result[6] = -fY;
|
898
|
+
result[7] = 0;
|
899
|
+
result[8] = sZ;
|
900
|
+
result[9] = uZ;
|
901
|
+
result[10] = -fZ;
|
902
|
+
result[11] = 0;
|
903
|
+
result[12] = t0;
|
904
|
+
result[13] = t1;
|
905
|
+
result[14] = t2;
|
906
|
+
result[15] = 1;
|
907
|
+
return result;
|
908
|
+
};
|
909
|
+
Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
|
910
|
+
Check_default.typeOf.number.greaterThan("fovY", fovY, 0);
|
911
|
+
Check_default.typeOf.number.lessThan("fovY", fovY, Math.PI);
|
912
|
+
Check_default.typeOf.number.greaterThan("near", near, 0);
|
913
|
+
Check_default.typeOf.number.greaterThan("far", far, 0);
|
914
|
+
Check_default.typeOf.object("result", result);
|
915
|
+
const bottom = Math.tan(fovY * 0.5);
|
916
|
+
const column1Row1 = 1 / bottom;
|
917
|
+
const column0Row0 = column1Row1 / aspectRatio;
|
918
|
+
const column2Row2 = (far + near) / (near - far);
|
919
|
+
const column3Row2 = 2 * far * near / (near - far);
|
920
|
+
result[0] = column0Row0;
|
921
|
+
result[1] = 0;
|
922
|
+
result[2] = 0;
|
923
|
+
result[3] = 0;
|
924
|
+
result[4] = 0;
|
925
|
+
result[5] = column1Row1;
|
926
|
+
result[6] = 0;
|
927
|
+
result[7] = 0;
|
928
|
+
result[8] = 0;
|
929
|
+
result[9] = 0;
|
930
|
+
result[10] = column2Row2;
|
931
|
+
result[11] = -1;
|
932
|
+
result[12] = 0;
|
933
|
+
result[13] = 0;
|
934
|
+
result[14] = column3Row2;
|
935
|
+
result[15] = 0;
|
936
|
+
return result;
|
937
|
+
};
|
938
|
+
Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
|
939
|
+
Check_default.typeOf.number("left", left);
|
940
|
+
Check_default.typeOf.number("right", right);
|
941
|
+
Check_default.typeOf.number("bottom", bottom);
|
942
|
+
Check_default.typeOf.number("top", top);
|
943
|
+
Check_default.typeOf.number("near", near);
|
944
|
+
Check_default.typeOf.number("far", far);
|
945
|
+
Check_default.typeOf.object("result", result);
|
946
|
+
let a = 1 / (right - left);
|
947
|
+
let b = 1 / (top - bottom);
|
948
|
+
let c = 1 / (far - near);
|
949
|
+
const tx = -(right + left) * a;
|
950
|
+
const ty = -(top + bottom) * b;
|
951
|
+
const tz = -(far + near) * c;
|
952
|
+
a *= 2;
|
953
|
+
b *= 2;
|
954
|
+
c *= -2;
|
955
|
+
result[0] = a;
|
956
|
+
result[1] = 0;
|
957
|
+
result[2] = 0;
|
958
|
+
result[3] = 0;
|
959
|
+
result[4] = 0;
|
960
|
+
result[5] = b;
|
961
|
+
result[6] = 0;
|
962
|
+
result[7] = 0;
|
963
|
+
result[8] = 0;
|
964
|
+
result[9] = 0;
|
965
|
+
result[10] = c;
|
966
|
+
result[11] = 0;
|
967
|
+
result[12] = tx;
|
968
|
+
result[13] = ty;
|
969
|
+
result[14] = tz;
|
970
|
+
result[15] = 1;
|
971
|
+
return result;
|
972
|
+
};
|
973
|
+
Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
|
974
|
+
Check_default.typeOf.number("left", left);
|
975
|
+
Check_default.typeOf.number("right", right);
|
976
|
+
Check_default.typeOf.number("bottom", bottom);
|
977
|
+
Check_default.typeOf.number("top", top);
|
978
|
+
Check_default.typeOf.number("near", near);
|
979
|
+
Check_default.typeOf.number("far", far);
|
980
|
+
Check_default.typeOf.object("result", result);
|
981
|
+
const column0Row0 = 2 * near / (right - left);
|
982
|
+
const column1Row1 = 2 * near / (top - bottom);
|
983
|
+
const column2Row0 = (right + left) / (right - left);
|
984
|
+
const column2Row1 = (top + bottom) / (top - bottom);
|
985
|
+
const column2Row2 = -(far + near) / (far - near);
|
986
|
+
const column2Row3 = -1;
|
987
|
+
const column3Row2 = -2 * far * near / (far - near);
|
988
|
+
result[0] = column0Row0;
|
989
|
+
result[1] = 0;
|
990
|
+
result[2] = 0;
|
991
|
+
result[3] = 0;
|
992
|
+
result[4] = 0;
|
993
|
+
result[5] = column1Row1;
|
994
|
+
result[6] = 0;
|
995
|
+
result[7] = 0;
|
996
|
+
result[8] = column2Row0;
|
997
|
+
result[9] = column2Row1;
|
998
|
+
result[10] = column2Row2;
|
999
|
+
result[11] = column2Row3;
|
1000
|
+
result[12] = 0;
|
1001
|
+
result[13] = 0;
|
1002
|
+
result[14] = column3Row2;
|
1003
|
+
result[15] = 0;
|
1004
|
+
return result;
|
1005
|
+
};
|
1006
|
+
Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
|
1007
|
+
Check_default.typeOf.number("left", left);
|
1008
|
+
Check_default.typeOf.number("right", right);
|
1009
|
+
Check_default.typeOf.number("bottom", bottom);
|
1010
|
+
Check_default.typeOf.number("top", top);
|
1011
|
+
Check_default.typeOf.number("near", near);
|
1012
|
+
Check_default.typeOf.object("result", result);
|
1013
|
+
const column0Row0 = 2 * near / (right - left);
|
1014
|
+
const column1Row1 = 2 * near / (top - bottom);
|
1015
|
+
const column2Row0 = (right + left) / (right - left);
|
1016
|
+
const column2Row1 = (top + bottom) / (top - bottom);
|
1017
|
+
const column2Row2 = -1;
|
1018
|
+
const column2Row3 = -1;
|
1019
|
+
const column3Row2 = -2 * near;
|
1020
|
+
result[0] = column0Row0;
|
1021
|
+
result[1] = 0;
|
1022
|
+
result[2] = 0;
|
1023
|
+
result[3] = 0;
|
1024
|
+
result[4] = 0;
|
1025
|
+
result[5] = column1Row1;
|
1026
|
+
result[6] = 0;
|
1027
|
+
result[7] = 0;
|
1028
|
+
result[8] = column2Row0;
|
1029
|
+
result[9] = column2Row1;
|
1030
|
+
result[10] = column2Row2;
|
1031
|
+
result[11] = column2Row3;
|
1032
|
+
result[12] = 0;
|
1033
|
+
result[13] = 0;
|
1034
|
+
result[14] = column3Row2;
|
1035
|
+
result[15] = 0;
|
1036
|
+
return result;
|
1037
|
+
};
|
1038
|
+
Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
|
1039
|
+
if (!defined_default(result)) {
|
1040
|
+
result = new Matrix4();
|
1041
|
+
}
|
1042
|
+
viewport = defaultValue_default(viewport, defaultValue_default.EMPTY_OBJECT);
|
1043
|
+
const x = defaultValue_default(viewport.x, 0);
|
1044
|
+
const y = defaultValue_default(viewport.y, 0);
|
1045
|
+
const width = defaultValue_default(viewport.width, 0);
|
1046
|
+
const height = defaultValue_default(viewport.height, 0);
|
1047
|
+
nearDepthRange = defaultValue_default(nearDepthRange, 0);
|
1048
|
+
farDepthRange = defaultValue_default(farDepthRange, 1);
|
1049
|
+
const halfWidth = width * 0.5;
|
1050
|
+
const halfHeight = height * 0.5;
|
1051
|
+
const halfDepth = (farDepthRange - nearDepthRange) * 0.5;
|
1052
|
+
const column0Row0 = halfWidth;
|
1053
|
+
const column1Row1 = halfHeight;
|
1054
|
+
const column2Row2 = halfDepth;
|
1055
|
+
const column3Row0 = x + halfWidth;
|
1056
|
+
const column3Row1 = y + halfHeight;
|
1057
|
+
const column3Row2 = nearDepthRange + halfDepth;
|
1058
|
+
const column3Row3 = 1;
|
1059
|
+
result[0] = column0Row0;
|
1060
|
+
result[1] = 0;
|
1061
|
+
result[2] = 0;
|
1062
|
+
result[3] = 0;
|
1063
|
+
result[4] = 0;
|
1064
|
+
result[5] = column1Row1;
|
1065
|
+
result[6] = 0;
|
1066
|
+
result[7] = 0;
|
1067
|
+
result[8] = 0;
|
1068
|
+
result[9] = 0;
|
1069
|
+
result[10] = column2Row2;
|
1070
|
+
result[11] = 0;
|
1071
|
+
result[12] = column3Row0;
|
1072
|
+
result[13] = column3Row1;
|
1073
|
+
result[14] = column3Row2;
|
1074
|
+
result[15] = column3Row3;
|
1075
|
+
return result;
|
1076
|
+
};
|
1077
|
+
Matrix4.computeView = function(position, direction, up, right, result) {
|
1078
|
+
Check_default.typeOf.object("position", position);
|
1079
|
+
Check_default.typeOf.object("direction", direction);
|
1080
|
+
Check_default.typeOf.object("up", up);
|
1081
|
+
Check_default.typeOf.object("right", right);
|
1082
|
+
Check_default.typeOf.object("result", result);
|
1083
|
+
result[0] = right.x;
|
1084
|
+
result[1] = up.x;
|
1085
|
+
result[2] = -direction.x;
|
1086
|
+
result[3] = 0;
|
1087
|
+
result[4] = right.y;
|
1088
|
+
result[5] = up.y;
|
1089
|
+
result[6] = -direction.y;
|
1090
|
+
result[7] = 0;
|
1091
|
+
result[8] = right.z;
|
1092
|
+
result[9] = up.z;
|
1093
|
+
result[10] = -direction.z;
|
1094
|
+
result[11] = 0;
|
1095
|
+
result[12] = -Cartesian3_default.dot(right, position);
|
1096
|
+
result[13] = -Cartesian3_default.dot(up, position);
|
1097
|
+
result[14] = Cartesian3_default.dot(direction, position);
|
1098
|
+
result[15] = 1;
|
1099
|
+
return result;
|
1100
|
+
};
|
1101
|
+
Matrix4.toArray = function(matrix, result) {
|
1102
|
+
Check_default.typeOf.object("matrix", matrix);
|
1103
|
+
if (!defined_default(result)) {
|
1104
|
+
return [
|
1105
|
+
matrix[0],
|
1106
|
+
matrix[1],
|
1107
|
+
matrix[2],
|
1108
|
+
matrix[3],
|
1109
|
+
matrix[4],
|
1110
|
+
matrix[5],
|
1111
|
+
matrix[6],
|
1112
|
+
matrix[7],
|
1113
|
+
matrix[8],
|
1114
|
+
matrix[9],
|
1115
|
+
matrix[10],
|
1116
|
+
matrix[11],
|
1117
|
+
matrix[12],
|
1118
|
+
matrix[13],
|
1119
|
+
matrix[14],
|
1120
|
+
matrix[15]
|
1121
|
+
];
|
1122
|
+
}
|
1123
|
+
result[0] = matrix[0];
|
1124
|
+
result[1] = matrix[1];
|
1125
|
+
result[2] = matrix[2];
|
1126
|
+
result[3] = matrix[3];
|
1127
|
+
result[4] = matrix[4];
|
1128
|
+
result[5] = matrix[5];
|
1129
|
+
result[6] = matrix[6];
|
1130
|
+
result[7] = matrix[7];
|
1131
|
+
result[8] = matrix[8];
|
1132
|
+
result[9] = matrix[9];
|
1133
|
+
result[10] = matrix[10];
|
1134
|
+
result[11] = matrix[11];
|
1135
|
+
result[12] = matrix[12];
|
1136
|
+
result[13] = matrix[13];
|
1137
|
+
result[14] = matrix[14];
|
1138
|
+
result[15] = matrix[15];
|
1139
|
+
return result;
|
1140
|
+
};
|
1141
|
+
Matrix4.getElementIndex = function(column, row) {
|
1142
|
+
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
1143
|
+
Check_default.typeOf.number.lessThanOrEquals("row", row, 3);
|
1144
|
+
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
1145
|
+
Check_default.typeOf.number.lessThanOrEquals("column", column, 3);
|
1146
|
+
return column * 4 + row;
|
1147
|
+
};
|
1148
|
+
Matrix4.getColumn = function(matrix, index, result) {
|
1149
|
+
Check_default.typeOf.object("matrix", matrix);
|
1150
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
1151
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
1152
|
+
Check_default.typeOf.object("result", result);
|
1153
|
+
const startIndex = index * 4;
|
1154
|
+
const x = matrix[startIndex];
|
1155
|
+
const y = matrix[startIndex + 1];
|
1156
|
+
const z = matrix[startIndex + 2];
|
1157
|
+
const w = matrix[startIndex + 3];
|
1158
|
+
result.x = x;
|
1159
|
+
result.y = y;
|
1160
|
+
result.z = z;
|
1161
|
+
result.w = w;
|
1162
|
+
return result;
|
1163
|
+
};
|
1164
|
+
Matrix4.setColumn = function(matrix, index, cartesian, result) {
|
1165
|
+
Check_default.typeOf.object("matrix", matrix);
|
1166
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
1167
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
1168
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
1169
|
+
Check_default.typeOf.object("result", result);
|
1170
|
+
result = Matrix4.clone(matrix, result);
|
1171
|
+
const startIndex = index * 4;
|
1172
|
+
result[startIndex] = cartesian.x;
|
1173
|
+
result[startIndex + 1] = cartesian.y;
|
1174
|
+
result[startIndex + 2] = cartesian.z;
|
1175
|
+
result[startIndex + 3] = cartesian.w;
|
1176
|
+
return result;
|
1177
|
+
};
|
1178
|
+
Matrix4.getRow = function(matrix, index, result) {
|
1179
|
+
Check_default.typeOf.object("matrix", matrix);
|
1180
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
1181
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
1182
|
+
Check_default.typeOf.object("result", result);
|
1183
|
+
const x = matrix[index];
|
1184
|
+
const y = matrix[index + 4];
|
1185
|
+
const z = matrix[index + 8];
|
1186
|
+
const w = matrix[index + 12];
|
1187
|
+
result.x = x;
|
1188
|
+
result.y = y;
|
1189
|
+
result.z = z;
|
1190
|
+
result.w = w;
|
1191
|
+
return result;
|
1192
|
+
};
|
1193
|
+
Matrix4.setRow = function(matrix, index, cartesian, result) {
|
1194
|
+
Check_default.typeOf.object("matrix", matrix);
|
1195
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
1196
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
1197
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
1198
|
+
Check_default.typeOf.object("result", result);
|
1199
|
+
result = Matrix4.clone(matrix, result);
|
1200
|
+
result[index] = cartesian.x;
|
1201
|
+
result[index + 4] = cartesian.y;
|
1202
|
+
result[index + 8] = cartesian.z;
|
1203
|
+
result[index + 12] = cartesian.w;
|
1204
|
+
return result;
|
1205
|
+
};
|
1206
|
+
Matrix4.setTranslation = function(matrix, translation, result) {
|
1207
|
+
Check_default.typeOf.object("matrix", matrix);
|
1208
|
+
Check_default.typeOf.object("translation", translation);
|
1209
|
+
Check_default.typeOf.object("result", result);
|
1210
|
+
result[0] = matrix[0];
|
1211
|
+
result[1] = matrix[1];
|
1212
|
+
result[2] = matrix[2];
|
1213
|
+
result[3] = matrix[3];
|
1214
|
+
result[4] = matrix[4];
|
1215
|
+
result[5] = matrix[5];
|
1216
|
+
result[6] = matrix[6];
|
1217
|
+
result[7] = matrix[7];
|
1218
|
+
result[8] = matrix[8];
|
1219
|
+
result[9] = matrix[9];
|
1220
|
+
result[10] = matrix[10];
|
1221
|
+
result[11] = matrix[11];
|
1222
|
+
result[12] = translation.x;
|
1223
|
+
result[13] = translation.y;
|
1224
|
+
result[14] = translation.z;
|
1225
|
+
result[15] = matrix[15];
|
1226
|
+
return result;
|
1227
|
+
};
|
1228
|
+
var scaleScratch1 = new Cartesian3_default();
|
1229
|
+
Matrix4.setScale = function(matrix, scale, result) {
|
1230
|
+
Check_default.typeOf.object("matrix", matrix);
|
1231
|
+
Check_default.typeOf.object("scale", scale);
|
1232
|
+
Check_default.typeOf.object("result", result);
|
1233
|
+
const existingScale = Matrix4.getScale(matrix, scaleScratch1);
|
1234
|
+
const scaleRatioX = scale.x / existingScale.x;
|
1235
|
+
const scaleRatioY = scale.y / existingScale.y;
|
1236
|
+
const scaleRatioZ = scale.z / existingScale.z;
|
1237
|
+
result[0] = matrix[0] * scaleRatioX;
|
1238
|
+
result[1] = matrix[1] * scaleRatioX;
|
1239
|
+
result[2] = matrix[2] * scaleRatioX;
|
1240
|
+
result[3] = matrix[3];
|
1241
|
+
result[4] = matrix[4] * scaleRatioY;
|
1242
|
+
result[5] = matrix[5] * scaleRatioY;
|
1243
|
+
result[6] = matrix[6] * scaleRatioY;
|
1244
|
+
result[7] = matrix[7];
|
1245
|
+
result[8] = matrix[8] * scaleRatioZ;
|
1246
|
+
result[9] = matrix[9] * scaleRatioZ;
|
1247
|
+
result[10] = matrix[10] * scaleRatioZ;
|
1248
|
+
result[11] = matrix[11];
|
1249
|
+
result[12] = matrix[12];
|
1250
|
+
result[13] = matrix[13];
|
1251
|
+
result[14] = matrix[14];
|
1252
|
+
result[15] = matrix[15];
|
1253
|
+
return result;
|
1254
|
+
};
|
1255
|
+
var scaleScratch2 = new Cartesian3_default();
|
1256
|
+
Matrix4.setUniformScale = function(matrix, scale, result) {
|
1257
|
+
Check_default.typeOf.object("matrix", matrix);
|
1258
|
+
Check_default.typeOf.number("scale", scale);
|
1259
|
+
Check_default.typeOf.object("result", result);
|
1260
|
+
const existingScale = Matrix4.getScale(matrix, scaleScratch2);
|
1261
|
+
const scaleRatioX = scale / existingScale.x;
|
1262
|
+
const scaleRatioY = scale / existingScale.y;
|
1263
|
+
const scaleRatioZ = scale / existingScale.z;
|
1264
|
+
result[0] = matrix[0] * scaleRatioX;
|
1265
|
+
result[1] = matrix[1] * scaleRatioX;
|
1266
|
+
result[2] = matrix[2] * scaleRatioX;
|
1267
|
+
result[3] = matrix[3];
|
1268
|
+
result[4] = matrix[4] * scaleRatioY;
|
1269
|
+
result[5] = matrix[5] * scaleRatioY;
|
1270
|
+
result[6] = matrix[6] * scaleRatioY;
|
1271
|
+
result[7] = matrix[7];
|
1272
|
+
result[8] = matrix[8] * scaleRatioZ;
|
1273
|
+
result[9] = matrix[9] * scaleRatioZ;
|
1274
|
+
result[10] = matrix[10] * scaleRatioZ;
|
1275
|
+
result[11] = matrix[11];
|
1276
|
+
result[12] = matrix[12];
|
1277
|
+
result[13] = matrix[13];
|
1278
|
+
result[14] = matrix[14];
|
1279
|
+
result[15] = matrix[15];
|
1280
|
+
return result;
|
1281
|
+
};
|
1282
|
+
var scratchColumn = new Cartesian3_default();
|
1283
|
+
Matrix4.getScale = function(matrix, result) {
|
1284
|
+
Check_default.typeOf.object("matrix", matrix);
|
1285
|
+
Check_default.typeOf.object("result", result);
|
1286
|
+
result.x = Cartesian3_default.magnitude(
|
1287
|
+
Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
|
1288
|
+
);
|
1289
|
+
result.y = Cartesian3_default.magnitude(
|
1290
|
+
Cartesian3_default.fromElements(matrix[4], matrix[5], matrix[6], scratchColumn)
|
1291
|
+
);
|
1292
|
+
result.z = Cartesian3_default.magnitude(
|
1293
|
+
Cartesian3_default.fromElements(matrix[8], matrix[9], matrix[10], scratchColumn)
|
1294
|
+
);
|
1295
|
+
return result;
|
1296
|
+
};
|
1297
|
+
var scaleScratch3 = new Cartesian3_default();
|
1298
|
+
Matrix4.getMaximumScale = function(matrix) {
|
1299
|
+
Matrix4.getScale(matrix, scaleScratch3);
|
1300
|
+
return Cartesian3_default.maximumComponent(scaleScratch3);
|
1301
|
+
};
|
1302
|
+
var scaleScratch4 = new Cartesian3_default();
|
1303
|
+
Matrix4.setRotation = function(matrix, rotation, result) {
|
1304
|
+
Check_default.typeOf.object("matrix", matrix);
|
1305
|
+
Check_default.typeOf.object("result", result);
|
1306
|
+
const scale = Matrix4.getScale(matrix, scaleScratch4);
|
1307
|
+
result[0] = rotation[0] * scale.x;
|
1308
|
+
result[1] = rotation[1] * scale.x;
|
1309
|
+
result[2] = rotation[2] * scale.x;
|
1310
|
+
result[3] = matrix[3];
|
1311
|
+
result[4] = rotation[3] * scale.y;
|
1312
|
+
result[5] = rotation[4] * scale.y;
|
1313
|
+
result[6] = rotation[5] * scale.y;
|
1314
|
+
result[7] = matrix[7];
|
1315
|
+
result[8] = rotation[6] * scale.z;
|
1316
|
+
result[9] = rotation[7] * scale.z;
|
1317
|
+
result[10] = rotation[8] * scale.z;
|
1318
|
+
result[11] = matrix[11];
|
1319
|
+
result[12] = matrix[12];
|
1320
|
+
result[13] = matrix[13];
|
1321
|
+
result[14] = matrix[14];
|
1322
|
+
result[15] = matrix[15];
|
1323
|
+
return result;
|
1324
|
+
};
|
1325
|
+
var scaleScratch5 = new Cartesian3_default();
|
1326
|
+
Matrix4.getRotation = function(matrix, result) {
|
1327
|
+
Check_default.typeOf.object("matrix", matrix);
|
1328
|
+
Check_default.typeOf.object("result", result);
|
1329
|
+
const scale = Matrix4.getScale(matrix, scaleScratch5);
|
1330
|
+
result[0] = matrix[0] / scale.x;
|
1331
|
+
result[1] = matrix[1] / scale.x;
|
1332
|
+
result[2] = matrix[2] / scale.x;
|
1333
|
+
result[3] = matrix[4] / scale.y;
|
1334
|
+
result[4] = matrix[5] / scale.y;
|
1335
|
+
result[5] = matrix[6] / scale.y;
|
1336
|
+
result[6] = matrix[8] / scale.z;
|
1337
|
+
result[7] = matrix[9] / scale.z;
|
1338
|
+
result[8] = matrix[10] / scale.z;
|
1339
|
+
return result;
|
1340
|
+
};
|
1341
|
+
Matrix4.multiply = function(left, right, result) {
|
1342
|
+
Check_default.typeOf.object("left", left);
|
1343
|
+
Check_default.typeOf.object("right", right);
|
1344
|
+
Check_default.typeOf.object("result", result);
|
1345
|
+
const left0 = left[0];
|
1346
|
+
const left1 = left[1];
|
1347
|
+
const left2 = left[2];
|
1348
|
+
const left3 = left[3];
|
1349
|
+
const left4 = left[4];
|
1350
|
+
const left5 = left[5];
|
1351
|
+
const left6 = left[6];
|
1352
|
+
const left7 = left[7];
|
1353
|
+
const left8 = left[8];
|
1354
|
+
const left9 = left[9];
|
1355
|
+
const left10 = left[10];
|
1356
|
+
const left11 = left[11];
|
1357
|
+
const left12 = left[12];
|
1358
|
+
const left13 = left[13];
|
1359
|
+
const left14 = left[14];
|
1360
|
+
const left15 = left[15];
|
1361
|
+
const right0 = right[0];
|
1362
|
+
const right1 = right[1];
|
1363
|
+
const right2 = right[2];
|
1364
|
+
const right3 = right[3];
|
1365
|
+
const right4 = right[4];
|
1366
|
+
const right5 = right[5];
|
1367
|
+
const right6 = right[6];
|
1368
|
+
const right7 = right[7];
|
1369
|
+
const right8 = right[8];
|
1370
|
+
const right9 = right[9];
|
1371
|
+
const right10 = right[10];
|
1372
|
+
const right11 = right[11];
|
1373
|
+
const right12 = right[12];
|
1374
|
+
const right13 = right[13];
|
1375
|
+
const right14 = right[14];
|
1376
|
+
const right15 = right[15];
|
1377
|
+
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
|
1378
|
+
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
|
1379
|
+
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
|
1380
|
+
const column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
|
1381
|
+
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
|
1382
|
+
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
|
1383
|
+
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
|
1384
|
+
const column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
|
1385
|
+
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
|
1386
|
+
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
|
1387
|
+
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
|
1388
|
+
const column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
|
1389
|
+
const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
|
1390
|
+
const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
|
1391
|
+
const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
|
1392
|
+
const column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
|
1393
|
+
result[0] = column0Row0;
|
1394
|
+
result[1] = column0Row1;
|
1395
|
+
result[2] = column0Row2;
|
1396
|
+
result[3] = column0Row3;
|
1397
|
+
result[4] = column1Row0;
|
1398
|
+
result[5] = column1Row1;
|
1399
|
+
result[6] = column1Row2;
|
1400
|
+
result[7] = column1Row3;
|
1401
|
+
result[8] = column2Row0;
|
1402
|
+
result[9] = column2Row1;
|
1403
|
+
result[10] = column2Row2;
|
1404
|
+
result[11] = column2Row3;
|
1405
|
+
result[12] = column3Row0;
|
1406
|
+
result[13] = column3Row1;
|
1407
|
+
result[14] = column3Row2;
|
1408
|
+
result[15] = column3Row3;
|
1409
|
+
return result;
|
1410
|
+
};
|
1411
|
+
Matrix4.add = function(left, right, result) {
|
1412
|
+
Check_default.typeOf.object("left", left);
|
1413
|
+
Check_default.typeOf.object("right", right);
|
1414
|
+
Check_default.typeOf.object("result", result);
|
1415
|
+
result[0] = left[0] + right[0];
|
1416
|
+
result[1] = left[1] + right[1];
|
1417
|
+
result[2] = left[2] + right[2];
|
1418
|
+
result[3] = left[3] + right[3];
|
1419
|
+
result[4] = left[4] + right[4];
|
1420
|
+
result[5] = left[5] + right[5];
|
1421
|
+
result[6] = left[6] + right[6];
|
1422
|
+
result[7] = left[7] + right[7];
|
1423
|
+
result[8] = left[8] + right[8];
|
1424
|
+
result[9] = left[9] + right[9];
|
1425
|
+
result[10] = left[10] + right[10];
|
1426
|
+
result[11] = left[11] + right[11];
|
1427
|
+
result[12] = left[12] + right[12];
|
1428
|
+
result[13] = left[13] + right[13];
|
1429
|
+
result[14] = left[14] + right[14];
|
1430
|
+
result[15] = left[15] + right[15];
|
1431
|
+
return result;
|
1432
|
+
};
|
1433
|
+
Matrix4.subtract = function(left, right, result) {
|
1434
|
+
Check_default.typeOf.object("left", left);
|
1435
|
+
Check_default.typeOf.object("right", right);
|
1436
|
+
Check_default.typeOf.object("result", result);
|
1437
|
+
result[0] = left[0] - right[0];
|
1438
|
+
result[1] = left[1] - right[1];
|
1439
|
+
result[2] = left[2] - right[2];
|
1440
|
+
result[3] = left[3] - right[3];
|
1441
|
+
result[4] = left[4] - right[4];
|
1442
|
+
result[5] = left[5] - right[5];
|
1443
|
+
result[6] = left[6] - right[6];
|
1444
|
+
result[7] = left[7] - right[7];
|
1445
|
+
result[8] = left[8] - right[8];
|
1446
|
+
result[9] = left[9] - right[9];
|
1447
|
+
result[10] = left[10] - right[10];
|
1448
|
+
result[11] = left[11] - right[11];
|
1449
|
+
result[12] = left[12] - right[12];
|
1450
|
+
result[13] = left[13] - right[13];
|
1451
|
+
result[14] = left[14] - right[14];
|
1452
|
+
result[15] = left[15] - right[15];
|
1453
|
+
return result;
|
1454
|
+
};
|
1455
|
+
Matrix4.multiplyTransformation = function(left, right, result) {
|
1456
|
+
Check_default.typeOf.object("left", left);
|
1457
|
+
Check_default.typeOf.object("right", right);
|
1458
|
+
Check_default.typeOf.object("result", result);
|
1459
|
+
const left0 = left[0];
|
1460
|
+
const left1 = left[1];
|
1461
|
+
const left2 = left[2];
|
1462
|
+
const left4 = left[4];
|
1463
|
+
const left5 = left[5];
|
1464
|
+
const left6 = left[6];
|
1465
|
+
const left8 = left[8];
|
1466
|
+
const left9 = left[9];
|
1467
|
+
const left10 = left[10];
|
1468
|
+
const left12 = left[12];
|
1469
|
+
const left13 = left[13];
|
1470
|
+
const left14 = left[14];
|
1471
|
+
const right0 = right[0];
|
1472
|
+
const right1 = right[1];
|
1473
|
+
const right2 = right[2];
|
1474
|
+
const right4 = right[4];
|
1475
|
+
const right5 = right[5];
|
1476
|
+
const right6 = right[6];
|
1477
|
+
const right8 = right[8];
|
1478
|
+
const right9 = right[9];
|
1479
|
+
const right10 = right[10];
|
1480
|
+
const right12 = right[12];
|
1481
|
+
const right13 = right[13];
|
1482
|
+
const right14 = right[14];
|
1483
|
+
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
|
1484
|
+
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
|
1485
|
+
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
|
1486
|
+
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
|
1487
|
+
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
|
1488
|
+
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
|
1489
|
+
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
|
1490
|
+
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
|
1491
|
+
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
|
1492
|
+
const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12;
|
1493
|
+
const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13;
|
1494
|
+
const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14;
|
1495
|
+
result[0] = column0Row0;
|
1496
|
+
result[1] = column0Row1;
|
1497
|
+
result[2] = column0Row2;
|
1498
|
+
result[3] = 0;
|
1499
|
+
result[4] = column1Row0;
|
1500
|
+
result[5] = column1Row1;
|
1501
|
+
result[6] = column1Row2;
|
1502
|
+
result[7] = 0;
|
1503
|
+
result[8] = column2Row0;
|
1504
|
+
result[9] = column2Row1;
|
1505
|
+
result[10] = column2Row2;
|
1506
|
+
result[11] = 0;
|
1507
|
+
result[12] = column3Row0;
|
1508
|
+
result[13] = column3Row1;
|
1509
|
+
result[14] = column3Row2;
|
1510
|
+
result[15] = 1;
|
1511
|
+
return result;
|
1512
|
+
};
|
1513
|
+
Matrix4.multiplyByMatrix3 = function(matrix, rotation, result) {
|
1514
|
+
Check_default.typeOf.object("matrix", matrix);
|
1515
|
+
Check_default.typeOf.object("rotation", rotation);
|
1516
|
+
Check_default.typeOf.object("result", result);
|
1517
|
+
const left0 = matrix[0];
|
1518
|
+
const left1 = matrix[1];
|
1519
|
+
const left2 = matrix[2];
|
1520
|
+
const left4 = matrix[4];
|
1521
|
+
const left5 = matrix[5];
|
1522
|
+
const left6 = matrix[6];
|
1523
|
+
const left8 = matrix[8];
|
1524
|
+
const left9 = matrix[9];
|
1525
|
+
const left10 = matrix[10];
|
1526
|
+
const right0 = rotation[0];
|
1527
|
+
const right1 = rotation[1];
|
1528
|
+
const right2 = rotation[2];
|
1529
|
+
const right4 = rotation[3];
|
1530
|
+
const right5 = rotation[4];
|
1531
|
+
const right6 = rotation[5];
|
1532
|
+
const right8 = rotation[6];
|
1533
|
+
const right9 = rotation[7];
|
1534
|
+
const right10 = rotation[8];
|
1535
|
+
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
|
1536
|
+
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
|
1537
|
+
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
|
1538
|
+
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
|
1539
|
+
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
|
1540
|
+
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
|
1541
|
+
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
|
1542
|
+
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
|
1543
|
+
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
|
1544
|
+
result[0] = column0Row0;
|
1545
|
+
result[1] = column0Row1;
|
1546
|
+
result[2] = column0Row2;
|
1547
|
+
result[3] = 0;
|
1548
|
+
result[4] = column1Row0;
|
1549
|
+
result[5] = column1Row1;
|
1550
|
+
result[6] = column1Row2;
|
1551
|
+
result[7] = 0;
|
1552
|
+
result[8] = column2Row0;
|
1553
|
+
result[9] = column2Row1;
|
1554
|
+
result[10] = column2Row2;
|
1555
|
+
result[11] = 0;
|
1556
|
+
result[12] = matrix[12];
|
1557
|
+
result[13] = matrix[13];
|
1558
|
+
result[14] = matrix[14];
|
1559
|
+
result[15] = matrix[15];
|
1560
|
+
return result;
|
1561
|
+
};
|
1562
|
+
Matrix4.multiplyByTranslation = function(matrix, translation, result) {
|
1563
|
+
Check_default.typeOf.object("matrix", matrix);
|
1564
|
+
Check_default.typeOf.object("translation", translation);
|
1565
|
+
Check_default.typeOf.object("result", result);
|
1566
|
+
const x = translation.x;
|
1567
|
+
const y = translation.y;
|
1568
|
+
const z = translation.z;
|
1569
|
+
const tx = x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12];
|
1570
|
+
const ty = x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13];
|
1571
|
+
const tz = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14];
|
1572
|
+
result[0] = matrix[0];
|
1573
|
+
result[1] = matrix[1];
|
1574
|
+
result[2] = matrix[2];
|
1575
|
+
result[3] = matrix[3];
|
1576
|
+
result[4] = matrix[4];
|
1577
|
+
result[5] = matrix[5];
|
1578
|
+
result[6] = matrix[6];
|
1579
|
+
result[7] = matrix[7];
|
1580
|
+
result[8] = matrix[8];
|
1581
|
+
result[9] = matrix[9];
|
1582
|
+
result[10] = matrix[10];
|
1583
|
+
result[11] = matrix[11];
|
1584
|
+
result[12] = tx;
|
1585
|
+
result[13] = ty;
|
1586
|
+
result[14] = tz;
|
1587
|
+
result[15] = matrix[15];
|
1588
|
+
return result;
|
1589
|
+
};
|
1590
|
+
Matrix4.multiplyByScale = function(matrix, scale, result) {
|
1591
|
+
Check_default.typeOf.object("matrix", matrix);
|
1592
|
+
Check_default.typeOf.object("scale", scale);
|
1593
|
+
Check_default.typeOf.object("result", result);
|
1594
|
+
const scaleX = scale.x;
|
1595
|
+
const scaleY = scale.y;
|
1596
|
+
const scaleZ = scale.z;
|
1597
|
+
if (scaleX === 1 && scaleY === 1 && scaleZ === 1) {
|
1598
|
+
return Matrix4.clone(matrix, result);
|
1599
|
+
}
|
1600
|
+
result[0] = scaleX * matrix[0];
|
1601
|
+
result[1] = scaleX * matrix[1];
|
1602
|
+
result[2] = scaleX * matrix[2];
|
1603
|
+
result[3] = matrix[3];
|
1604
|
+
result[4] = scaleY * matrix[4];
|
1605
|
+
result[5] = scaleY * matrix[5];
|
1606
|
+
result[6] = scaleY * matrix[6];
|
1607
|
+
result[7] = matrix[7];
|
1608
|
+
result[8] = scaleZ * matrix[8];
|
1609
|
+
result[9] = scaleZ * matrix[9];
|
1610
|
+
result[10] = scaleZ * matrix[10];
|
1611
|
+
result[11] = matrix[11];
|
1612
|
+
result[12] = matrix[12];
|
1613
|
+
result[13] = matrix[13];
|
1614
|
+
result[14] = matrix[14];
|
1615
|
+
result[15] = matrix[15];
|
1616
|
+
return result;
|
1617
|
+
};
|
1618
|
+
Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
|
1619
|
+
Check_default.typeOf.object("matrix", matrix);
|
1620
|
+
Check_default.typeOf.number("scale", scale);
|
1621
|
+
Check_default.typeOf.object("result", result);
|
1622
|
+
result[0] = matrix[0] * scale;
|
1623
|
+
result[1] = matrix[1] * scale;
|
1624
|
+
result[2] = matrix[2] * scale;
|
1625
|
+
result[3] = matrix[3];
|
1626
|
+
result[4] = matrix[4] * scale;
|
1627
|
+
result[5] = matrix[5] * scale;
|
1628
|
+
result[6] = matrix[6] * scale;
|
1629
|
+
result[7] = matrix[7];
|
1630
|
+
result[8] = matrix[8] * scale;
|
1631
|
+
result[9] = matrix[9] * scale;
|
1632
|
+
result[10] = matrix[10] * scale;
|
1633
|
+
result[11] = matrix[11];
|
1634
|
+
result[12] = matrix[12];
|
1635
|
+
result[13] = matrix[13];
|
1636
|
+
result[14] = matrix[14];
|
1637
|
+
result[15] = matrix[15];
|
1638
|
+
return result;
|
1639
|
+
};
|
1640
|
+
Matrix4.multiplyByVector = function(matrix, cartesian, result) {
|
1641
|
+
Check_default.typeOf.object("matrix", matrix);
|
1642
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
1643
|
+
Check_default.typeOf.object("result", result);
|
1644
|
+
const vX = cartesian.x;
|
1645
|
+
const vY = cartesian.y;
|
1646
|
+
const vZ = cartesian.z;
|
1647
|
+
const vW = cartesian.w;
|
1648
|
+
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
|
1649
|
+
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
|
1650
|
+
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
|
1651
|
+
const w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
|
1652
|
+
result.x = x;
|
1653
|
+
result.y = y;
|
1654
|
+
result.z = z;
|
1655
|
+
result.w = w;
|
1656
|
+
return result;
|
1657
|
+
};
|
1658
|
+
Matrix4.multiplyByPointAsVector = function(matrix, cartesian, result) {
|
1659
|
+
Check_default.typeOf.object("matrix", matrix);
|
1660
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
1661
|
+
Check_default.typeOf.object("result", result);
|
1662
|
+
const vX = cartesian.x;
|
1663
|
+
const vY = cartesian.y;
|
1664
|
+
const vZ = cartesian.z;
|
1665
|
+
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ;
|
1666
|
+
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ;
|
1667
|
+
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ;
|
1668
|
+
result.x = x;
|
1669
|
+
result.y = y;
|
1670
|
+
result.z = z;
|
1671
|
+
return result;
|
1672
|
+
};
|
1673
|
+
Matrix4.multiplyByPoint = function(matrix, cartesian, result) {
|
1674
|
+
Check_default.typeOf.object("matrix", matrix);
|
1675
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
1676
|
+
Check_default.typeOf.object("result", result);
|
1677
|
+
const vX = cartesian.x;
|
1678
|
+
const vY = cartesian.y;
|
1679
|
+
const vZ = cartesian.z;
|
1680
|
+
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12];
|
1681
|
+
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13];
|
1682
|
+
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14];
|
1683
|
+
result.x = x;
|
1684
|
+
result.y = y;
|
1685
|
+
result.z = z;
|
1686
|
+
return result;
|
1687
|
+
};
|
1688
|
+
Matrix4.multiplyByScalar = function(matrix, scalar, result) {
|
1689
|
+
Check_default.typeOf.object("matrix", matrix);
|
1690
|
+
Check_default.typeOf.number("scalar", scalar);
|
1691
|
+
Check_default.typeOf.object("result", result);
|
1692
|
+
result[0] = matrix[0] * scalar;
|
1693
|
+
result[1] = matrix[1] * scalar;
|
1694
|
+
result[2] = matrix[2] * scalar;
|
1695
|
+
result[3] = matrix[3] * scalar;
|
1696
|
+
result[4] = matrix[4] * scalar;
|
1697
|
+
result[5] = matrix[5] * scalar;
|
1698
|
+
result[6] = matrix[6] * scalar;
|
1699
|
+
result[7] = matrix[7] * scalar;
|
1700
|
+
result[8] = matrix[8] * scalar;
|
1701
|
+
result[9] = matrix[9] * scalar;
|
1702
|
+
result[10] = matrix[10] * scalar;
|
1703
|
+
result[11] = matrix[11] * scalar;
|
1704
|
+
result[12] = matrix[12] * scalar;
|
1705
|
+
result[13] = matrix[13] * scalar;
|
1706
|
+
result[14] = matrix[14] * scalar;
|
1707
|
+
result[15] = matrix[15] * scalar;
|
1708
|
+
return result;
|
1709
|
+
};
|
1710
|
+
Matrix4.negate = function(matrix, result) {
|
1711
|
+
Check_default.typeOf.object("matrix", matrix);
|
1712
|
+
Check_default.typeOf.object("result", result);
|
1713
|
+
result[0] = -matrix[0];
|
1714
|
+
result[1] = -matrix[1];
|
1715
|
+
result[2] = -matrix[2];
|
1716
|
+
result[3] = -matrix[3];
|
1717
|
+
result[4] = -matrix[4];
|
1718
|
+
result[5] = -matrix[5];
|
1719
|
+
result[6] = -matrix[6];
|
1720
|
+
result[7] = -matrix[7];
|
1721
|
+
result[8] = -matrix[8];
|
1722
|
+
result[9] = -matrix[9];
|
1723
|
+
result[10] = -matrix[10];
|
1724
|
+
result[11] = -matrix[11];
|
1725
|
+
result[12] = -matrix[12];
|
1726
|
+
result[13] = -matrix[13];
|
1727
|
+
result[14] = -matrix[14];
|
1728
|
+
result[15] = -matrix[15];
|
1729
|
+
return result;
|
1730
|
+
};
|
1731
|
+
Matrix4.transpose = function(matrix, result) {
|
1732
|
+
Check_default.typeOf.object("matrix", matrix);
|
1733
|
+
Check_default.typeOf.object("result", result);
|
1734
|
+
const matrix1 = matrix[1];
|
1735
|
+
const matrix2 = matrix[2];
|
1736
|
+
const matrix3 = matrix[3];
|
1737
|
+
const matrix6 = matrix[6];
|
1738
|
+
const matrix7 = matrix[7];
|
1739
|
+
const matrix11 = matrix[11];
|
1740
|
+
result[0] = matrix[0];
|
1741
|
+
result[1] = matrix[4];
|
1742
|
+
result[2] = matrix[8];
|
1743
|
+
result[3] = matrix[12];
|
1744
|
+
result[4] = matrix1;
|
1745
|
+
result[5] = matrix[5];
|
1746
|
+
result[6] = matrix[9];
|
1747
|
+
result[7] = matrix[13];
|
1748
|
+
result[8] = matrix2;
|
1749
|
+
result[9] = matrix6;
|
1750
|
+
result[10] = matrix[10];
|
1751
|
+
result[11] = matrix[14];
|
1752
|
+
result[12] = matrix3;
|
1753
|
+
result[13] = matrix7;
|
1754
|
+
result[14] = matrix11;
|
1755
|
+
result[15] = matrix[15];
|
1756
|
+
return result;
|
1757
|
+
};
|
1758
|
+
Matrix4.abs = function(matrix, result) {
|
1759
|
+
Check_default.typeOf.object("matrix", matrix);
|
1760
|
+
Check_default.typeOf.object("result", result);
|
1761
|
+
result[0] = Math.abs(matrix[0]);
|
1762
|
+
result[1] = Math.abs(matrix[1]);
|
1763
|
+
result[2] = Math.abs(matrix[2]);
|
1764
|
+
result[3] = Math.abs(matrix[3]);
|
1765
|
+
result[4] = Math.abs(matrix[4]);
|
1766
|
+
result[5] = Math.abs(matrix[5]);
|
1767
|
+
result[6] = Math.abs(matrix[6]);
|
1768
|
+
result[7] = Math.abs(matrix[7]);
|
1769
|
+
result[8] = Math.abs(matrix[8]);
|
1770
|
+
result[9] = Math.abs(matrix[9]);
|
1771
|
+
result[10] = Math.abs(matrix[10]);
|
1772
|
+
result[11] = Math.abs(matrix[11]);
|
1773
|
+
result[12] = Math.abs(matrix[12]);
|
1774
|
+
result[13] = Math.abs(matrix[13]);
|
1775
|
+
result[14] = Math.abs(matrix[14]);
|
1776
|
+
result[15] = Math.abs(matrix[15]);
|
1777
|
+
return result;
|
1778
|
+
};
|
1779
|
+
Matrix4.equals = function(left, right) {
|
1780
|
+
return left === right || defined_default(left) && defined_default(right) && // Translation
|
1781
|
+
left[12] === right[12] && left[13] === right[13] && left[14] === right[14] && // Rotation/scale
|
1782
|
+
left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[8] === right[8] && left[9] === right[9] && left[10] === right[10] && // Bottom row
|
1783
|
+
left[3] === right[3] && left[7] === right[7] && left[11] === right[11] && left[15] === right[15];
|
1784
|
+
};
|
1785
|
+
Matrix4.equalsEpsilon = function(left, right, epsilon) {
|
1786
|
+
epsilon = defaultValue_default(epsilon, 0);
|
1787
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon && Math.abs(left[9] - right[9]) <= epsilon && Math.abs(left[10] - right[10]) <= epsilon && Math.abs(left[11] - right[11]) <= epsilon && Math.abs(left[12] - right[12]) <= epsilon && Math.abs(left[13] - right[13]) <= epsilon && Math.abs(left[14] - right[14]) <= epsilon && Math.abs(left[15] - right[15]) <= epsilon;
|
1788
|
+
};
|
1789
|
+
Matrix4.getTranslation = function(matrix, result) {
|
1790
|
+
Check_default.typeOf.object("matrix", matrix);
|
1791
|
+
Check_default.typeOf.object("result", result);
|
1792
|
+
result.x = matrix[12];
|
1793
|
+
result.y = matrix[13];
|
1794
|
+
result.z = matrix[14];
|
1795
|
+
return result;
|
1796
|
+
};
|
1797
|
+
Matrix4.getMatrix3 = function(matrix, result) {
|
1798
|
+
Check_default.typeOf.object("matrix", matrix);
|
1799
|
+
Check_default.typeOf.object("result", result);
|
1800
|
+
result[0] = matrix[0];
|
1801
|
+
result[1] = matrix[1];
|
1802
|
+
result[2] = matrix[2];
|
1803
|
+
result[3] = matrix[4];
|
1804
|
+
result[4] = matrix[5];
|
1805
|
+
result[5] = matrix[6];
|
1806
|
+
result[6] = matrix[8];
|
1807
|
+
result[7] = matrix[9];
|
1808
|
+
result[8] = matrix[10];
|
1809
|
+
return result;
|
1810
|
+
};
|
1811
|
+
var scratchInverseRotation = new Matrix3_default();
|
1812
|
+
var scratchMatrix3Zero = new Matrix3_default();
|
1813
|
+
var scratchBottomRow = new Cartesian4_default();
|
1814
|
+
var scratchExpectedBottomRow = new Cartesian4_default(0, 0, 0, 1);
|
1815
|
+
Matrix4.inverse = function(matrix, result) {
|
1816
|
+
Check_default.typeOf.object("matrix", matrix);
|
1817
|
+
Check_default.typeOf.object("result", result);
|
1818
|
+
const src0 = matrix[0];
|
1819
|
+
const src1 = matrix[4];
|
1820
|
+
const src2 = matrix[8];
|
1821
|
+
const src3 = matrix[12];
|
1822
|
+
const src4 = matrix[1];
|
1823
|
+
const src5 = matrix[5];
|
1824
|
+
const src6 = matrix[9];
|
1825
|
+
const src7 = matrix[13];
|
1826
|
+
const src8 = matrix[2];
|
1827
|
+
const src9 = matrix[6];
|
1828
|
+
const src10 = matrix[10];
|
1829
|
+
const src11 = matrix[14];
|
1830
|
+
const src12 = matrix[3];
|
1831
|
+
const src13 = matrix[7];
|
1832
|
+
const src14 = matrix[11];
|
1833
|
+
const src15 = matrix[15];
|
1834
|
+
let tmp0 = src10 * src15;
|
1835
|
+
let tmp1 = src11 * src14;
|
1836
|
+
let tmp2 = src9 * src15;
|
1837
|
+
let tmp3 = src11 * src13;
|
1838
|
+
let tmp4 = src9 * src14;
|
1839
|
+
let tmp5 = src10 * src13;
|
1840
|
+
let tmp6 = src8 * src15;
|
1841
|
+
let tmp7 = src11 * src12;
|
1842
|
+
let tmp8 = src8 * src14;
|
1843
|
+
let tmp9 = src10 * src12;
|
1844
|
+
let tmp10 = src8 * src13;
|
1845
|
+
let tmp11 = src9 * src12;
|
1846
|
+
const dst0 = tmp0 * src5 + tmp3 * src6 + tmp4 * src7 - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
|
1847
|
+
const dst1 = tmp1 * src4 + tmp6 * src6 + tmp9 * src7 - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
|
1848
|
+
const dst2 = tmp2 * src4 + tmp7 * src5 + tmp10 * src7 - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
|
1849
|
+
const dst3 = tmp5 * src4 + tmp8 * src5 + tmp11 * src6 - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
|
1850
|
+
const dst4 = tmp1 * src1 + tmp2 * src2 + tmp5 * src3 - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
|
1851
|
+
const dst5 = tmp0 * src0 + tmp7 * src2 + tmp8 * src3 - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
|
1852
|
+
const dst6 = tmp3 * src0 + tmp6 * src1 + tmp11 * src3 - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
|
1853
|
+
const dst7 = tmp4 * src0 + tmp9 * src1 + tmp10 * src2 - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
|
1854
|
+
tmp0 = src2 * src7;
|
1855
|
+
tmp1 = src3 * src6;
|
1856
|
+
tmp2 = src1 * src7;
|
1857
|
+
tmp3 = src3 * src5;
|
1858
|
+
tmp4 = src1 * src6;
|
1859
|
+
tmp5 = src2 * src5;
|
1860
|
+
tmp6 = src0 * src7;
|
1861
|
+
tmp7 = src3 * src4;
|
1862
|
+
tmp8 = src0 * src6;
|
1863
|
+
tmp9 = src2 * src4;
|
1864
|
+
tmp10 = src0 * src5;
|
1865
|
+
tmp11 = src1 * src4;
|
1866
|
+
const dst8 = tmp0 * src13 + tmp3 * src14 + tmp4 * src15 - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
|
1867
|
+
const dst9 = tmp1 * src12 + tmp6 * src14 + tmp9 * src15 - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
|
1868
|
+
const dst10 = tmp2 * src12 + tmp7 * src13 + tmp10 * src15 - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
|
1869
|
+
const dst11 = tmp5 * src12 + tmp8 * src13 + tmp11 * src14 - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
|
1870
|
+
const dst12 = tmp2 * src10 + tmp5 * src11 + tmp1 * src9 - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
|
1871
|
+
const dst13 = tmp8 * src11 + tmp0 * src8 + tmp7 * src10 - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
|
1872
|
+
const dst14 = tmp6 * src9 + tmp11 * src11 + tmp3 * src8 - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
|
1873
|
+
const dst15 = tmp10 * src10 + tmp4 * src8 + tmp9 * src9 - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
|
1874
|
+
let det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
|
1875
|
+
if (Math.abs(det) < Math_default.EPSILON21) {
|
1876
|
+
if (Matrix3_default.equalsEpsilon(
|
1877
|
+
Matrix4.getMatrix3(matrix, scratchInverseRotation),
|
1878
|
+
scratchMatrix3Zero,
|
1879
|
+
Math_default.EPSILON7
|
1880
|
+
) && Cartesian4_default.equals(
|
1881
|
+
Matrix4.getRow(matrix, 3, scratchBottomRow),
|
1882
|
+
scratchExpectedBottomRow
|
1883
|
+
)) {
|
1884
|
+
result[0] = 0;
|
1885
|
+
result[1] = 0;
|
1886
|
+
result[2] = 0;
|
1887
|
+
result[3] = 0;
|
1888
|
+
result[4] = 0;
|
1889
|
+
result[5] = 0;
|
1890
|
+
result[6] = 0;
|
1891
|
+
result[7] = 0;
|
1892
|
+
result[8] = 0;
|
1893
|
+
result[9] = 0;
|
1894
|
+
result[10] = 0;
|
1895
|
+
result[11] = 0;
|
1896
|
+
result[12] = -matrix[12];
|
1897
|
+
result[13] = -matrix[13];
|
1898
|
+
result[14] = -matrix[14];
|
1899
|
+
result[15] = 1;
|
1900
|
+
return result;
|
1901
|
+
}
|
1902
|
+
throw new RuntimeError_default(
|
1903
|
+
"matrix is not invertible because its determinate is zero."
|
1904
|
+
);
|
1905
|
+
}
|
1906
|
+
det = 1 / det;
|
1907
|
+
result[0] = dst0 * det;
|
1908
|
+
result[1] = dst1 * det;
|
1909
|
+
result[2] = dst2 * det;
|
1910
|
+
result[3] = dst3 * det;
|
1911
|
+
result[4] = dst4 * det;
|
1912
|
+
result[5] = dst5 * det;
|
1913
|
+
result[6] = dst6 * det;
|
1914
|
+
result[7] = dst7 * det;
|
1915
|
+
result[8] = dst8 * det;
|
1916
|
+
result[9] = dst9 * det;
|
1917
|
+
result[10] = dst10 * det;
|
1918
|
+
result[11] = dst11 * det;
|
1919
|
+
result[12] = dst12 * det;
|
1920
|
+
result[13] = dst13 * det;
|
1921
|
+
result[14] = dst14 * det;
|
1922
|
+
result[15] = dst15 * det;
|
1923
|
+
return result;
|
1924
|
+
};
|
1925
|
+
Matrix4.inverseTransformation = function(matrix, result) {
|
1926
|
+
Check_default.typeOf.object("matrix", matrix);
|
1927
|
+
Check_default.typeOf.object("result", result);
|
1928
|
+
const matrix0 = matrix[0];
|
1929
|
+
const matrix1 = matrix[1];
|
1930
|
+
const matrix2 = matrix[2];
|
1931
|
+
const matrix4 = matrix[4];
|
1932
|
+
const matrix5 = matrix[5];
|
1933
|
+
const matrix6 = matrix[6];
|
1934
|
+
const matrix8 = matrix[8];
|
1935
|
+
const matrix9 = matrix[9];
|
1936
|
+
const matrix10 = matrix[10];
|
1937
|
+
const vX = matrix[12];
|
1938
|
+
const vY = matrix[13];
|
1939
|
+
const vZ = matrix[14];
|
1940
|
+
const x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
|
1941
|
+
const y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
|
1942
|
+
const z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
|
1943
|
+
result[0] = matrix0;
|
1944
|
+
result[1] = matrix4;
|
1945
|
+
result[2] = matrix8;
|
1946
|
+
result[3] = 0;
|
1947
|
+
result[4] = matrix1;
|
1948
|
+
result[5] = matrix5;
|
1949
|
+
result[6] = matrix9;
|
1950
|
+
result[7] = 0;
|
1951
|
+
result[8] = matrix2;
|
1952
|
+
result[9] = matrix6;
|
1953
|
+
result[10] = matrix10;
|
1954
|
+
result[11] = 0;
|
1955
|
+
result[12] = x;
|
1956
|
+
result[13] = y;
|
1957
|
+
result[14] = z;
|
1958
|
+
result[15] = 1;
|
1959
|
+
return result;
|
1960
|
+
};
|
1961
|
+
var scratchTransposeMatrix = new Matrix4();
|
1962
|
+
Matrix4.inverseTranspose = function(matrix, result) {
|
1963
|
+
Check_default.typeOf.object("matrix", matrix);
|
1964
|
+
Check_default.typeOf.object("result", result);
|
1965
|
+
return Matrix4.inverse(
|
1966
|
+
Matrix4.transpose(matrix, scratchTransposeMatrix),
|
1967
|
+
result
|
1968
|
+
);
|
1969
|
+
};
|
1970
|
+
Matrix4.IDENTITY = Object.freeze(
|
1971
|
+
new Matrix4(
|
1972
|
+
1,
|
1973
|
+
0,
|
1974
|
+
0,
|
1975
|
+
0,
|
1976
|
+
0,
|
1977
|
+
1,
|
1978
|
+
0,
|
1979
|
+
0,
|
1980
|
+
0,
|
1981
|
+
0,
|
1982
|
+
1,
|
1983
|
+
0,
|
1984
|
+
0,
|
1985
|
+
0,
|
1986
|
+
0,
|
1987
|
+
1
|
1988
|
+
)
|
1989
|
+
);
|
1990
|
+
Matrix4.ZERO = Object.freeze(
|
1991
|
+
new Matrix4(
|
1992
|
+
0,
|
1993
|
+
0,
|
1994
|
+
0,
|
1995
|
+
0,
|
1996
|
+
0,
|
1997
|
+
0,
|
1998
|
+
0,
|
1999
|
+
0,
|
2000
|
+
0,
|
2001
|
+
0,
|
2002
|
+
0,
|
2003
|
+
0,
|
2004
|
+
0,
|
2005
|
+
0,
|
2006
|
+
0,
|
2007
|
+
0
|
2008
|
+
)
|
2009
|
+
);
|
2010
|
+
Matrix4.COLUMN0ROW0 = 0;
|
2011
|
+
Matrix4.COLUMN0ROW1 = 1;
|
2012
|
+
Matrix4.COLUMN0ROW2 = 2;
|
2013
|
+
Matrix4.COLUMN0ROW3 = 3;
|
2014
|
+
Matrix4.COLUMN1ROW0 = 4;
|
2015
|
+
Matrix4.COLUMN1ROW1 = 5;
|
2016
|
+
Matrix4.COLUMN1ROW2 = 6;
|
2017
|
+
Matrix4.COLUMN1ROW3 = 7;
|
2018
|
+
Matrix4.COLUMN2ROW0 = 8;
|
2019
|
+
Matrix4.COLUMN2ROW1 = 9;
|
2020
|
+
Matrix4.COLUMN2ROW2 = 10;
|
2021
|
+
Matrix4.COLUMN2ROW3 = 11;
|
2022
|
+
Matrix4.COLUMN3ROW0 = 12;
|
2023
|
+
Matrix4.COLUMN3ROW1 = 13;
|
2024
|
+
Matrix4.COLUMN3ROW2 = 14;
|
2025
|
+
Matrix4.COLUMN3ROW3 = 15;
|
2026
|
+
Object.defineProperties(Matrix4.prototype, {
|
2027
|
+
/**
|
2028
|
+
* Gets the number of items in the collection.
|
2029
|
+
* @memberof Matrix4.prototype
|
2030
|
+
*
|
2031
|
+
* @type {number}
|
2032
|
+
*/
|
2033
|
+
length: {
|
2034
|
+
get: function() {
|
2035
|
+
return Matrix4.packedLength;
|
2036
|
+
}
|
2037
|
+
}
|
2038
|
+
});
|
2039
|
+
Matrix4.prototype.clone = function(result) {
|
2040
|
+
return Matrix4.clone(this, result);
|
2041
|
+
};
|
2042
|
+
Matrix4.prototype.equals = function(right) {
|
2043
|
+
return Matrix4.equals(this, right);
|
2044
|
+
};
|
2045
|
+
Matrix4.equalsArray = function(matrix, array, offset) {
|
2046
|
+
return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3] && matrix[4] === array[offset + 4] && matrix[5] === array[offset + 5] && matrix[6] === array[offset + 6] && matrix[7] === array[offset + 7] && matrix[8] === array[offset + 8] && matrix[9] === array[offset + 9] && matrix[10] === array[offset + 10] && matrix[11] === array[offset + 11] && matrix[12] === array[offset + 12] && matrix[13] === array[offset + 13] && matrix[14] === array[offset + 14] && matrix[15] === array[offset + 15];
|
2047
|
+
};
|
2048
|
+
Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
|
2049
|
+
return Matrix4.equalsEpsilon(this, right, epsilon);
|
2050
|
+
};
|
2051
|
+
Matrix4.prototype.toString = function() {
|
2052
|
+
return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
|
2053
|
+
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
|
2054
|
+
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
|
2055
|
+
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`;
|
2056
|
+
};
|
2057
|
+
var Matrix4_default = Matrix4;
|
2058
|
+
|
2059
|
+
// packages/engine/Source/Core/Rectangle.js
|
2060
|
+
function Rectangle(west, south, east, north) {
|
2061
|
+
this.west = defaultValue_default(west, 0);
|
2062
|
+
this.south = defaultValue_default(south, 0);
|
2063
|
+
this.east = defaultValue_default(east, 0);
|
2064
|
+
this.north = defaultValue_default(north, 0);
|
2065
|
+
}
|
2066
|
+
Object.defineProperties(Rectangle.prototype, {
|
2067
|
+
/**
|
2068
|
+
* Gets the width of the rectangle in radians.
|
2069
|
+
* @memberof Rectangle.prototype
|
2070
|
+
* @type {number}
|
2071
|
+
* @readonly
|
2072
|
+
*/
|
2073
|
+
width: {
|
2074
|
+
get: function() {
|
2075
|
+
return Rectangle.computeWidth(this);
|
2076
|
+
}
|
2077
|
+
},
|
2078
|
+
/**
|
2079
|
+
* Gets the height of the rectangle in radians.
|
2080
|
+
* @memberof Rectangle.prototype
|
2081
|
+
* @type {number}
|
2082
|
+
* @readonly
|
2083
|
+
*/
|
2084
|
+
height: {
|
2085
|
+
get: function() {
|
2086
|
+
return Rectangle.computeHeight(this);
|
2087
|
+
}
|
2088
|
+
}
|
2089
|
+
});
|
2090
|
+
Rectangle.packedLength = 4;
|
2091
|
+
Rectangle.pack = function(value, array, startingIndex) {
|
2092
|
+
Check_default.typeOf.object("value", value);
|
2093
|
+
Check_default.defined("array", array);
|
2094
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2095
|
+
array[startingIndex++] = value.west;
|
2096
|
+
array[startingIndex++] = value.south;
|
2097
|
+
array[startingIndex++] = value.east;
|
2098
|
+
array[startingIndex] = value.north;
|
2099
|
+
return array;
|
2100
|
+
};
|
2101
|
+
Rectangle.unpack = function(array, startingIndex, result) {
|
2102
|
+
Check_default.defined("array", array);
|
2103
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2104
|
+
if (!defined_default(result)) {
|
2105
|
+
result = new Rectangle();
|
2106
|
+
}
|
2107
|
+
result.west = array[startingIndex++];
|
2108
|
+
result.south = array[startingIndex++];
|
2109
|
+
result.east = array[startingIndex++];
|
2110
|
+
result.north = array[startingIndex];
|
2111
|
+
return result;
|
2112
|
+
};
|
2113
|
+
Rectangle.computeWidth = function(rectangle) {
|
2114
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2115
|
+
let east = rectangle.east;
|
2116
|
+
const west = rectangle.west;
|
2117
|
+
if (east < west) {
|
2118
|
+
east += Math_default.TWO_PI;
|
2119
|
+
}
|
2120
|
+
return east - west;
|
2121
|
+
};
|
2122
|
+
Rectangle.computeHeight = function(rectangle) {
|
2123
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2124
|
+
return rectangle.north - rectangle.south;
|
2125
|
+
};
|
2126
|
+
Rectangle.fromDegrees = function(west, south, east, north, result) {
|
2127
|
+
west = Math_default.toRadians(defaultValue_default(west, 0));
|
2128
|
+
south = Math_default.toRadians(defaultValue_default(south, 0));
|
2129
|
+
east = Math_default.toRadians(defaultValue_default(east, 0));
|
2130
|
+
north = Math_default.toRadians(defaultValue_default(north, 0));
|
2131
|
+
if (!defined_default(result)) {
|
2132
|
+
return new Rectangle(west, south, east, north);
|
2133
|
+
}
|
2134
|
+
result.west = west;
|
2135
|
+
result.south = south;
|
2136
|
+
result.east = east;
|
2137
|
+
result.north = north;
|
2138
|
+
return result;
|
2139
|
+
};
|
2140
|
+
Rectangle.fromRadians = function(west, south, east, north, result) {
|
2141
|
+
if (!defined_default(result)) {
|
2142
|
+
return new Rectangle(west, south, east, north);
|
2143
|
+
}
|
2144
|
+
result.west = defaultValue_default(west, 0);
|
2145
|
+
result.south = defaultValue_default(south, 0);
|
2146
|
+
result.east = defaultValue_default(east, 0);
|
2147
|
+
result.north = defaultValue_default(north, 0);
|
2148
|
+
return result;
|
2149
|
+
};
|
2150
|
+
Rectangle.fromCartographicArray = function(cartographics, result) {
|
2151
|
+
Check_default.defined("cartographics", cartographics);
|
2152
|
+
let west = Number.MAX_VALUE;
|
2153
|
+
let east = -Number.MAX_VALUE;
|
2154
|
+
let westOverIDL = Number.MAX_VALUE;
|
2155
|
+
let eastOverIDL = -Number.MAX_VALUE;
|
2156
|
+
let south = Number.MAX_VALUE;
|
2157
|
+
let north = -Number.MAX_VALUE;
|
2158
|
+
for (let i = 0, len = cartographics.length; i < len; i++) {
|
2159
|
+
const position = cartographics[i];
|
2160
|
+
west = Math.min(west, position.longitude);
|
2161
|
+
east = Math.max(east, position.longitude);
|
2162
|
+
south = Math.min(south, position.latitude);
|
2163
|
+
north = Math.max(north, position.latitude);
|
2164
|
+
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
2165
|
+
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
2166
|
+
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
2167
|
+
}
|
2168
|
+
if (east - west > eastOverIDL - westOverIDL) {
|
2169
|
+
west = westOverIDL;
|
2170
|
+
east = eastOverIDL;
|
2171
|
+
if (east > Math_default.PI) {
|
2172
|
+
east = east - Math_default.TWO_PI;
|
2173
|
+
}
|
2174
|
+
if (west > Math_default.PI) {
|
2175
|
+
west = west - Math_default.TWO_PI;
|
2176
|
+
}
|
2177
|
+
}
|
2178
|
+
if (!defined_default(result)) {
|
2179
|
+
return new Rectangle(west, south, east, north);
|
2180
|
+
}
|
2181
|
+
result.west = west;
|
2182
|
+
result.south = south;
|
2183
|
+
result.east = east;
|
2184
|
+
result.north = north;
|
2185
|
+
return result;
|
2186
|
+
};
|
2187
|
+
Rectangle.fromCartesianArray = function(cartesians, ellipsoid, result) {
|
2188
|
+
Check_default.defined("cartesians", cartesians);
|
2189
|
+
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
|
2190
|
+
let west = Number.MAX_VALUE;
|
2191
|
+
let east = -Number.MAX_VALUE;
|
2192
|
+
let westOverIDL = Number.MAX_VALUE;
|
2193
|
+
let eastOverIDL = -Number.MAX_VALUE;
|
2194
|
+
let south = Number.MAX_VALUE;
|
2195
|
+
let north = -Number.MAX_VALUE;
|
2196
|
+
for (let i = 0, len = cartesians.length; i < len; i++) {
|
2197
|
+
const position = ellipsoid.cartesianToCartographic(cartesians[i]);
|
2198
|
+
west = Math.min(west, position.longitude);
|
2199
|
+
east = Math.max(east, position.longitude);
|
2200
|
+
south = Math.min(south, position.latitude);
|
2201
|
+
north = Math.max(north, position.latitude);
|
2202
|
+
const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
|
2203
|
+
westOverIDL = Math.min(westOverIDL, lonAdjusted);
|
2204
|
+
eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
|
2205
|
+
}
|
2206
|
+
if (east - west > eastOverIDL - westOverIDL) {
|
2207
|
+
west = westOverIDL;
|
2208
|
+
east = eastOverIDL;
|
2209
|
+
if (east > Math_default.PI) {
|
2210
|
+
east = east - Math_default.TWO_PI;
|
2211
|
+
}
|
2212
|
+
if (west > Math_default.PI) {
|
2213
|
+
west = west - Math_default.TWO_PI;
|
2214
|
+
}
|
2215
|
+
}
|
2216
|
+
if (!defined_default(result)) {
|
2217
|
+
return new Rectangle(west, south, east, north);
|
2218
|
+
}
|
2219
|
+
result.west = west;
|
2220
|
+
result.south = south;
|
2221
|
+
result.east = east;
|
2222
|
+
result.north = north;
|
2223
|
+
return result;
|
2224
|
+
};
|
2225
|
+
Rectangle.clone = function(rectangle, result) {
|
2226
|
+
if (!defined_default(rectangle)) {
|
2227
|
+
return void 0;
|
2228
|
+
}
|
2229
|
+
if (!defined_default(result)) {
|
2230
|
+
return new Rectangle(
|
2231
|
+
rectangle.west,
|
2232
|
+
rectangle.south,
|
2233
|
+
rectangle.east,
|
2234
|
+
rectangle.north
|
2235
|
+
);
|
2236
|
+
}
|
2237
|
+
result.west = rectangle.west;
|
2238
|
+
result.south = rectangle.south;
|
2239
|
+
result.east = rectangle.east;
|
2240
|
+
result.north = rectangle.north;
|
2241
|
+
return result;
|
2242
|
+
};
|
2243
|
+
Rectangle.equalsEpsilon = function(left, right, absoluteEpsilon) {
|
2244
|
+
absoluteEpsilon = defaultValue_default(absoluteEpsilon, 0);
|
2245
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left.west - right.west) <= absoluteEpsilon && Math.abs(left.south - right.south) <= absoluteEpsilon && Math.abs(left.east - right.east) <= absoluteEpsilon && Math.abs(left.north - right.north) <= absoluteEpsilon;
|
2246
|
+
};
|
2247
|
+
Rectangle.prototype.clone = function(result) {
|
2248
|
+
return Rectangle.clone(this, result);
|
2249
|
+
};
|
2250
|
+
Rectangle.prototype.equals = function(other) {
|
2251
|
+
return Rectangle.equals(this, other);
|
2252
|
+
};
|
2253
|
+
Rectangle.equals = function(left, right) {
|
2254
|
+
return left === right || defined_default(left) && defined_default(right) && left.west === right.west && left.south === right.south && left.east === right.east && left.north === right.north;
|
2255
|
+
};
|
2256
|
+
Rectangle.prototype.equalsEpsilon = function(other, epsilon) {
|
2257
|
+
return Rectangle.equalsEpsilon(this, other, epsilon);
|
2258
|
+
};
|
2259
|
+
Rectangle.validate = function(rectangle) {
|
2260
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2261
|
+
const north = rectangle.north;
|
2262
|
+
Check_default.typeOf.number.greaterThanOrEquals(
|
2263
|
+
"north",
|
2264
|
+
north,
|
2265
|
+
-Math_default.PI_OVER_TWO
|
2266
|
+
);
|
2267
|
+
Check_default.typeOf.number.lessThanOrEquals("north", north, Math_default.PI_OVER_TWO);
|
2268
|
+
const south = rectangle.south;
|
2269
|
+
Check_default.typeOf.number.greaterThanOrEquals(
|
2270
|
+
"south",
|
2271
|
+
south,
|
2272
|
+
-Math_default.PI_OVER_TWO
|
2273
|
+
);
|
2274
|
+
Check_default.typeOf.number.lessThanOrEquals("south", south, Math_default.PI_OVER_TWO);
|
2275
|
+
const west = rectangle.west;
|
2276
|
+
Check_default.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
|
2277
|
+
Check_default.typeOf.number.lessThanOrEquals("west", west, Math.PI);
|
2278
|
+
const east = rectangle.east;
|
2279
|
+
Check_default.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
|
2280
|
+
Check_default.typeOf.number.lessThanOrEquals("east", east, Math.PI);
|
2281
|
+
};
|
2282
|
+
Rectangle.southwest = function(rectangle, result) {
|
2283
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2284
|
+
if (!defined_default(result)) {
|
2285
|
+
return new Cartographic_default(rectangle.west, rectangle.south);
|
2286
|
+
}
|
2287
|
+
result.longitude = rectangle.west;
|
2288
|
+
result.latitude = rectangle.south;
|
2289
|
+
result.height = 0;
|
2290
|
+
return result;
|
2291
|
+
};
|
2292
|
+
Rectangle.northwest = function(rectangle, result) {
|
2293
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2294
|
+
if (!defined_default(result)) {
|
2295
|
+
return new Cartographic_default(rectangle.west, rectangle.north);
|
2296
|
+
}
|
2297
|
+
result.longitude = rectangle.west;
|
2298
|
+
result.latitude = rectangle.north;
|
2299
|
+
result.height = 0;
|
2300
|
+
return result;
|
2301
|
+
};
|
2302
|
+
Rectangle.northeast = function(rectangle, result) {
|
2303
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2304
|
+
if (!defined_default(result)) {
|
2305
|
+
return new Cartographic_default(rectangle.east, rectangle.north);
|
2306
|
+
}
|
2307
|
+
result.longitude = rectangle.east;
|
2308
|
+
result.latitude = rectangle.north;
|
2309
|
+
result.height = 0;
|
2310
|
+
return result;
|
2311
|
+
};
|
2312
|
+
Rectangle.southeast = function(rectangle, result) {
|
2313
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2314
|
+
if (!defined_default(result)) {
|
2315
|
+
return new Cartographic_default(rectangle.east, rectangle.south);
|
2316
|
+
}
|
2317
|
+
result.longitude = rectangle.east;
|
2318
|
+
result.latitude = rectangle.south;
|
2319
|
+
result.height = 0;
|
2320
|
+
return result;
|
2321
|
+
};
|
2322
|
+
Rectangle.center = function(rectangle, result) {
|
2323
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2324
|
+
let east = rectangle.east;
|
2325
|
+
const west = rectangle.west;
|
2326
|
+
if (east < west) {
|
2327
|
+
east += Math_default.TWO_PI;
|
2328
|
+
}
|
2329
|
+
const longitude = Math_default.negativePiToPi((west + east) * 0.5);
|
2330
|
+
const latitude = (rectangle.south + rectangle.north) * 0.5;
|
2331
|
+
if (!defined_default(result)) {
|
2332
|
+
return new Cartographic_default(longitude, latitude);
|
2333
|
+
}
|
2334
|
+
result.longitude = longitude;
|
2335
|
+
result.latitude = latitude;
|
2336
|
+
result.height = 0;
|
2337
|
+
return result;
|
2338
|
+
};
|
2339
|
+
Rectangle.intersection = function(rectangle, otherRectangle, result) {
|
2340
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2341
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
2342
|
+
let rectangleEast = rectangle.east;
|
2343
|
+
let rectangleWest = rectangle.west;
|
2344
|
+
let otherRectangleEast = otherRectangle.east;
|
2345
|
+
let otherRectangleWest = otherRectangle.west;
|
2346
|
+
if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
|
2347
|
+
rectangleEast += Math_default.TWO_PI;
|
2348
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
|
2349
|
+
otherRectangleEast += Math_default.TWO_PI;
|
2350
|
+
}
|
2351
|
+
if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
|
2352
|
+
otherRectangleWest += Math_default.TWO_PI;
|
2353
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
|
2354
|
+
rectangleWest += Math_default.TWO_PI;
|
2355
|
+
}
|
2356
|
+
const west = Math_default.negativePiToPi(
|
2357
|
+
Math.max(rectangleWest, otherRectangleWest)
|
2358
|
+
);
|
2359
|
+
const east = Math_default.negativePiToPi(
|
2360
|
+
Math.min(rectangleEast, otherRectangleEast)
|
2361
|
+
);
|
2362
|
+
if ((rectangle.west < rectangle.east || otherRectangle.west < otherRectangle.east) && east <= west) {
|
2363
|
+
return void 0;
|
2364
|
+
}
|
2365
|
+
const south = Math.max(rectangle.south, otherRectangle.south);
|
2366
|
+
const north = Math.min(rectangle.north, otherRectangle.north);
|
2367
|
+
if (south >= north) {
|
2368
|
+
return void 0;
|
2369
|
+
}
|
2370
|
+
if (!defined_default(result)) {
|
2371
|
+
return new Rectangle(west, south, east, north);
|
2372
|
+
}
|
2373
|
+
result.west = west;
|
2374
|
+
result.south = south;
|
2375
|
+
result.east = east;
|
2376
|
+
result.north = north;
|
2377
|
+
return result;
|
2378
|
+
};
|
2379
|
+
Rectangle.simpleIntersection = function(rectangle, otherRectangle, result) {
|
2380
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2381
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
2382
|
+
const west = Math.max(rectangle.west, otherRectangle.west);
|
2383
|
+
const south = Math.max(rectangle.south, otherRectangle.south);
|
2384
|
+
const east = Math.min(rectangle.east, otherRectangle.east);
|
2385
|
+
const north = Math.min(rectangle.north, otherRectangle.north);
|
2386
|
+
if (south >= north || west >= east) {
|
2387
|
+
return void 0;
|
2388
|
+
}
|
2389
|
+
if (!defined_default(result)) {
|
2390
|
+
return new Rectangle(west, south, east, north);
|
2391
|
+
}
|
2392
|
+
result.west = west;
|
2393
|
+
result.south = south;
|
2394
|
+
result.east = east;
|
2395
|
+
result.north = north;
|
2396
|
+
return result;
|
2397
|
+
};
|
2398
|
+
Rectangle.union = function(rectangle, otherRectangle, result) {
|
2399
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2400
|
+
Check_default.typeOf.object("otherRectangle", otherRectangle);
|
2401
|
+
if (!defined_default(result)) {
|
2402
|
+
result = new Rectangle();
|
2403
|
+
}
|
2404
|
+
let rectangleEast = rectangle.east;
|
2405
|
+
let rectangleWest = rectangle.west;
|
2406
|
+
let otherRectangleEast = otherRectangle.east;
|
2407
|
+
let otherRectangleWest = otherRectangle.west;
|
2408
|
+
if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
|
2409
|
+
rectangleEast += Math_default.TWO_PI;
|
2410
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
|
2411
|
+
otherRectangleEast += Math_default.TWO_PI;
|
2412
|
+
}
|
2413
|
+
if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
|
2414
|
+
otherRectangleWest += Math_default.TWO_PI;
|
2415
|
+
} else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
|
2416
|
+
rectangleWest += Math_default.TWO_PI;
|
2417
|
+
}
|
2418
|
+
const west = Math_default.negativePiToPi(
|
2419
|
+
Math.min(rectangleWest, otherRectangleWest)
|
2420
|
+
);
|
2421
|
+
const east = Math_default.negativePiToPi(
|
2422
|
+
Math.max(rectangleEast, otherRectangleEast)
|
2423
|
+
);
|
2424
|
+
result.west = west;
|
2425
|
+
result.south = Math.min(rectangle.south, otherRectangle.south);
|
2426
|
+
result.east = east;
|
2427
|
+
result.north = Math.max(rectangle.north, otherRectangle.north);
|
2428
|
+
return result;
|
2429
|
+
};
|
2430
|
+
Rectangle.expand = function(rectangle, cartographic, result) {
|
2431
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2432
|
+
Check_default.typeOf.object("cartographic", cartographic);
|
2433
|
+
if (!defined_default(result)) {
|
2434
|
+
result = new Rectangle();
|
2435
|
+
}
|
2436
|
+
result.west = Math.min(rectangle.west, cartographic.longitude);
|
2437
|
+
result.south = Math.min(rectangle.south, cartographic.latitude);
|
2438
|
+
result.east = Math.max(rectangle.east, cartographic.longitude);
|
2439
|
+
result.north = Math.max(rectangle.north, cartographic.latitude);
|
2440
|
+
return result;
|
2441
|
+
};
|
2442
|
+
Rectangle.contains = function(rectangle, cartographic) {
|
2443
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2444
|
+
Check_default.typeOf.object("cartographic", cartographic);
|
2445
|
+
let longitude = cartographic.longitude;
|
2446
|
+
const latitude = cartographic.latitude;
|
2447
|
+
const west = rectangle.west;
|
2448
|
+
let east = rectangle.east;
|
2449
|
+
if (east < west) {
|
2450
|
+
east += Math_default.TWO_PI;
|
2451
|
+
if (longitude < 0) {
|
2452
|
+
longitude += Math_default.TWO_PI;
|
2453
|
+
}
|
2454
|
+
}
|
2455
|
+
return (longitude > west || Math_default.equalsEpsilon(longitude, west, Math_default.EPSILON14)) && (longitude < east || Math_default.equalsEpsilon(longitude, east, Math_default.EPSILON14)) && latitude >= rectangle.south && latitude <= rectangle.north;
|
2456
|
+
};
|
2457
|
+
var subsampleLlaScratch = new Cartographic_default();
|
2458
|
+
Rectangle.subsample = function(rectangle, ellipsoid, surfaceHeight, result) {
|
2459
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2460
|
+
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
|
2461
|
+
surfaceHeight = defaultValue_default(surfaceHeight, 0);
|
2462
|
+
if (!defined_default(result)) {
|
2463
|
+
result = [];
|
2464
|
+
}
|
2465
|
+
let length = 0;
|
2466
|
+
const north = rectangle.north;
|
2467
|
+
const south = rectangle.south;
|
2468
|
+
const east = rectangle.east;
|
2469
|
+
const west = rectangle.west;
|
2470
|
+
const lla = subsampleLlaScratch;
|
2471
|
+
lla.height = surfaceHeight;
|
2472
|
+
lla.longitude = west;
|
2473
|
+
lla.latitude = north;
|
2474
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2475
|
+
length++;
|
2476
|
+
lla.longitude = east;
|
2477
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2478
|
+
length++;
|
2479
|
+
lla.latitude = south;
|
2480
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2481
|
+
length++;
|
2482
|
+
lla.longitude = west;
|
2483
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2484
|
+
length++;
|
2485
|
+
if (north < 0) {
|
2486
|
+
lla.latitude = north;
|
2487
|
+
} else if (south > 0) {
|
2488
|
+
lla.latitude = south;
|
2489
|
+
} else {
|
2490
|
+
lla.latitude = 0;
|
2491
|
+
}
|
2492
|
+
for (let i = 1; i < 8; ++i) {
|
2493
|
+
lla.longitude = -Math.PI + i * Math_default.PI_OVER_TWO;
|
2494
|
+
if (Rectangle.contains(rectangle, lla)) {
|
2495
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2496
|
+
length++;
|
2497
|
+
}
|
2498
|
+
}
|
2499
|
+
if (lla.latitude === 0) {
|
2500
|
+
lla.longitude = west;
|
2501
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2502
|
+
length++;
|
2503
|
+
lla.longitude = east;
|
2504
|
+
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
|
2505
|
+
length++;
|
2506
|
+
}
|
2507
|
+
result.length = length;
|
2508
|
+
return result;
|
2509
|
+
};
|
2510
|
+
Rectangle.subsection = function(rectangle, westLerp, southLerp, eastLerp, northLerp, result) {
|
2511
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
2512
|
+
Check_default.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0);
|
2513
|
+
Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1);
|
2514
|
+
Check_default.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0);
|
2515
|
+
Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1);
|
2516
|
+
Check_default.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0);
|
2517
|
+
Check_default.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1);
|
2518
|
+
Check_default.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0);
|
2519
|
+
Check_default.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1);
|
2520
|
+
Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
|
2521
|
+
Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
|
2522
|
+
if (!defined_default(result)) {
|
2523
|
+
result = new Rectangle();
|
2524
|
+
}
|
2525
|
+
if (rectangle.west <= rectangle.east) {
|
2526
|
+
const width = rectangle.east - rectangle.west;
|
2527
|
+
result.west = rectangle.west + westLerp * width;
|
2528
|
+
result.east = rectangle.west + eastLerp * width;
|
2529
|
+
} else {
|
2530
|
+
const width = Math_default.TWO_PI + rectangle.east - rectangle.west;
|
2531
|
+
result.west = Math_default.negativePiToPi(rectangle.west + westLerp * width);
|
2532
|
+
result.east = Math_default.negativePiToPi(rectangle.west + eastLerp * width);
|
2533
|
+
}
|
2534
|
+
const height = rectangle.north - rectangle.south;
|
2535
|
+
result.south = rectangle.south + southLerp * height;
|
2536
|
+
result.north = rectangle.south + northLerp * height;
|
2537
|
+
if (westLerp === 1) {
|
2538
|
+
result.west = rectangle.east;
|
2539
|
+
}
|
2540
|
+
if (eastLerp === 1) {
|
2541
|
+
result.east = rectangle.east;
|
2542
|
+
}
|
2543
|
+
if (southLerp === 1) {
|
2544
|
+
result.south = rectangle.north;
|
2545
|
+
}
|
2546
|
+
if (northLerp === 1) {
|
2547
|
+
result.north = rectangle.north;
|
2548
|
+
}
|
2549
|
+
return result;
|
2550
|
+
};
|
2551
|
+
Rectangle.MAX_VALUE = Object.freeze(
|
2552
|
+
new Rectangle(
|
2553
|
+
-Math.PI,
|
2554
|
+
-Math_default.PI_OVER_TWO,
|
2555
|
+
Math.PI,
|
2556
|
+
Math_default.PI_OVER_TWO
|
2557
|
+
)
|
2558
|
+
);
|
2559
|
+
var Rectangle_default = Rectangle;
|
2560
|
+
|
2561
|
+
// packages/engine/Source/Core/Cartesian2.js
|
2562
|
+
function Cartesian2(x, y) {
|
2563
|
+
this.x = defaultValue_default(x, 0);
|
2564
|
+
this.y = defaultValue_default(y, 0);
|
2565
|
+
}
|
2566
|
+
Cartesian2.fromElements = function(x, y, result) {
|
2567
|
+
if (!defined_default(result)) {
|
2568
|
+
return new Cartesian2(x, y);
|
2569
|
+
}
|
2570
|
+
result.x = x;
|
2571
|
+
result.y = y;
|
2572
|
+
return result;
|
2573
|
+
};
|
2574
|
+
Cartesian2.clone = function(cartesian, result) {
|
2575
|
+
if (!defined_default(cartesian)) {
|
2576
|
+
return void 0;
|
2577
|
+
}
|
2578
|
+
if (!defined_default(result)) {
|
2579
|
+
return new Cartesian2(cartesian.x, cartesian.y);
|
2580
|
+
}
|
2581
|
+
result.x = cartesian.x;
|
2582
|
+
result.y = cartesian.y;
|
2583
|
+
return result;
|
2584
|
+
};
|
2585
|
+
Cartesian2.fromCartesian3 = Cartesian2.clone;
|
2586
|
+
Cartesian2.fromCartesian4 = Cartesian2.clone;
|
2587
|
+
Cartesian2.packedLength = 2;
|
2588
|
+
Cartesian2.pack = function(value, array, startingIndex) {
|
2589
|
+
Check_default.typeOf.object("value", value);
|
2590
|
+
Check_default.defined("array", array);
|
2591
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2592
|
+
array[startingIndex++] = value.x;
|
2593
|
+
array[startingIndex] = value.y;
|
2594
|
+
return array;
|
2595
|
+
};
|
2596
|
+
Cartesian2.unpack = function(array, startingIndex, result) {
|
2597
|
+
Check_default.defined("array", array);
|
2598
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2599
|
+
if (!defined_default(result)) {
|
2600
|
+
result = new Cartesian2();
|
2601
|
+
}
|
2602
|
+
result.x = array[startingIndex++];
|
2603
|
+
result.y = array[startingIndex];
|
2604
|
+
return result;
|
2605
|
+
};
|
2606
|
+
Cartesian2.packArray = function(array, result) {
|
2607
|
+
Check_default.defined("array", array);
|
2608
|
+
const length = array.length;
|
2609
|
+
const resultLength = length * 2;
|
2610
|
+
if (!defined_default(result)) {
|
2611
|
+
result = new Array(resultLength);
|
2612
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
2613
|
+
throw new DeveloperError_default(
|
2614
|
+
"If result is a typed array, it must have exactly array.length * 2 elements"
|
2615
|
+
);
|
2616
|
+
} else if (result.length !== resultLength) {
|
2617
|
+
result.length = resultLength;
|
2618
|
+
}
|
2619
|
+
for (let i = 0; i < length; ++i) {
|
2620
|
+
Cartesian2.pack(array[i], result, i * 2);
|
2621
|
+
}
|
2622
|
+
return result;
|
2623
|
+
};
|
2624
|
+
Cartesian2.unpackArray = function(array, result) {
|
2625
|
+
Check_default.defined("array", array);
|
2626
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 2);
|
2627
|
+
if (array.length % 2 !== 0) {
|
2628
|
+
throw new DeveloperError_default("array length must be a multiple of 2.");
|
2629
|
+
}
|
2630
|
+
const length = array.length;
|
2631
|
+
if (!defined_default(result)) {
|
2632
|
+
result = new Array(length / 2);
|
2633
|
+
} else {
|
2634
|
+
result.length = length / 2;
|
2635
|
+
}
|
2636
|
+
for (let i = 0; i < length; i += 2) {
|
2637
|
+
const index = i / 2;
|
2638
|
+
result[index] = Cartesian2.unpack(array, i, result[index]);
|
2639
|
+
}
|
2640
|
+
return result;
|
2641
|
+
};
|
2642
|
+
Cartesian2.fromArray = Cartesian2.unpack;
|
2643
|
+
Cartesian2.maximumComponent = function(cartesian) {
|
2644
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2645
|
+
return Math.max(cartesian.x, cartesian.y);
|
2646
|
+
};
|
2647
|
+
Cartesian2.minimumComponent = function(cartesian) {
|
2648
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2649
|
+
return Math.min(cartesian.x, cartesian.y);
|
2650
|
+
};
|
2651
|
+
Cartesian2.minimumByComponent = function(first, second, result) {
|
2652
|
+
Check_default.typeOf.object("first", first);
|
2653
|
+
Check_default.typeOf.object("second", second);
|
2654
|
+
Check_default.typeOf.object("result", result);
|
2655
|
+
result.x = Math.min(first.x, second.x);
|
2656
|
+
result.y = Math.min(first.y, second.y);
|
2657
|
+
return result;
|
2658
|
+
};
|
2659
|
+
Cartesian2.maximumByComponent = function(first, second, result) {
|
2660
|
+
Check_default.typeOf.object("first", first);
|
2661
|
+
Check_default.typeOf.object("second", second);
|
2662
|
+
Check_default.typeOf.object("result", result);
|
2663
|
+
result.x = Math.max(first.x, second.x);
|
2664
|
+
result.y = Math.max(first.y, second.y);
|
2665
|
+
return result;
|
2666
|
+
};
|
2667
|
+
Cartesian2.clamp = function(value, min, max, result) {
|
2668
|
+
Check_default.typeOf.object("value", value);
|
2669
|
+
Check_default.typeOf.object("min", min);
|
2670
|
+
Check_default.typeOf.object("max", max);
|
2671
|
+
Check_default.typeOf.object("result", result);
|
2672
|
+
const x = Math_default.clamp(value.x, min.x, max.x);
|
2673
|
+
const y = Math_default.clamp(value.y, min.y, max.y);
|
2674
|
+
result.x = x;
|
2675
|
+
result.y = y;
|
2676
|
+
return result;
|
2677
|
+
};
|
2678
|
+
Cartesian2.magnitudeSquared = function(cartesian) {
|
2679
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2680
|
+
return cartesian.x * cartesian.x + cartesian.y * cartesian.y;
|
2681
|
+
};
|
2682
|
+
Cartesian2.magnitude = function(cartesian) {
|
2683
|
+
return Math.sqrt(Cartesian2.magnitudeSquared(cartesian));
|
2684
|
+
};
|
2685
|
+
var distanceScratch2 = new Cartesian2();
|
2686
|
+
Cartesian2.distance = function(left, right) {
|
2687
|
+
Check_default.typeOf.object("left", left);
|
2688
|
+
Check_default.typeOf.object("right", right);
|
2689
|
+
Cartesian2.subtract(left, right, distanceScratch2);
|
2690
|
+
return Cartesian2.magnitude(distanceScratch2);
|
2691
|
+
};
|
2692
|
+
Cartesian2.distanceSquared = function(left, right) {
|
2693
|
+
Check_default.typeOf.object("left", left);
|
2694
|
+
Check_default.typeOf.object("right", right);
|
2695
|
+
Cartesian2.subtract(left, right, distanceScratch2);
|
2696
|
+
return Cartesian2.magnitudeSquared(distanceScratch2);
|
2697
|
+
};
|
2698
|
+
Cartesian2.normalize = function(cartesian, result) {
|
2699
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2700
|
+
Check_default.typeOf.object("result", result);
|
2701
|
+
const magnitude = Cartesian2.magnitude(cartesian);
|
2702
|
+
result.x = cartesian.x / magnitude;
|
2703
|
+
result.y = cartesian.y / magnitude;
|
2704
|
+
if (isNaN(result.x) || isNaN(result.y)) {
|
2705
|
+
throw new DeveloperError_default("normalized result is not a number");
|
2706
|
+
}
|
2707
|
+
return result;
|
2708
|
+
};
|
2709
|
+
Cartesian2.dot = function(left, right) {
|
2710
|
+
Check_default.typeOf.object("left", left);
|
2711
|
+
Check_default.typeOf.object("right", right);
|
2712
|
+
return left.x * right.x + left.y * right.y;
|
2713
|
+
};
|
2714
|
+
Cartesian2.cross = function(left, right) {
|
2715
|
+
Check_default.typeOf.object("left", left);
|
2716
|
+
Check_default.typeOf.object("right", right);
|
2717
|
+
return left.x * right.y - left.y * right.x;
|
2718
|
+
};
|
2719
|
+
Cartesian2.multiplyComponents = function(left, right, result) {
|
2720
|
+
Check_default.typeOf.object("left", left);
|
2721
|
+
Check_default.typeOf.object("right", right);
|
2722
|
+
Check_default.typeOf.object("result", result);
|
2723
|
+
result.x = left.x * right.x;
|
2724
|
+
result.y = left.y * right.y;
|
2725
|
+
return result;
|
2726
|
+
};
|
2727
|
+
Cartesian2.divideComponents = function(left, right, result) {
|
2728
|
+
Check_default.typeOf.object("left", left);
|
2729
|
+
Check_default.typeOf.object("right", right);
|
2730
|
+
Check_default.typeOf.object("result", result);
|
2731
|
+
result.x = left.x / right.x;
|
2732
|
+
result.y = left.y / right.y;
|
2733
|
+
return result;
|
2734
|
+
};
|
2735
|
+
Cartesian2.add = function(left, right, result) {
|
2736
|
+
Check_default.typeOf.object("left", left);
|
2737
|
+
Check_default.typeOf.object("right", right);
|
2738
|
+
Check_default.typeOf.object("result", result);
|
2739
|
+
result.x = left.x + right.x;
|
2740
|
+
result.y = left.y + right.y;
|
2741
|
+
return result;
|
2742
|
+
};
|
2743
|
+
Cartesian2.subtract = function(left, right, result) {
|
2744
|
+
Check_default.typeOf.object("left", left);
|
2745
|
+
Check_default.typeOf.object("right", right);
|
2746
|
+
Check_default.typeOf.object("result", result);
|
2747
|
+
result.x = left.x - right.x;
|
2748
|
+
result.y = left.y - right.y;
|
2749
|
+
return result;
|
2750
|
+
};
|
2751
|
+
Cartesian2.multiplyByScalar = function(cartesian, scalar, result) {
|
2752
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2753
|
+
Check_default.typeOf.number("scalar", scalar);
|
2754
|
+
Check_default.typeOf.object("result", result);
|
2755
|
+
result.x = cartesian.x * scalar;
|
2756
|
+
result.y = cartesian.y * scalar;
|
2757
|
+
return result;
|
2758
|
+
};
|
2759
|
+
Cartesian2.divideByScalar = function(cartesian, scalar, result) {
|
2760
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2761
|
+
Check_default.typeOf.number("scalar", scalar);
|
2762
|
+
Check_default.typeOf.object("result", result);
|
2763
|
+
result.x = cartesian.x / scalar;
|
2764
|
+
result.y = cartesian.y / scalar;
|
2765
|
+
return result;
|
2766
|
+
};
|
2767
|
+
Cartesian2.negate = function(cartesian, result) {
|
2768
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2769
|
+
Check_default.typeOf.object("result", result);
|
2770
|
+
result.x = -cartesian.x;
|
2771
|
+
result.y = -cartesian.y;
|
2772
|
+
return result;
|
2773
|
+
};
|
2774
|
+
Cartesian2.abs = function(cartesian, result) {
|
2775
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2776
|
+
Check_default.typeOf.object("result", result);
|
2777
|
+
result.x = Math.abs(cartesian.x);
|
2778
|
+
result.y = Math.abs(cartesian.y);
|
2779
|
+
return result;
|
2780
|
+
};
|
2781
|
+
var lerpScratch2 = new Cartesian2();
|
2782
|
+
Cartesian2.lerp = function(start, end, t, result) {
|
2783
|
+
Check_default.typeOf.object("start", start);
|
2784
|
+
Check_default.typeOf.object("end", end);
|
2785
|
+
Check_default.typeOf.number("t", t);
|
2786
|
+
Check_default.typeOf.object("result", result);
|
2787
|
+
Cartesian2.multiplyByScalar(end, t, lerpScratch2);
|
2788
|
+
result = Cartesian2.multiplyByScalar(start, 1 - t, result);
|
2789
|
+
return Cartesian2.add(lerpScratch2, result, result);
|
2790
|
+
};
|
2791
|
+
var angleBetweenScratch = new Cartesian2();
|
2792
|
+
var angleBetweenScratch2 = new Cartesian2();
|
2793
|
+
Cartesian2.angleBetween = function(left, right) {
|
2794
|
+
Check_default.typeOf.object("left", left);
|
2795
|
+
Check_default.typeOf.object("right", right);
|
2796
|
+
Cartesian2.normalize(left, angleBetweenScratch);
|
2797
|
+
Cartesian2.normalize(right, angleBetweenScratch2);
|
2798
|
+
return Math_default.acosClamped(
|
2799
|
+
Cartesian2.dot(angleBetweenScratch, angleBetweenScratch2)
|
2800
|
+
);
|
2801
|
+
};
|
2802
|
+
var mostOrthogonalAxisScratch2 = new Cartesian2();
|
2803
|
+
Cartesian2.mostOrthogonalAxis = function(cartesian, result) {
|
2804
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
2805
|
+
Check_default.typeOf.object("result", result);
|
2806
|
+
const f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch2);
|
2807
|
+
Cartesian2.abs(f, f);
|
2808
|
+
if (f.x <= f.y) {
|
2809
|
+
result = Cartesian2.clone(Cartesian2.UNIT_X, result);
|
2810
|
+
} else {
|
2811
|
+
result = Cartesian2.clone(Cartesian2.UNIT_Y, result);
|
2812
|
+
}
|
2813
|
+
return result;
|
2814
|
+
};
|
2815
|
+
Cartesian2.equals = function(left, right) {
|
2816
|
+
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y;
|
2817
|
+
};
|
2818
|
+
Cartesian2.equalsArray = function(cartesian, array, offset) {
|
2819
|
+
return cartesian.x === array[offset] && cartesian.y === array[offset + 1];
|
2820
|
+
};
|
2821
|
+
Cartesian2.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
|
2822
|
+
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
2823
|
+
left.x,
|
2824
|
+
right.x,
|
2825
|
+
relativeEpsilon,
|
2826
|
+
absoluteEpsilon
|
2827
|
+
) && Math_default.equalsEpsilon(
|
2828
|
+
left.y,
|
2829
|
+
right.y,
|
2830
|
+
relativeEpsilon,
|
2831
|
+
absoluteEpsilon
|
2832
|
+
);
|
2833
|
+
};
|
2834
|
+
Cartesian2.ZERO = Object.freeze(new Cartesian2(0, 0));
|
2835
|
+
Cartesian2.ONE = Object.freeze(new Cartesian2(1, 1));
|
2836
|
+
Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1, 0));
|
2837
|
+
Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0, 1));
|
2838
|
+
Cartesian2.prototype.clone = function(result) {
|
2839
|
+
return Cartesian2.clone(this, result);
|
2840
|
+
};
|
2841
|
+
Cartesian2.prototype.equals = function(right) {
|
2842
|
+
return Cartesian2.equals(this, right);
|
2843
|
+
};
|
2844
|
+
Cartesian2.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
|
2845
|
+
return Cartesian2.equalsEpsilon(
|
2846
|
+
this,
|
2847
|
+
right,
|
2848
|
+
relativeEpsilon,
|
2849
|
+
absoluteEpsilon
|
2850
|
+
);
|
2851
|
+
};
|
2852
|
+
Cartesian2.prototype.toString = function() {
|
2853
|
+
return `(${this.x}, ${this.y})`;
|
2854
|
+
};
|
2855
|
+
var Cartesian2_default = Cartesian2;
|
2856
|
+
|
2857
|
+
// packages/engine/Source/Core/Matrix2.js
|
2858
|
+
function Matrix2(column0Row0, column1Row0, column0Row1, column1Row1) {
|
2859
|
+
this[0] = defaultValue_default(column0Row0, 0);
|
2860
|
+
this[1] = defaultValue_default(column0Row1, 0);
|
2861
|
+
this[2] = defaultValue_default(column1Row0, 0);
|
2862
|
+
this[3] = defaultValue_default(column1Row1, 0);
|
2863
|
+
}
|
2864
|
+
Matrix2.packedLength = 4;
|
2865
|
+
Matrix2.pack = function(value, array, startingIndex) {
|
2866
|
+
Check_default.typeOf.object("value", value);
|
2867
|
+
Check_default.defined("array", array);
|
2868
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2869
|
+
array[startingIndex++] = value[0];
|
2870
|
+
array[startingIndex++] = value[1];
|
2871
|
+
array[startingIndex++] = value[2];
|
2872
|
+
array[startingIndex++] = value[3];
|
2873
|
+
return array;
|
2874
|
+
};
|
2875
|
+
Matrix2.unpack = function(array, startingIndex, result) {
|
2876
|
+
Check_default.defined("array", array);
|
2877
|
+
startingIndex = defaultValue_default(startingIndex, 0);
|
2878
|
+
if (!defined_default(result)) {
|
2879
|
+
result = new Matrix2();
|
2880
|
+
}
|
2881
|
+
result[0] = array[startingIndex++];
|
2882
|
+
result[1] = array[startingIndex++];
|
2883
|
+
result[2] = array[startingIndex++];
|
2884
|
+
result[3] = array[startingIndex++];
|
2885
|
+
return result;
|
2886
|
+
};
|
2887
|
+
Matrix2.packArray = function(array, result) {
|
2888
|
+
Check_default.defined("array", array);
|
2889
|
+
const length = array.length;
|
2890
|
+
const resultLength = length * 4;
|
2891
|
+
if (!defined_default(result)) {
|
2892
|
+
result = new Array(resultLength);
|
2893
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
2894
|
+
throw new DeveloperError_default(
|
2895
|
+
"If result is a typed array, it must have exactly array.length * 4 elements"
|
2896
|
+
);
|
2897
|
+
} else if (result.length !== resultLength) {
|
2898
|
+
result.length = resultLength;
|
2899
|
+
}
|
2900
|
+
for (let i = 0; i < length; ++i) {
|
2901
|
+
Matrix2.pack(array[i], result, i * 4);
|
2902
|
+
}
|
2903
|
+
return result;
|
2904
|
+
};
|
2905
|
+
Matrix2.unpackArray = function(array, result) {
|
2906
|
+
Check_default.defined("array", array);
|
2907
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
2908
|
+
if (array.length % 4 !== 0) {
|
2909
|
+
throw new DeveloperError_default("array length must be a multiple of 4.");
|
2910
|
+
}
|
2911
|
+
const length = array.length;
|
2912
|
+
if (!defined_default(result)) {
|
2913
|
+
result = new Array(length / 4);
|
2914
|
+
} else {
|
2915
|
+
result.length = length / 4;
|
2916
|
+
}
|
2917
|
+
for (let i = 0; i < length; i += 4) {
|
2918
|
+
const index = i / 4;
|
2919
|
+
result[index] = Matrix2.unpack(array, i, result[index]);
|
2920
|
+
}
|
2921
|
+
return result;
|
2922
|
+
};
|
2923
|
+
Matrix2.clone = function(matrix, result) {
|
2924
|
+
if (!defined_default(matrix)) {
|
2925
|
+
return void 0;
|
2926
|
+
}
|
2927
|
+
if (!defined_default(result)) {
|
2928
|
+
return new Matrix2(matrix[0], matrix[2], matrix[1], matrix[3]);
|
2929
|
+
}
|
2930
|
+
result[0] = matrix[0];
|
2931
|
+
result[1] = matrix[1];
|
2932
|
+
result[2] = matrix[2];
|
2933
|
+
result[3] = matrix[3];
|
2934
|
+
return result;
|
2935
|
+
};
|
2936
|
+
Matrix2.fromArray = Matrix2.unpack;
|
2937
|
+
Matrix2.fromColumnMajorArray = function(values, result) {
|
2938
|
+
Check_default.defined("values", values);
|
2939
|
+
return Matrix2.clone(values, result);
|
2940
|
+
};
|
2941
|
+
Matrix2.fromRowMajorArray = function(values, result) {
|
2942
|
+
Check_default.defined("values", values);
|
2943
|
+
if (!defined_default(result)) {
|
2944
|
+
return new Matrix2(values[0], values[1], values[2], values[3]);
|
2945
|
+
}
|
2946
|
+
result[0] = values[0];
|
2947
|
+
result[1] = values[2];
|
2948
|
+
result[2] = values[1];
|
2949
|
+
result[3] = values[3];
|
2950
|
+
return result;
|
2951
|
+
};
|
2952
|
+
Matrix2.fromScale = function(scale, result) {
|
2953
|
+
Check_default.typeOf.object("scale", scale);
|
2954
|
+
if (!defined_default(result)) {
|
2955
|
+
return new Matrix2(scale.x, 0, 0, scale.y);
|
2956
|
+
}
|
2957
|
+
result[0] = scale.x;
|
2958
|
+
result[1] = 0;
|
2959
|
+
result[2] = 0;
|
2960
|
+
result[3] = scale.y;
|
2961
|
+
return result;
|
2962
|
+
};
|
2963
|
+
Matrix2.fromUniformScale = function(scale, result) {
|
2964
|
+
Check_default.typeOf.number("scale", scale);
|
2965
|
+
if (!defined_default(result)) {
|
2966
|
+
return new Matrix2(scale, 0, 0, scale);
|
2967
|
+
}
|
2968
|
+
result[0] = scale;
|
2969
|
+
result[1] = 0;
|
2970
|
+
result[2] = 0;
|
2971
|
+
result[3] = scale;
|
2972
|
+
return result;
|
2973
|
+
};
|
2974
|
+
Matrix2.fromRotation = function(angle, result) {
|
2975
|
+
Check_default.typeOf.number("angle", angle);
|
2976
|
+
const cosAngle = Math.cos(angle);
|
2977
|
+
const sinAngle = Math.sin(angle);
|
2978
|
+
if (!defined_default(result)) {
|
2979
|
+
return new Matrix2(cosAngle, -sinAngle, sinAngle, cosAngle);
|
2980
|
+
}
|
2981
|
+
result[0] = cosAngle;
|
2982
|
+
result[1] = sinAngle;
|
2983
|
+
result[2] = -sinAngle;
|
2984
|
+
result[3] = cosAngle;
|
2985
|
+
return result;
|
2986
|
+
};
|
2987
|
+
Matrix2.toArray = function(matrix, result) {
|
2988
|
+
Check_default.typeOf.object("matrix", matrix);
|
2989
|
+
if (!defined_default(result)) {
|
2990
|
+
return [matrix[0], matrix[1], matrix[2], matrix[3]];
|
2991
|
+
}
|
2992
|
+
result[0] = matrix[0];
|
2993
|
+
result[1] = matrix[1];
|
2994
|
+
result[2] = matrix[2];
|
2995
|
+
result[3] = matrix[3];
|
2996
|
+
return result;
|
2997
|
+
};
|
2998
|
+
Matrix2.getElementIndex = function(column, row) {
|
2999
|
+
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
3000
|
+
Check_default.typeOf.number.lessThanOrEquals("row", row, 1);
|
3001
|
+
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
3002
|
+
Check_default.typeOf.number.lessThanOrEquals("column", column, 1);
|
3003
|
+
return column * 2 + row;
|
3004
|
+
};
|
3005
|
+
Matrix2.getColumn = function(matrix, index, result) {
|
3006
|
+
Check_default.typeOf.object("matrix", matrix);
|
3007
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3008
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
3009
|
+
Check_default.typeOf.object("result", result);
|
3010
|
+
const startIndex = index * 2;
|
3011
|
+
const x = matrix[startIndex];
|
3012
|
+
const y = matrix[startIndex + 1];
|
3013
|
+
result.x = x;
|
3014
|
+
result.y = y;
|
3015
|
+
return result;
|
3016
|
+
};
|
3017
|
+
Matrix2.setColumn = function(matrix, index, cartesian, result) {
|
3018
|
+
Check_default.typeOf.object("matrix", matrix);
|
3019
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3020
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
3021
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
3022
|
+
Check_default.typeOf.object("result", result);
|
3023
|
+
result = Matrix2.clone(matrix, result);
|
3024
|
+
const startIndex = index * 2;
|
3025
|
+
result[startIndex] = cartesian.x;
|
3026
|
+
result[startIndex + 1] = cartesian.y;
|
3027
|
+
return result;
|
3028
|
+
};
|
3029
|
+
Matrix2.getRow = function(matrix, index, result) {
|
3030
|
+
Check_default.typeOf.object("matrix", matrix);
|
3031
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3032
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
3033
|
+
Check_default.typeOf.object("result", result);
|
3034
|
+
const x = matrix[index];
|
3035
|
+
const y = matrix[index + 2];
|
3036
|
+
result.x = x;
|
3037
|
+
result.y = y;
|
3038
|
+
return result;
|
3039
|
+
};
|
3040
|
+
Matrix2.setRow = function(matrix, index, cartesian, result) {
|
3041
|
+
Check_default.typeOf.object("matrix", matrix);
|
3042
|
+
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3043
|
+
Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
|
3044
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
3045
|
+
Check_default.typeOf.object("result", result);
|
3046
|
+
result = Matrix2.clone(matrix, result);
|
3047
|
+
result[index] = cartesian.x;
|
3048
|
+
result[index + 2] = cartesian.y;
|
3049
|
+
return result;
|
3050
|
+
};
|
3051
|
+
var scaleScratch12 = new Cartesian2_default();
|
3052
|
+
Matrix2.setScale = function(matrix, scale, result) {
|
3053
|
+
Check_default.typeOf.object("matrix", matrix);
|
3054
|
+
Check_default.typeOf.object("scale", scale);
|
3055
|
+
Check_default.typeOf.object("result", result);
|
3056
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch12);
|
3057
|
+
const scaleRatioX = scale.x / existingScale.x;
|
3058
|
+
const scaleRatioY = scale.y / existingScale.y;
|
3059
|
+
result[0] = matrix[0] * scaleRatioX;
|
3060
|
+
result[1] = matrix[1] * scaleRatioX;
|
3061
|
+
result[2] = matrix[2] * scaleRatioY;
|
3062
|
+
result[3] = matrix[3] * scaleRatioY;
|
3063
|
+
return result;
|
3064
|
+
};
|
3065
|
+
var scaleScratch22 = new Cartesian2_default();
|
3066
|
+
Matrix2.setUniformScale = function(matrix, scale, result) {
|
3067
|
+
Check_default.typeOf.object("matrix", matrix);
|
3068
|
+
Check_default.typeOf.number("scale", scale);
|
3069
|
+
Check_default.typeOf.object("result", result);
|
3070
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch22);
|
3071
|
+
const scaleRatioX = scale / existingScale.x;
|
3072
|
+
const scaleRatioY = scale / existingScale.y;
|
3073
|
+
result[0] = matrix[0] * scaleRatioX;
|
3074
|
+
result[1] = matrix[1] * scaleRatioX;
|
3075
|
+
result[2] = matrix[2] * scaleRatioY;
|
3076
|
+
result[3] = matrix[3] * scaleRatioY;
|
3077
|
+
return result;
|
3078
|
+
};
|
3079
|
+
var scratchColumn2 = new Cartesian2_default();
|
3080
|
+
Matrix2.getScale = function(matrix, result) {
|
3081
|
+
Check_default.typeOf.object("matrix", matrix);
|
3082
|
+
Check_default.typeOf.object("result", result);
|
3083
|
+
result.x = Cartesian2_default.magnitude(
|
3084
|
+
Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn2)
|
3085
|
+
);
|
3086
|
+
result.y = Cartesian2_default.magnitude(
|
3087
|
+
Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn2)
|
3088
|
+
);
|
3089
|
+
return result;
|
3090
|
+
};
|
3091
|
+
var scaleScratch32 = new Cartesian2_default();
|
3092
|
+
Matrix2.getMaximumScale = function(matrix) {
|
3093
|
+
Matrix2.getScale(matrix, scaleScratch32);
|
3094
|
+
return Cartesian2_default.maximumComponent(scaleScratch32);
|
3095
|
+
};
|
3096
|
+
var scaleScratch42 = new Cartesian2_default();
|
3097
|
+
Matrix2.setRotation = function(matrix, rotation, result) {
|
3098
|
+
Check_default.typeOf.object("matrix", matrix);
|
3099
|
+
Check_default.typeOf.object("result", result);
|
3100
|
+
const scale = Matrix2.getScale(matrix, scaleScratch42);
|
3101
|
+
result[0] = rotation[0] * scale.x;
|
3102
|
+
result[1] = rotation[1] * scale.x;
|
3103
|
+
result[2] = rotation[2] * scale.y;
|
3104
|
+
result[3] = rotation[3] * scale.y;
|
3105
|
+
return result;
|
3106
|
+
};
|
3107
|
+
var scaleScratch52 = new Cartesian2_default();
|
3108
|
+
Matrix2.getRotation = function(matrix, result) {
|
3109
|
+
Check_default.typeOf.object("matrix", matrix);
|
3110
|
+
Check_default.typeOf.object("result", result);
|
3111
|
+
const scale = Matrix2.getScale(matrix, scaleScratch52);
|
3112
|
+
result[0] = matrix[0] / scale.x;
|
3113
|
+
result[1] = matrix[1] / scale.x;
|
3114
|
+
result[2] = matrix[2] / scale.y;
|
3115
|
+
result[3] = matrix[3] / scale.y;
|
3116
|
+
return result;
|
3117
|
+
};
|
3118
|
+
Matrix2.multiply = function(left, right, result) {
|
3119
|
+
Check_default.typeOf.object("left", left);
|
3120
|
+
Check_default.typeOf.object("right", right);
|
3121
|
+
Check_default.typeOf.object("result", result);
|
3122
|
+
const column0Row0 = left[0] * right[0] + left[2] * right[1];
|
3123
|
+
const column1Row0 = left[0] * right[2] + left[2] * right[3];
|
3124
|
+
const column0Row1 = left[1] * right[0] + left[3] * right[1];
|
3125
|
+
const column1Row1 = left[1] * right[2] + left[3] * right[3];
|
3126
|
+
result[0] = column0Row0;
|
3127
|
+
result[1] = column0Row1;
|
3128
|
+
result[2] = column1Row0;
|
3129
|
+
result[3] = column1Row1;
|
3130
|
+
return result;
|
3131
|
+
};
|
3132
|
+
Matrix2.add = function(left, right, result) {
|
3133
|
+
Check_default.typeOf.object("left", left);
|
3134
|
+
Check_default.typeOf.object("right", right);
|
3135
|
+
Check_default.typeOf.object("result", result);
|
3136
|
+
result[0] = left[0] + right[0];
|
3137
|
+
result[1] = left[1] + right[1];
|
3138
|
+
result[2] = left[2] + right[2];
|
3139
|
+
result[3] = left[3] + right[3];
|
3140
|
+
return result;
|
3141
|
+
};
|
3142
|
+
Matrix2.subtract = function(left, right, result) {
|
3143
|
+
Check_default.typeOf.object("left", left);
|
3144
|
+
Check_default.typeOf.object("right", right);
|
3145
|
+
Check_default.typeOf.object("result", result);
|
3146
|
+
result[0] = left[0] - right[0];
|
3147
|
+
result[1] = left[1] - right[1];
|
3148
|
+
result[2] = left[2] - right[2];
|
3149
|
+
result[3] = left[3] - right[3];
|
3150
|
+
return result;
|
3151
|
+
};
|
3152
|
+
Matrix2.multiplyByVector = function(matrix, cartesian, result) {
|
3153
|
+
Check_default.typeOf.object("matrix", matrix);
|
3154
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
3155
|
+
Check_default.typeOf.object("result", result);
|
3156
|
+
const x = matrix[0] * cartesian.x + matrix[2] * cartesian.y;
|
3157
|
+
const y = matrix[1] * cartesian.x + matrix[3] * cartesian.y;
|
3158
|
+
result.x = x;
|
3159
|
+
result.y = y;
|
3160
|
+
return result;
|
3161
|
+
};
|
3162
|
+
Matrix2.multiplyByScalar = function(matrix, scalar, result) {
|
3163
|
+
Check_default.typeOf.object("matrix", matrix);
|
3164
|
+
Check_default.typeOf.number("scalar", scalar);
|
3165
|
+
Check_default.typeOf.object("result", result);
|
3166
|
+
result[0] = matrix[0] * scalar;
|
3167
|
+
result[1] = matrix[1] * scalar;
|
3168
|
+
result[2] = matrix[2] * scalar;
|
3169
|
+
result[3] = matrix[3] * scalar;
|
3170
|
+
return result;
|
3171
|
+
};
|
3172
|
+
Matrix2.multiplyByScale = function(matrix, scale, result) {
|
3173
|
+
Check_default.typeOf.object("matrix", matrix);
|
3174
|
+
Check_default.typeOf.object("scale", scale);
|
3175
|
+
Check_default.typeOf.object("result", result);
|
3176
|
+
result[0] = matrix[0] * scale.x;
|
3177
|
+
result[1] = matrix[1] * scale.x;
|
3178
|
+
result[2] = matrix[2] * scale.y;
|
3179
|
+
result[3] = matrix[3] * scale.y;
|
3180
|
+
return result;
|
3181
|
+
};
|
3182
|
+
Matrix2.multiplyByUniformScale = function(matrix, scale, result) {
|
3183
|
+
Check_default.typeOf.object("matrix", matrix);
|
3184
|
+
Check_default.typeOf.number("scale", scale);
|
3185
|
+
Check_default.typeOf.object("result", result);
|
3186
|
+
result[0] = matrix[0] * scale;
|
3187
|
+
result[1] = matrix[1] * scale;
|
3188
|
+
result[2] = matrix[2] * scale;
|
3189
|
+
result[3] = matrix[3] * scale;
|
3190
|
+
return result;
|
3191
|
+
};
|
3192
|
+
Matrix2.negate = function(matrix, result) {
|
3193
|
+
Check_default.typeOf.object("matrix", matrix);
|
3194
|
+
Check_default.typeOf.object("result", result);
|
3195
|
+
result[0] = -matrix[0];
|
3196
|
+
result[1] = -matrix[1];
|
3197
|
+
result[2] = -matrix[2];
|
3198
|
+
result[3] = -matrix[3];
|
3199
|
+
return result;
|
3200
|
+
};
|
3201
|
+
Matrix2.transpose = function(matrix, result) {
|
3202
|
+
Check_default.typeOf.object("matrix", matrix);
|
3203
|
+
Check_default.typeOf.object("result", result);
|
3204
|
+
const column0Row0 = matrix[0];
|
3205
|
+
const column0Row1 = matrix[2];
|
3206
|
+
const column1Row0 = matrix[1];
|
3207
|
+
const column1Row1 = matrix[3];
|
3208
|
+
result[0] = column0Row0;
|
3209
|
+
result[1] = column0Row1;
|
3210
|
+
result[2] = column1Row0;
|
3211
|
+
result[3] = column1Row1;
|
3212
|
+
return result;
|
3213
|
+
};
|
3214
|
+
Matrix2.abs = function(matrix, result) {
|
3215
|
+
Check_default.typeOf.object("matrix", matrix);
|
3216
|
+
Check_default.typeOf.object("result", result);
|
3217
|
+
result[0] = Math.abs(matrix[0]);
|
3218
|
+
result[1] = Math.abs(matrix[1]);
|
3219
|
+
result[2] = Math.abs(matrix[2]);
|
3220
|
+
result[3] = Math.abs(matrix[3]);
|
3221
|
+
return result;
|
3222
|
+
};
|
3223
|
+
Matrix2.equals = function(left, right) {
|
3224
|
+
return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3];
|
3225
|
+
};
|
3226
|
+
Matrix2.equalsArray = function(matrix, array, offset) {
|
3227
|
+
return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3];
|
3228
|
+
};
|
3229
|
+
Matrix2.equalsEpsilon = function(left, right, epsilon) {
|
3230
|
+
epsilon = defaultValue_default(epsilon, 0);
|
3231
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon;
|
3232
|
+
};
|
3233
|
+
Matrix2.IDENTITY = Object.freeze(new Matrix2(1, 0, 0, 1));
|
3234
|
+
Matrix2.ZERO = Object.freeze(new Matrix2(0, 0, 0, 0));
|
3235
|
+
Matrix2.COLUMN0ROW0 = 0;
|
3236
|
+
Matrix2.COLUMN0ROW1 = 1;
|
3237
|
+
Matrix2.COLUMN1ROW0 = 2;
|
3238
|
+
Matrix2.COLUMN1ROW1 = 3;
|
3239
|
+
Object.defineProperties(Matrix2.prototype, {
|
3240
|
+
/**
|
3241
|
+
* Gets the number of items in the collection.
|
3242
|
+
* @memberof Matrix2.prototype
|
3243
|
+
*
|
3244
|
+
* @type {number}
|
3245
|
+
*/
|
3246
|
+
length: {
|
3247
|
+
get: function() {
|
3248
|
+
return Matrix2.packedLength;
|
3249
|
+
}
|
3250
|
+
}
|
3251
|
+
});
|
3252
|
+
Matrix2.prototype.clone = function(result) {
|
3253
|
+
return Matrix2.clone(this, result);
|
3254
|
+
};
|
3255
|
+
Matrix2.prototype.equals = function(right) {
|
3256
|
+
return Matrix2.equals(this, right);
|
3257
|
+
};
|
3258
|
+
Matrix2.prototype.equalsEpsilon = function(right, epsilon) {
|
3259
|
+
return Matrix2.equalsEpsilon(this, right, epsilon);
|
3260
|
+
};
|
3261
|
+
Matrix2.prototype.toString = function() {
|
3262
|
+
return `(${this[0]}, ${this[2]})
|
3263
|
+
(${this[1]}, ${this[3]})`;
|
3264
|
+
};
|
3265
|
+
var Matrix2_default = Matrix2;
|
3266
|
+
|
3267
|
+
export {
|
3268
|
+
Cartesian4_default,
|
3269
|
+
Matrix4_default,
|
3270
|
+
Rectangle_default,
|
3271
|
+
Cartesian2_default,
|
3272
|
+
Matrix2_default
|
3273
|
+
};
|