@vcmap/ui 5.0.0-rc.29 → 5.0.0-rc.31
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/build/buildHelpers.js +4 -3
- package/config/base.config.json +5 -4
- package/config/dev.config.json +8 -0
- package/config/graphFeatureInfo.config.json +1 -1
- package/config/projects.config.json +2 -2
- package/dist/assets/cesium/ThirdParty/Workers/basis_transcoder.js +1 -1
- 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/{package.js → chunk-MPAZH4BF.js} +13 -2
- 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 +65 -15
- package/dist/assets/cesium/Workers/createBoxGeometry.js +55 -10
- package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +231 -310
- package/dist/assets/cesium/Workers/createCircleGeometry.js +185 -202
- package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +141 -155
- package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +477 -557
- package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
- package/dist/assets/cesium/Workers/createCorridorGeometry.js +1162 -1307
- package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +533 -569
- package/dist/assets/cesium/Workers/createCylinderGeometry.js +57 -10
- package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +224 -258
- package/dist/assets/cesium/Workers/createEllipseGeometry.js +68 -12
- package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +61 -12
- package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +56 -10
- package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +58 -13
- package/dist/assets/cesium/Workers/createFrustumGeometry.js +55 -10
- package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +226 -243
- package/dist/assets/cesium/Workers/createGeometry.js +143 -48
- package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +1484 -2011
- package/dist/assets/cesium/Workers/createPlaneGeometry.js +216 -243
- package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +121 -113
- package/dist/assets/cesium/Workers/createPolygonGeometry.js +1041 -1327
- package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +516 -657
- package/dist/assets/cesium/Workers/createPolylineGeometry.js +471 -547
- package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +352 -384
- package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +271 -295
- package/dist/assets/cesium/Workers/createRectangleGeometry.js +1128 -1331
- package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +445 -500
- package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +381 -440
- package/dist/assets/cesium/Workers/createSphereGeometry.js +112 -118
- package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +112 -121
- package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +32 -127
- package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +462 -505
- package/dist/assets/cesium/Workers/createVectorTileGeometries.js +377 -436
- package/dist/assets/cesium/Workers/createVectorTilePoints.js +110 -77
- package/dist/assets/cesium/Workers/createVectorTilePolygons.js +369 -391
- package/dist/assets/cesium/Workers/createVectorTilePolylines.js +252 -244
- package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
- package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2244 -2677
- package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -926
- package/dist/assets/cesium/Workers/createWallGeometry.js +459 -593
- package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +324 -419
- package/dist/assets/cesium/Workers/decodeDraco.js +327 -347
- package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
- package/dist/assets/cesium/Workers/decodeI3S.js +765 -970
- package/dist/assets/cesium/Workers/transcodeKTX2.js +3353 -1464
- package/dist/assets/cesium/Workers/transferTypedArrayTest.js +3 -4
- package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +748 -953
- package/dist/assets/{cesium.16590b.js → cesium.77d0f7.js} +8915 -13165
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/{core.74da2a.js → core.720589.js} +3421 -3365
- package/dist/assets/core.js +1 -1
- package/dist/assets/index-dd539204.js +1 -0
- package/dist/assets/{ol.50a512.js → ol.e48649.js} +4 -4
- package/dist/assets/ol.js +1 -1
- package/dist/assets/{ui.d3054c.css → ui.50452a.css} +2 -2
- package/dist/assets/{ui.d3054c.js → ui.50452a.js} +5312 -4776
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.js +2 -2
- package/dist/assets/{vuetify.946bd8.js → vuetify.f0a769.js} +1 -1
- package/dist/assets/vuetify.js +2 -2
- package/dist/index.html +27 -23
- package/index.html +23 -22
- package/index.js +6 -0
- package/package.json +5 -5
- package/plugins/@vcmap-show-case/form-inputs-example/FormInputsExample.vue +37 -1
- package/plugins/@vcmap-show-case/form-inputs-example/index.js +3 -0
- package/plugins/@vcmap-show-case/form-inputs-example/validation.js +11 -0
- package/plugins/@vcmap-show-case/plugin-editors/PluginEditors.vue +119 -0
- package/plugins/@vcmap-show-case/plugin-editors/index.js +41 -0
- package/plugins/@vcmap-show-case/plugin-editors/package.json +5 -0
- package/plugins/{@vcmap → @vcmap-show-case}/project-selector/ProjectSelectorComponent.vue +1 -1
- package/plugins/{@vcmap → @vcmap-show-case}/project-selector/config.json +2 -2
- package/plugins/{@vcmap → @vcmap-show-case}/project-selector/package.json +1 -1
- package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/package.json +1 -1
- package/plugins/@vcmap-show-case/style-input-example/styleExample.vue +0 -1
- package/plugins/@vcmap-show-case/table-example/DataTableExample.vue +1 -1
- package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/ThemeChangerComponent.vue +1 -1
- package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/config.json +2 -2
- package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/package.json +1 -1
- package/plugins/@vcmap-show-case/vector-properties-example/index.js +40 -0
- package/plugins/@vcmap-show-case/vector-properties-example/package.json +5 -0
- package/plugins/@vcmap-show-case/vector-properties-example/vectorPropertiesExample.vue +128 -0
- package/plugins/package.json +6 -2
- package/src/application/VcsAttributions.vue +27 -20
- package/src/components/form-inputs-controls/VcsChipArrayInput.vue +290 -0
- package/src/components/form-inputs-controls/VcsSlider.vue +1 -0
- package/src/components/form-inputs-controls/VcsTextField.vue +9 -3
- package/src/components/icons/2DAreaIcon.vue +2 -17
- package/src/components/icons/2DDistanceIcon.vue +0 -3
- package/src/components/icons/3DAreaIcon.vue +2 -17
- package/src/components/icons/3DDistanceIcon.vue +0 -3
- package/src/components/icons/3DHeightIcon.vue +0 -3
- package/src/components/icons/AngleIcon.vue +0 -1
- package/src/components/icons/AssociationsIcon.vue +1 -3
- package/src/components/icons/AxisIcon.vue +0 -4
- package/src/components/icons/BoundingBoxIcon.vue +1 -4
- package/src/components/icons/CheckboxIcon.vue +0 -2
- package/src/components/icons/CheckboxIndeterminateIcon.vue +1 -5
- package/src/components/icons/CircleIcon.vue +1 -6
- package/src/components/icons/ClippingHorizontalIcon.vue +0 -1
- package/src/components/icons/ClippingIcon.vue +0 -1
- package/src/components/icons/ClippingVerticalIcon.vue +0 -1
- package/src/components/icons/ColorPickerIcon.vue +0 -1
- package/src/components/icons/ColorSwatchIcon.vue +0 -2
- package/src/components/icons/CommentIcon.vue +0 -1
- package/src/components/icons/CompassIcon.vue +0 -2
- package/src/components/icons/ComponentsIcon.vue +0 -1
- package/src/components/icons/ConeIcon.vue +1 -4
- package/src/components/icons/DimensionsHouseIcon.vue +0 -2
- package/src/components/icons/EditIcon.vue +0 -1
- package/src/components/icons/EditVerticesIcon.vue +0 -4
- package/src/components/icons/ElevationProfileIcon.vue +1 -13
- package/src/components/icons/ExportAreaIcon.vue +0 -1
- package/src/components/icons/ExportFlightIcon.vue +0 -1
- package/src/components/icons/ExportIcon.vue +12 -8
- package/src/components/icons/ExternalLinkIcon.vue +0 -2
- package/src/components/icons/FastForwardIcon.vue +0 -1
- package/src/components/icons/FilterIcon.vue +0 -1
- package/src/components/icons/GlobeNatureIcon.vue +0 -3
- package/src/components/icons/GroundIcon.vue +0 -1
- package/src/components/icons/HealthCareIndustriesIcon.vue +1 -11
- package/src/components/icons/HideIcon.vue +0 -1
- package/src/components/icons/HomePointIcon.vue +0 -1
- package/src/components/icons/HospitalsIcon.vue +1 -20
- package/src/components/icons/HouseIcon.vue +3 -13
- package/src/components/icons/ImportIcon.vue +6 -14
- package/src/components/icons/InfoIcon.vue +0 -2
- package/src/components/icons/KebabIcon.vue +1 -9
- package/src/components/icons/LabelIcon.vue +0 -2
- package/src/components/icons/LayersIcon.vue +1 -9
- package/src/components/icons/LegendIcon.vue +0 -1
- package/src/components/icons/LineIcon.vue +0 -2
- package/src/components/icons/LinkIcon.vue +0 -1
- package/src/components/icons/LogoutIcon.vue +0 -1
- package/src/components/icons/MapIcon.vue +0 -2
- package/src/components/icons/MenuIcon.vue +1 -5
- package/src/components/icons/MinusIcon.vue +0 -2
- package/src/components/icons/ObjectSelectIcon.vue +0 -2
- package/src/components/icons/ObliqueViewIcon.vue +0 -1
- package/src/components/icons/PdfIcon.vue +0 -1
- package/src/components/icons/PedestrianIcon.vue +0 -1
- package/src/components/icons/PenIcon.vue +0 -1
- package/src/components/icons/PlayCircleIcon.vue +1 -8
- package/src/components/icons/PlusIcon.vue +0 -2
- package/src/components/icons/PoiIcon.vue +0 -1
- package/src/components/icons/PointIcon.vue +2 -6
- package/src/components/icons/PointSelectIcon.vue +0 -1
- package/src/components/icons/PresentationModeIcon.vue +0 -1
- package/src/components/icons/ProgressIcon.vue +1 -1
- package/src/components/icons/QueryIcon.vue +0 -1
- package/src/components/icons/RectangleIcon.vue +1 -6
- package/src/components/icons/ReturnIcon.vue +0 -1
- package/src/components/icons/RewindIcon.vue +0 -1
- package/src/components/icons/RotateLeftIcon.vue +0 -1
- package/src/components/icons/RotateRightIcon.vue +0 -1
- package/src/components/icons/ScreenshotIcon.vue +1 -6
- package/src/components/icons/SearchIcon.vue +0 -1
- package/src/components/icons/ShadowIcon.vue +0 -2
- package/src/components/icons/ShapesIcon.vue +1 -4
- package/src/components/icons/ShareIcon.vue +0 -1
- package/src/components/icons/SimpleCircleFilledIcon.vue +0 -1
- package/src/components/icons/SimpleCircleHalfFilledIcon.vue +0 -1
- package/src/components/icons/SimpleCircleOutlinedIcon.vue +1 -7
- package/src/components/icons/SkipPreviousIcon.vue +1 -6
- package/src/components/icons/SplitViewIcon.vue +0 -1
- package/src/components/icons/TextStyleIcon.vue +0 -3
- package/src/components/icons/ThreeDimensionsIcon.vue +0 -1
- package/src/components/icons/ToolsIcon.vue +0 -1
- package/src/components/icons/TouchIcon.vue +0 -1
- package/src/components/icons/TriangleIcon.vue +0 -3
- package/src/components/icons/TwoDimensionsIcon.vue +0 -2
- package/src/components/icons/UploadIcon.vue +0 -1
- package/src/components/icons/UserProfileIcon.vue +0 -1
- package/src/components/icons/UserShareIcon.vue +0 -1
- package/src/components/icons/ViewpointFlightIcon.vue +0 -1
- package/src/components/icons/ViewpointIcon.vue +0 -1
- package/src/components/icons/Viewshed360Icon.vue +0 -1
- package/src/components/icons/ViewshedConeIcon.vue +0 -1
- package/src/components/icons/ViewshedIcon.vue +0 -1
- package/src/components/icons/WalkingIcon.vue +0 -1
- package/src/components/icons/WallIcon.vue +1 -4
- package/src/components/icons/WandIcon.vue +22 -70
- package/src/components/lists/VcsList.vue +18 -12
- package/src/components/plugins/AbstractConfigEditor.vue +84 -0
- package/src/components/style/VcsImageSelector.vue +6 -5
- package/src/components/style/VcsTextSelector.vue +1 -1
- package/src/components/tables/VcsDataTable.vue +1 -1
- package/src/components/vector-properties/VcsVectorPropertiesComponent.vue +780 -0
- package/src/components/vector-properties/composables.js +93 -0
- package/src/contentTree/contentTreeCollection.js +30 -9
- package/src/i18n/de.js +41 -7
- package/src/i18n/en.js +39 -5
- package/src/i18n/i18nCollection.js +19 -65
- package/src/manager/buttonManager.js +4 -0
- package/src/manager/collectionManager/collectionComponent.js +1 -1
- package/src/manager/contextMenu/contextMenuManager.js +2 -0
- package/src/pluginHelper.js +57 -17
- package/src/vcsUiApp.js +25 -30
- package/src/vuePlugins/i18n.js +0 -8
- package/dist/assets/cesium/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
- package/dist/assets/cesium/Workers/ArcType-2d9abbbc.js +0 -37
- package/dist/assets/cesium/Workers/AttributeCompression-f9f6c717.js +0 -716
- package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-4140c51f.js +0 -258
- package/dist/assets/cesium/Workers/BoundingRectangle-c714b156.js +0 -369
- package/dist/assets/cesium/Workers/BoxGeometry-6f3da43d.js +0 -884
- package/dist/assets/cesium/Workers/Check-6ede7e26.js +0 -290
- package/dist/assets/cesium/Workers/Color-8a565ff2.js +0 -2262
- package/dist/assets/cesium/Workers/ComponentDatatype-cf1fa08e.js +0 -341
- package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-4b4d4096.js +0 -132
- package/dist/assets/cesium/Workers/CorridorGeometryLibrary-7b94502b.js +0 -498
- package/dist/assets/cesium/Workers/CylinderGeometry-ca070b87.js +0 -467
- package/dist/assets/cesium/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
- package/dist/assets/cesium/Workers/EllipseGeometry-122e51fa.js +0 -1304
- package/dist/assets/cesium/Workers/EllipseGeometryLibrary-4d326efc.js +0 -366
- package/dist/assets/cesium/Workers/EllipseOutlineGeometry-16cc2bd7.js +0 -443
- package/dist/assets/cesium/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
- package/dist/assets/cesium/Workers/EllipsoidGeometry-cb148ca2.js +0 -637
- package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-0fa10c79.js +0 -454
- package/dist/assets/cesium/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
- package/dist/assets/cesium/Workers/EllipsoidTangentPlane-6dd1b7af.js +0 -373
- package/dist/assets/cesium/Workers/EncodedCartesian3-57415c8a.js +0 -171
- package/dist/assets/cesium/Workers/FrustumGeometry-ee73037c.js +0 -2540
- package/dist/assets/cesium/Workers/GeometryAttribute-ff5b4fb1.js +0 -619
- package/dist/assets/cesium/Workers/GeometryAttributes-ad136444.js +0 -91
- package/dist/assets/cesium/Workers/GeometryInstance-34d9e21e.js +0 -121
- package/dist/assets/cesium/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
- package/dist/assets/cesium/Workers/GeometryPipeline-1f8fbf05.js +0 -3690
- package/dist/assets/cesium/Workers/IndexDatatype-2643aa47.js +0 -200
- package/dist/assets/cesium/Workers/IntersectionTests-70d39ba9.js +0 -1836
- package/dist/assets/cesium/Workers/Math-0a2ac845.js +0 -1340
- package/dist/assets/cesium/Workers/Matrix2-e1298525.js +0 -7086
- package/dist/assets/cesium/Workers/Matrix3-41c58dde.js +0 -4283
- package/dist/assets/cesium/Workers/OrientedBoundingBox-159cf1d6.js +0 -1259
- package/dist/assets/cesium/Workers/Plane-4c3d403b.js +0 -309
- package/dist/assets/cesium/Workers/PolygonGeometryLibrary-076a5d25.js +0 -1074
- package/dist/assets/cesium/Workers/PolygonPipeline-b9f2810a.js +0 -1344
- package/dist/assets/cesium/Workers/PolylinePipeline-639192e0.js +0 -573
- package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-b73549fb.js +0 -781
- package/dist/assets/cesium/Workers/PrimitivePipeline-10ede1b6.js +0 -966
- package/dist/assets/cesium/Workers/RectangleGeometryLibrary-c35a7356.js +0 -280
- package/dist/assets/cesium/Workers/RuntimeError-ef395448.js +0 -68
- package/dist/assets/cesium/Workers/TerrainEncoding-668d242f.js +0 -1227
- package/dist/assets/cesium/Workers/Transforms-a2a85221.js +0 -14712
- package/dist/assets/cesium/Workers/VertexFormat-030f11ff.js +0 -312
- package/dist/assets/cesium/Workers/WallGeometryLibrary-1938bf0d.js +0 -211
- package/dist/assets/cesium/Workers/WebGLConstants-0b1ce7ba.js +0 -620
- package/dist/assets/cesium/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
- package/dist/assets/cesium/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
- package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +0 -1363
- package/dist/assets/cesium/Workers/combine-d9581036.js +0 -82
- package/dist/assets/cesium/Workers/defaultValue-fe22d8c0.js +0 -51
- package/dist/assets/index-cb070eff.js +0 -1
- package/plugins/@vcmap/create-link/fallbackCreateLink.vue +0 -76
- package/plugins/@vcmap/create-link/index.js +0 -95
- package/plugins/@vcmap/create-link/package.json +0 -6
- package/plugins/@vcmap/search-nominatim/LICENSE.md +0 -13
- package/plugins/@vcmap/search-nominatim/README.md +0 -3
- package/plugins/@vcmap/search-nominatim/config.json +0 -3
- package/plugins/@vcmap/search-nominatim/index.js +0 -29
- package/plugins/@vcmap/search-nominatim/nominatim.js +0 -175
- package/plugins/@vcmap/search-nominatim/package.json +0 -9
- /package/dist/assets/{vue.30740e.js → vue.5d696e.js} +0 -0
- /package/dist/assets/{vuetify.946bd8.css → vuetify.f0a769.css} +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/ModulesListComponent.vue +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/README.md +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/de.json +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/en.json +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/project-selector/index.js +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/README.md +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/SimpleGraphComponent.vue +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/index.js +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/simple-graph/simpleGraphView.js +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/README.md +0 -0
- /package/plugins/{@vcmap → @vcmap-show-case}/theme-changer/index.js +0 -0
@@ -1,4283 +0,0 @@
|
|
1
|
-
define(['exports', './Check-6ede7e26', './defaultValue-fe22d8c0', './Math-0a2ac845'], (function (exports, Check, defaultValue, Math$1) { 'use strict';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* A 3D Cartesian point.
|
5
|
-
* @alias Cartesian3
|
6
|
-
* @constructor
|
7
|
-
*
|
8
|
-
* @param {number} [x=0.0] The X component.
|
9
|
-
* @param {number} [y=0.0] The Y component.
|
10
|
-
* @param {number} [z=0.0] The Z component.
|
11
|
-
*
|
12
|
-
* @see Cartesian2
|
13
|
-
* @see Cartesian4
|
14
|
-
* @see Packable
|
15
|
-
*/
|
16
|
-
function Cartesian3(x, y, z) {
|
17
|
-
/**
|
18
|
-
* The X component.
|
19
|
-
* @type {number}
|
20
|
-
* @default 0.0
|
21
|
-
*/
|
22
|
-
this.x = defaultValue.defaultValue(x, 0.0);
|
23
|
-
|
24
|
-
/**
|
25
|
-
* The Y component.
|
26
|
-
* @type {number}
|
27
|
-
* @default 0.0
|
28
|
-
*/
|
29
|
-
this.y = defaultValue.defaultValue(y, 0.0);
|
30
|
-
|
31
|
-
/**
|
32
|
-
* The Z component.
|
33
|
-
* @type {number}
|
34
|
-
* @default 0.0
|
35
|
-
*/
|
36
|
-
this.z = defaultValue.defaultValue(z, 0.0);
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* Converts the provided Spherical into Cartesian3 coordinates.
|
41
|
-
*
|
42
|
-
* @param {Spherical} spherical The Spherical to be converted to Cartesian3.
|
43
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
44
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
45
|
-
*/
|
46
|
-
Cartesian3.fromSpherical = function (spherical, result) {
|
47
|
-
//>>includeStart('debug', pragmas.debug);
|
48
|
-
Check.Check.typeOf.object("spherical", spherical);
|
49
|
-
//>>includeEnd('debug');
|
50
|
-
|
51
|
-
if (!defaultValue.defined(result)) {
|
52
|
-
result = new Cartesian3();
|
53
|
-
}
|
54
|
-
|
55
|
-
const clock = spherical.clock;
|
56
|
-
const cone = spherical.cone;
|
57
|
-
const magnitude = defaultValue.defaultValue(spherical.magnitude, 1.0);
|
58
|
-
const radial = magnitude * Math.sin(cone);
|
59
|
-
result.x = radial * Math.cos(clock);
|
60
|
-
result.y = radial * Math.sin(clock);
|
61
|
-
result.z = magnitude * Math.cos(cone);
|
62
|
-
return result;
|
63
|
-
};
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Creates a Cartesian3 instance from x, y and z coordinates.
|
67
|
-
*
|
68
|
-
* @param {number} x The x coordinate.
|
69
|
-
* @param {number} y The y coordinate.
|
70
|
-
* @param {number} z The z coordinate.
|
71
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
72
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
73
|
-
*/
|
74
|
-
Cartesian3.fromElements = function (x, y, z, result) {
|
75
|
-
if (!defaultValue.defined(result)) {
|
76
|
-
return new Cartesian3(x, y, z);
|
77
|
-
}
|
78
|
-
|
79
|
-
result.x = x;
|
80
|
-
result.y = y;
|
81
|
-
result.z = z;
|
82
|
-
return result;
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Duplicates a Cartesian3 instance.
|
87
|
-
*
|
88
|
-
* @param {Cartesian3} cartesian The Cartesian to duplicate.
|
89
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
90
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)
|
91
|
-
*/
|
92
|
-
Cartesian3.clone = function (cartesian, result) {
|
93
|
-
if (!defaultValue.defined(cartesian)) {
|
94
|
-
return undefined;
|
95
|
-
}
|
96
|
-
if (!defaultValue.defined(result)) {
|
97
|
-
return new Cartesian3(cartesian.x, cartesian.y, cartesian.z);
|
98
|
-
}
|
99
|
-
|
100
|
-
result.x = cartesian.x;
|
101
|
-
result.y = cartesian.y;
|
102
|
-
result.z = cartesian.z;
|
103
|
-
return result;
|
104
|
-
};
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the
|
108
|
-
* x, y, and z properties of the Cartesian4 and drops w.
|
109
|
-
* @function
|
110
|
-
*
|
111
|
-
* @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian3 instance from.
|
112
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
113
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
114
|
-
*/
|
115
|
-
Cartesian3.fromCartesian4 = Cartesian3.clone;
|
116
|
-
|
117
|
-
/**
|
118
|
-
* The number of elements used to pack the object into an array.
|
119
|
-
* @type {number}
|
120
|
-
*/
|
121
|
-
Cartesian3.packedLength = 3;
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Stores the provided instance into the provided array.
|
125
|
-
*
|
126
|
-
* @param {Cartesian3} value The value to pack.
|
127
|
-
* @param {number[]} array The array to pack into.
|
128
|
-
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
129
|
-
*
|
130
|
-
* @returns {number[]} The array that was packed into
|
131
|
-
*/
|
132
|
-
Cartesian3.pack = function (value, array, startingIndex) {
|
133
|
-
//>>includeStart('debug', pragmas.debug);
|
134
|
-
Check.Check.typeOf.object("value", value);
|
135
|
-
Check.Check.defined("array", array);
|
136
|
-
//>>includeEnd('debug');
|
137
|
-
|
138
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
139
|
-
|
140
|
-
array[startingIndex++] = value.x;
|
141
|
-
array[startingIndex++] = value.y;
|
142
|
-
array[startingIndex] = value.z;
|
143
|
-
|
144
|
-
return array;
|
145
|
-
};
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Retrieves an instance from a packed array.
|
149
|
-
*
|
150
|
-
* @param {number[]} array The packed array.
|
151
|
-
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
152
|
-
* @param {Cartesian3} [result] The object into which to store the result.
|
153
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
154
|
-
*/
|
155
|
-
Cartesian3.unpack = function (array, startingIndex, result) {
|
156
|
-
//>>includeStart('debug', pragmas.debug);
|
157
|
-
Check.Check.defined("array", array);
|
158
|
-
//>>includeEnd('debug');
|
159
|
-
|
160
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
161
|
-
|
162
|
-
if (!defaultValue.defined(result)) {
|
163
|
-
result = new Cartesian3();
|
164
|
-
}
|
165
|
-
result.x = array[startingIndex++];
|
166
|
-
result.y = array[startingIndex++];
|
167
|
-
result.z = array[startingIndex];
|
168
|
-
return result;
|
169
|
-
};
|
170
|
-
|
171
|
-
/**
|
172
|
-
* Flattens an array of Cartesian3s into an array of components.
|
173
|
-
*
|
174
|
-
* @param {Cartesian3[]} array The array of cartesians to pack.
|
175
|
-
* @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 3 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 3) elements.
|
176
|
-
* @returns {number[]} The packed array.
|
177
|
-
*/
|
178
|
-
Cartesian3.packArray = function (array, result) {
|
179
|
-
//>>includeStart('debug', pragmas.debug);
|
180
|
-
Check.Check.defined("array", array);
|
181
|
-
//>>includeEnd('debug');
|
182
|
-
|
183
|
-
const length = array.length;
|
184
|
-
const resultLength = length * 3;
|
185
|
-
if (!defaultValue.defined(result)) {
|
186
|
-
result = new Array(resultLength);
|
187
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
188
|
-
//>>includeStart('debug', pragmas.debug);
|
189
|
-
throw new Check.DeveloperError(
|
190
|
-
"If result is a typed array, it must have exactly array.length * 3 elements"
|
191
|
-
);
|
192
|
-
//>>includeEnd('debug');
|
193
|
-
} else if (result.length !== resultLength) {
|
194
|
-
result.length = resultLength;
|
195
|
-
}
|
196
|
-
|
197
|
-
for (let i = 0; i < length; ++i) {
|
198
|
-
Cartesian3.pack(array[i], result, i * 3);
|
199
|
-
}
|
200
|
-
return result;
|
201
|
-
};
|
202
|
-
|
203
|
-
/**
|
204
|
-
* Unpacks an array of cartesian components into an array of Cartesian3s.
|
205
|
-
*
|
206
|
-
* @param {number[]} array The array of components to unpack.
|
207
|
-
* @param {Cartesian3[]} [result] The array onto which to store the result.
|
208
|
-
* @returns {Cartesian3[]} The unpacked array.
|
209
|
-
*/
|
210
|
-
Cartesian3.unpackArray = function (array, result) {
|
211
|
-
//>>includeStart('debug', pragmas.debug);
|
212
|
-
Check.Check.defined("array", array);
|
213
|
-
Check.Check.typeOf.number.greaterThanOrEquals("array.length", array.length, 3);
|
214
|
-
if (array.length % 3 !== 0) {
|
215
|
-
throw new Check.DeveloperError("array length must be a multiple of 3.");
|
216
|
-
}
|
217
|
-
//>>includeEnd('debug');
|
218
|
-
|
219
|
-
const length = array.length;
|
220
|
-
if (!defaultValue.defined(result)) {
|
221
|
-
result = new Array(length / 3);
|
222
|
-
} else {
|
223
|
-
result.length = length / 3;
|
224
|
-
}
|
225
|
-
|
226
|
-
for (let i = 0; i < length; i += 3) {
|
227
|
-
const index = i / 3;
|
228
|
-
result[index] = Cartesian3.unpack(array, i, result[index]);
|
229
|
-
}
|
230
|
-
return result;
|
231
|
-
};
|
232
|
-
|
233
|
-
/**
|
234
|
-
* Creates a Cartesian3 from three consecutive elements in an array.
|
235
|
-
* @function
|
236
|
-
*
|
237
|
-
* @param {number[]} array The array whose three consecutive elements correspond to the x, y, and z components, respectively.
|
238
|
-
* @param {number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
|
239
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
240
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
241
|
-
*
|
242
|
-
* @example
|
243
|
-
* // Create a Cartesian3 with (1.0, 2.0, 3.0)
|
244
|
-
* const v = [1.0, 2.0, 3.0];
|
245
|
-
* const p = Cesium.Cartesian3.fromArray(v);
|
246
|
-
*
|
247
|
-
* // Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
|
248
|
-
* const v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
|
249
|
-
* const p2 = Cesium.Cartesian3.fromArray(v2, 2);
|
250
|
-
*/
|
251
|
-
Cartesian3.fromArray = Cartesian3.unpack;
|
252
|
-
|
253
|
-
/**
|
254
|
-
* Computes the value of the maximum component for the supplied Cartesian.
|
255
|
-
*
|
256
|
-
* @param {Cartesian3} cartesian The cartesian to use.
|
257
|
-
* @returns {number} The value of the maximum component.
|
258
|
-
*/
|
259
|
-
Cartesian3.maximumComponent = function (cartesian) {
|
260
|
-
//>>includeStart('debug', pragmas.debug);
|
261
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
262
|
-
//>>includeEnd('debug');
|
263
|
-
|
264
|
-
return Math.max(cartesian.x, cartesian.y, cartesian.z);
|
265
|
-
};
|
266
|
-
|
267
|
-
/**
|
268
|
-
* Computes the value of the minimum component for the supplied Cartesian.
|
269
|
-
*
|
270
|
-
* @param {Cartesian3} cartesian The cartesian to use.
|
271
|
-
* @returns {number} The value of the minimum component.
|
272
|
-
*/
|
273
|
-
Cartesian3.minimumComponent = function (cartesian) {
|
274
|
-
//>>includeStart('debug', pragmas.debug);
|
275
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
276
|
-
//>>includeEnd('debug');
|
277
|
-
|
278
|
-
return Math.min(cartesian.x, cartesian.y, cartesian.z);
|
279
|
-
};
|
280
|
-
|
281
|
-
/**
|
282
|
-
* Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
|
283
|
-
*
|
284
|
-
* @param {Cartesian3} first A cartesian to compare.
|
285
|
-
* @param {Cartesian3} second A cartesian to compare.
|
286
|
-
* @param {Cartesian3} result The object into which to store the result.
|
287
|
-
* @returns {Cartesian3} A cartesian with the minimum components.
|
288
|
-
*/
|
289
|
-
Cartesian3.minimumByComponent = function (first, second, result) {
|
290
|
-
//>>includeStart('debug', pragmas.debug);
|
291
|
-
Check.Check.typeOf.object("first", first);
|
292
|
-
Check.Check.typeOf.object("second", second);
|
293
|
-
Check.Check.typeOf.object("result", result);
|
294
|
-
//>>includeEnd('debug');
|
295
|
-
|
296
|
-
result.x = Math.min(first.x, second.x);
|
297
|
-
result.y = Math.min(first.y, second.y);
|
298
|
-
result.z = Math.min(first.z, second.z);
|
299
|
-
|
300
|
-
return result;
|
301
|
-
};
|
302
|
-
|
303
|
-
/**
|
304
|
-
* Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
|
305
|
-
*
|
306
|
-
* @param {Cartesian3} first A cartesian to compare.
|
307
|
-
* @param {Cartesian3} second A cartesian to compare.
|
308
|
-
* @param {Cartesian3} result The object into which to store the result.
|
309
|
-
* @returns {Cartesian3} A cartesian with the maximum components.
|
310
|
-
*/
|
311
|
-
Cartesian3.maximumByComponent = function (first, second, result) {
|
312
|
-
//>>includeStart('debug', pragmas.debug);
|
313
|
-
Check.Check.typeOf.object("first", first);
|
314
|
-
Check.Check.typeOf.object("second", second);
|
315
|
-
Check.Check.typeOf.object("result", result);
|
316
|
-
//>>includeEnd('debug');
|
317
|
-
|
318
|
-
result.x = Math.max(first.x, second.x);
|
319
|
-
result.y = Math.max(first.y, second.y);
|
320
|
-
result.z = Math.max(first.z, second.z);
|
321
|
-
return result;
|
322
|
-
};
|
323
|
-
|
324
|
-
/**
|
325
|
-
* Constrain a value to lie between two values.
|
326
|
-
*
|
327
|
-
* @param {Cartesian3} cartesian The value to clamp.
|
328
|
-
* @param {Cartesian3} min The minimum bound.
|
329
|
-
* @param {Cartesian3} max The maximum bound.
|
330
|
-
* @param {Cartesian3} result The object into which to store the result.
|
331
|
-
* @returns {Cartesian3} The clamped value such that min <= value <= max.
|
332
|
-
*/
|
333
|
-
Cartesian3.clamp = function (value, min, max, result) {
|
334
|
-
//>>includeStart('debug', pragmas.debug);
|
335
|
-
Check.Check.typeOf.object("value", value);
|
336
|
-
Check.Check.typeOf.object("min", min);
|
337
|
-
Check.Check.typeOf.object("max", max);
|
338
|
-
Check.Check.typeOf.object("result", result);
|
339
|
-
//>>includeEnd('debug');
|
340
|
-
|
341
|
-
const x = Math$1.CesiumMath.clamp(value.x, min.x, max.x);
|
342
|
-
const y = Math$1.CesiumMath.clamp(value.y, min.y, max.y);
|
343
|
-
const z = Math$1.CesiumMath.clamp(value.z, min.z, max.z);
|
344
|
-
|
345
|
-
result.x = x;
|
346
|
-
result.y = y;
|
347
|
-
result.z = z;
|
348
|
-
|
349
|
-
return result;
|
350
|
-
};
|
351
|
-
|
352
|
-
/**
|
353
|
-
* Computes the provided Cartesian's squared magnitude.
|
354
|
-
*
|
355
|
-
* @param {Cartesian3} cartesian The Cartesian instance whose squared magnitude is to be computed.
|
356
|
-
* @returns {number} The squared magnitude.
|
357
|
-
*/
|
358
|
-
Cartesian3.magnitudeSquared = function (cartesian) {
|
359
|
-
//>>includeStart('debug', pragmas.debug);
|
360
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
361
|
-
//>>includeEnd('debug');
|
362
|
-
|
363
|
-
return (
|
364
|
-
cartesian.x * cartesian.x +
|
365
|
-
cartesian.y * cartesian.y +
|
366
|
-
cartesian.z * cartesian.z
|
367
|
-
);
|
368
|
-
};
|
369
|
-
|
370
|
-
/**
|
371
|
-
* Computes the Cartesian's magnitude (length).
|
372
|
-
*
|
373
|
-
* @param {Cartesian3} cartesian The Cartesian instance whose magnitude is to be computed.
|
374
|
-
* @returns {number} The magnitude.
|
375
|
-
*/
|
376
|
-
Cartesian3.magnitude = function (cartesian) {
|
377
|
-
return Math.sqrt(Cartesian3.magnitudeSquared(cartesian));
|
378
|
-
};
|
379
|
-
|
380
|
-
const distanceScratch = new Cartesian3();
|
381
|
-
|
382
|
-
/**
|
383
|
-
* Computes the distance between two points.
|
384
|
-
*
|
385
|
-
* @param {Cartesian3} left The first point to compute the distance from.
|
386
|
-
* @param {Cartesian3} right The second point to compute the distance to.
|
387
|
-
* @returns {number} The distance between two points.
|
388
|
-
*
|
389
|
-
* @example
|
390
|
-
* // Returns 1.0
|
391
|
-
* const d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0));
|
392
|
-
*/
|
393
|
-
Cartesian3.distance = function (left, right) {
|
394
|
-
//>>includeStart('debug', pragmas.debug);
|
395
|
-
Check.Check.typeOf.object("left", left);
|
396
|
-
Check.Check.typeOf.object("right", right);
|
397
|
-
//>>includeEnd('debug');
|
398
|
-
|
399
|
-
Cartesian3.subtract(left, right, distanceScratch);
|
400
|
-
return Cartesian3.magnitude(distanceScratch);
|
401
|
-
};
|
402
|
-
|
403
|
-
/**
|
404
|
-
* Computes the squared distance between two points. Comparing squared distances
|
405
|
-
* using this function is more efficient than comparing distances using {@link Cartesian3#distance}.
|
406
|
-
*
|
407
|
-
* @param {Cartesian3} left The first point to compute the distance from.
|
408
|
-
* @param {Cartesian3} right The second point to compute the distance to.
|
409
|
-
* @returns {number} The distance between two points.
|
410
|
-
*
|
411
|
-
* @example
|
412
|
-
* // Returns 4.0, not 2.0
|
413
|
-
* const d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0));
|
414
|
-
*/
|
415
|
-
Cartesian3.distanceSquared = function (left, right) {
|
416
|
-
//>>includeStart('debug', pragmas.debug);
|
417
|
-
Check.Check.typeOf.object("left", left);
|
418
|
-
Check.Check.typeOf.object("right", right);
|
419
|
-
//>>includeEnd('debug');
|
420
|
-
|
421
|
-
Cartesian3.subtract(left, right, distanceScratch);
|
422
|
-
return Cartesian3.magnitudeSquared(distanceScratch);
|
423
|
-
};
|
424
|
-
|
425
|
-
/**
|
426
|
-
* Computes the normalized form of the supplied Cartesian.
|
427
|
-
*
|
428
|
-
* @param {Cartesian3} cartesian The Cartesian to be normalized.
|
429
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
430
|
-
* @returns {Cartesian3} The modified result parameter.
|
431
|
-
*/
|
432
|
-
Cartesian3.normalize = function (cartesian, result) {
|
433
|
-
//>>includeStart('debug', pragmas.debug);
|
434
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
435
|
-
Check.Check.typeOf.object("result", result);
|
436
|
-
//>>includeEnd('debug');
|
437
|
-
|
438
|
-
const magnitude = Cartesian3.magnitude(cartesian);
|
439
|
-
|
440
|
-
result.x = cartesian.x / magnitude;
|
441
|
-
result.y = cartesian.y / magnitude;
|
442
|
-
result.z = cartesian.z / magnitude;
|
443
|
-
|
444
|
-
//>>includeStart('debug', pragmas.debug);
|
445
|
-
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z)) {
|
446
|
-
throw new Check.DeveloperError("normalized result is not a number");
|
447
|
-
}
|
448
|
-
//>>includeEnd('debug');
|
449
|
-
|
450
|
-
return result;
|
451
|
-
};
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Computes the dot (scalar) product of two Cartesians.
|
455
|
-
*
|
456
|
-
* @param {Cartesian3} left The first Cartesian.
|
457
|
-
* @param {Cartesian3} right The second Cartesian.
|
458
|
-
* @returns {number} The dot product.
|
459
|
-
*/
|
460
|
-
Cartesian3.dot = function (left, right) {
|
461
|
-
//>>includeStart('debug', pragmas.debug);
|
462
|
-
Check.Check.typeOf.object("left", left);
|
463
|
-
Check.Check.typeOf.object("right", right);
|
464
|
-
//>>includeEnd('debug');
|
465
|
-
|
466
|
-
return left.x * right.x + left.y * right.y + left.z * right.z;
|
467
|
-
};
|
468
|
-
|
469
|
-
/**
|
470
|
-
* Computes the componentwise product of two Cartesians.
|
471
|
-
*
|
472
|
-
* @param {Cartesian3} left The first Cartesian.
|
473
|
-
* @param {Cartesian3} right The second Cartesian.
|
474
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
475
|
-
* @returns {Cartesian3} The modified result parameter.
|
476
|
-
*/
|
477
|
-
Cartesian3.multiplyComponents = function (left, right, result) {
|
478
|
-
//>>includeStart('debug', pragmas.debug);
|
479
|
-
Check.Check.typeOf.object("left", left);
|
480
|
-
Check.Check.typeOf.object("right", right);
|
481
|
-
Check.Check.typeOf.object("result", result);
|
482
|
-
//>>includeEnd('debug');
|
483
|
-
|
484
|
-
result.x = left.x * right.x;
|
485
|
-
result.y = left.y * right.y;
|
486
|
-
result.z = left.z * right.z;
|
487
|
-
return result;
|
488
|
-
};
|
489
|
-
|
490
|
-
/**
|
491
|
-
* Computes the componentwise quotient of two Cartesians.
|
492
|
-
*
|
493
|
-
* @param {Cartesian3} left The first Cartesian.
|
494
|
-
* @param {Cartesian3} right The second Cartesian.
|
495
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
496
|
-
* @returns {Cartesian3} The modified result parameter.
|
497
|
-
*/
|
498
|
-
Cartesian3.divideComponents = function (left, right, result) {
|
499
|
-
//>>includeStart('debug', pragmas.debug);
|
500
|
-
Check.Check.typeOf.object("left", left);
|
501
|
-
Check.Check.typeOf.object("right", right);
|
502
|
-
Check.Check.typeOf.object("result", result);
|
503
|
-
//>>includeEnd('debug');
|
504
|
-
|
505
|
-
result.x = left.x / right.x;
|
506
|
-
result.y = left.y / right.y;
|
507
|
-
result.z = left.z / right.z;
|
508
|
-
return result;
|
509
|
-
};
|
510
|
-
|
511
|
-
/**
|
512
|
-
* Computes the componentwise sum of two Cartesians.
|
513
|
-
*
|
514
|
-
* @param {Cartesian3} left The first Cartesian.
|
515
|
-
* @param {Cartesian3} right The second Cartesian.
|
516
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
517
|
-
* @returns {Cartesian3} The modified result parameter.
|
518
|
-
*/
|
519
|
-
Cartesian3.add = function (left, right, result) {
|
520
|
-
//>>includeStart('debug', pragmas.debug);
|
521
|
-
Check.Check.typeOf.object("left", left);
|
522
|
-
Check.Check.typeOf.object("right", right);
|
523
|
-
Check.Check.typeOf.object("result", result);
|
524
|
-
//>>includeEnd('debug');
|
525
|
-
|
526
|
-
result.x = left.x + right.x;
|
527
|
-
result.y = left.y + right.y;
|
528
|
-
result.z = left.z + right.z;
|
529
|
-
return result;
|
530
|
-
};
|
531
|
-
|
532
|
-
/**
|
533
|
-
* Computes the componentwise difference of two Cartesians.
|
534
|
-
*
|
535
|
-
* @param {Cartesian3} left The first Cartesian.
|
536
|
-
* @param {Cartesian3} right The second Cartesian.
|
537
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
538
|
-
* @returns {Cartesian3} The modified result parameter.
|
539
|
-
*/
|
540
|
-
Cartesian3.subtract = function (left, right, result) {
|
541
|
-
//>>includeStart('debug', pragmas.debug);
|
542
|
-
Check.Check.typeOf.object("left", left);
|
543
|
-
Check.Check.typeOf.object("right", right);
|
544
|
-
Check.Check.typeOf.object("result", result);
|
545
|
-
//>>includeEnd('debug');
|
546
|
-
|
547
|
-
result.x = left.x - right.x;
|
548
|
-
result.y = left.y - right.y;
|
549
|
-
result.z = left.z - right.z;
|
550
|
-
return result;
|
551
|
-
};
|
552
|
-
|
553
|
-
/**
|
554
|
-
* Multiplies the provided Cartesian componentwise by the provided scalar.
|
555
|
-
*
|
556
|
-
* @param {Cartesian3} cartesian The Cartesian to be scaled.
|
557
|
-
* @param {number} scalar The scalar to multiply with.
|
558
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
559
|
-
* @returns {Cartesian3} The modified result parameter.
|
560
|
-
*/
|
561
|
-
Cartesian3.multiplyByScalar = function (cartesian, scalar, result) {
|
562
|
-
//>>includeStart('debug', pragmas.debug);
|
563
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
564
|
-
Check.Check.typeOf.number("scalar", scalar);
|
565
|
-
Check.Check.typeOf.object("result", result);
|
566
|
-
//>>includeEnd('debug');
|
567
|
-
|
568
|
-
result.x = cartesian.x * scalar;
|
569
|
-
result.y = cartesian.y * scalar;
|
570
|
-
result.z = cartesian.z * scalar;
|
571
|
-
return result;
|
572
|
-
};
|
573
|
-
|
574
|
-
/**
|
575
|
-
* Divides the provided Cartesian componentwise by the provided scalar.
|
576
|
-
*
|
577
|
-
* @param {Cartesian3} cartesian The Cartesian to be divided.
|
578
|
-
* @param {number} scalar The scalar to divide by.
|
579
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
580
|
-
* @returns {Cartesian3} The modified result parameter.
|
581
|
-
*/
|
582
|
-
Cartesian3.divideByScalar = function (cartesian, scalar, result) {
|
583
|
-
//>>includeStart('debug', pragmas.debug);
|
584
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
585
|
-
Check.Check.typeOf.number("scalar", scalar);
|
586
|
-
Check.Check.typeOf.object("result", result);
|
587
|
-
//>>includeEnd('debug');
|
588
|
-
|
589
|
-
result.x = cartesian.x / scalar;
|
590
|
-
result.y = cartesian.y / scalar;
|
591
|
-
result.z = cartesian.z / scalar;
|
592
|
-
return result;
|
593
|
-
};
|
594
|
-
|
595
|
-
/**
|
596
|
-
* Negates the provided Cartesian.
|
597
|
-
*
|
598
|
-
* @param {Cartesian3} cartesian The Cartesian to be negated.
|
599
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
600
|
-
* @returns {Cartesian3} The modified result parameter.
|
601
|
-
*/
|
602
|
-
Cartesian3.negate = function (cartesian, result) {
|
603
|
-
//>>includeStart('debug', pragmas.debug);
|
604
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
605
|
-
Check.Check.typeOf.object("result", result);
|
606
|
-
//>>includeEnd('debug');
|
607
|
-
|
608
|
-
result.x = -cartesian.x;
|
609
|
-
result.y = -cartesian.y;
|
610
|
-
result.z = -cartesian.z;
|
611
|
-
return result;
|
612
|
-
};
|
613
|
-
|
614
|
-
/**
|
615
|
-
* Computes the absolute value of the provided Cartesian.
|
616
|
-
*
|
617
|
-
* @param {Cartesian3} cartesian The Cartesian whose absolute value is to be computed.
|
618
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
619
|
-
* @returns {Cartesian3} The modified result parameter.
|
620
|
-
*/
|
621
|
-
Cartesian3.abs = function (cartesian, result) {
|
622
|
-
//>>includeStart('debug', pragmas.debug);
|
623
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
624
|
-
Check.Check.typeOf.object("result", result);
|
625
|
-
//>>includeEnd('debug');
|
626
|
-
|
627
|
-
result.x = Math.abs(cartesian.x);
|
628
|
-
result.y = Math.abs(cartesian.y);
|
629
|
-
result.z = Math.abs(cartesian.z);
|
630
|
-
return result;
|
631
|
-
};
|
632
|
-
|
633
|
-
const lerpScratch = new Cartesian3();
|
634
|
-
/**
|
635
|
-
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
|
636
|
-
*
|
637
|
-
* @param {Cartesian3} start The value corresponding to t at 0.0.
|
638
|
-
* @param {Cartesian3} end The value corresponding to t at 1.0.
|
639
|
-
* @param {number} t The point along t at which to interpolate.
|
640
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
641
|
-
* @returns {Cartesian3} The modified result parameter.
|
642
|
-
*/
|
643
|
-
Cartesian3.lerp = function (start, end, t, result) {
|
644
|
-
//>>includeStart('debug', pragmas.debug);
|
645
|
-
Check.Check.typeOf.object("start", start);
|
646
|
-
Check.Check.typeOf.object("end", end);
|
647
|
-
Check.Check.typeOf.number("t", t);
|
648
|
-
Check.Check.typeOf.object("result", result);
|
649
|
-
//>>includeEnd('debug');
|
650
|
-
|
651
|
-
Cartesian3.multiplyByScalar(end, t, lerpScratch);
|
652
|
-
result = Cartesian3.multiplyByScalar(start, 1.0 - t, result);
|
653
|
-
return Cartesian3.add(lerpScratch, result, result);
|
654
|
-
};
|
655
|
-
|
656
|
-
const angleBetweenScratch = new Cartesian3();
|
657
|
-
const angleBetweenScratch2 = new Cartesian3();
|
658
|
-
/**
|
659
|
-
* Returns the angle, in radians, between the provided Cartesians.
|
660
|
-
*
|
661
|
-
* @param {Cartesian3} left The first Cartesian.
|
662
|
-
* @param {Cartesian3} right The second Cartesian.
|
663
|
-
* @returns {number} The angle between the Cartesians.
|
664
|
-
*/
|
665
|
-
Cartesian3.angleBetween = function (left, right) {
|
666
|
-
//>>includeStart('debug', pragmas.debug);
|
667
|
-
Check.Check.typeOf.object("left", left);
|
668
|
-
Check.Check.typeOf.object("right", right);
|
669
|
-
//>>includeEnd('debug');
|
670
|
-
|
671
|
-
Cartesian3.normalize(left, angleBetweenScratch);
|
672
|
-
Cartesian3.normalize(right, angleBetweenScratch2);
|
673
|
-
const cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2);
|
674
|
-
const sine = Cartesian3.magnitude(
|
675
|
-
Cartesian3.cross(
|
676
|
-
angleBetweenScratch,
|
677
|
-
angleBetweenScratch2,
|
678
|
-
angleBetweenScratch
|
679
|
-
)
|
680
|
-
);
|
681
|
-
return Math.atan2(sine, cosine);
|
682
|
-
};
|
683
|
-
|
684
|
-
const mostOrthogonalAxisScratch = new Cartesian3();
|
685
|
-
/**
|
686
|
-
* Returns the axis that is most orthogonal to the provided Cartesian.
|
687
|
-
*
|
688
|
-
* @param {Cartesian3} cartesian The Cartesian on which to find the most orthogonal axis.
|
689
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
690
|
-
* @returns {Cartesian3} The most orthogonal axis.
|
691
|
-
*/
|
692
|
-
Cartesian3.mostOrthogonalAxis = function (cartesian, result) {
|
693
|
-
//>>includeStart('debug', pragmas.debug);
|
694
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
695
|
-
Check.Check.typeOf.object("result", result);
|
696
|
-
//>>includeEnd('debug');
|
697
|
-
|
698
|
-
const f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch);
|
699
|
-
Cartesian3.abs(f, f);
|
700
|
-
|
701
|
-
if (f.x <= f.y) {
|
702
|
-
if (f.x <= f.z) {
|
703
|
-
result = Cartesian3.clone(Cartesian3.UNIT_X, result);
|
704
|
-
} else {
|
705
|
-
result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
|
706
|
-
}
|
707
|
-
} else if (f.y <= f.z) {
|
708
|
-
result = Cartesian3.clone(Cartesian3.UNIT_Y, result);
|
709
|
-
} else {
|
710
|
-
result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
|
711
|
-
}
|
712
|
-
|
713
|
-
return result;
|
714
|
-
};
|
715
|
-
|
716
|
-
/**
|
717
|
-
* Projects vector a onto vector b
|
718
|
-
* @param {Cartesian3} a The vector that needs projecting
|
719
|
-
* @param {Cartesian3} b The vector to project onto
|
720
|
-
* @param {Cartesian3} result The result cartesian
|
721
|
-
* @returns {Cartesian3} The modified result parameter
|
722
|
-
*/
|
723
|
-
Cartesian3.projectVector = function (a, b, result) {
|
724
|
-
//>>includeStart('debug', pragmas.debug);
|
725
|
-
Check.Check.defined("a", a);
|
726
|
-
Check.Check.defined("b", b);
|
727
|
-
Check.Check.defined("result", result);
|
728
|
-
//>>includeEnd('debug');
|
729
|
-
|
730
|
-
const scalar = Cartesian3.dot(a, b) / Cartesian3.dot(b, b);
|
731
|
-
return Cartesian3.multiplyByScalar(b, scalar, result);
|
732
|
-
};
|
733
|
-
|
734
|
-
/**
|
735
|
-
* Compares the provided Cartesians componentwise and returns
|
736
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
737
|
-
*
|
738
|
-
* @param {Cartesian3} [left] The first Cartesian.
|
739
|
-
* @param {Cartesian3} [right] The second Cartesian.
|
740
|
-
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
741
|
-
*/
|
742
|
-
Cartesian3.equals = function (left, right) {
|
743
|
-
return (
|
744
|
-
left === right ||
|
745
|
-
(defaultValue.defined(left) &&
|
746
|
-
defaultValue.defined(right) &&
|
747
|
-
left.x === right.x &&
|
748
|
-
left.y === right.y &&
|
749
|
-
left.z === right.z)
|
750
|
-
);
|
751
|
-
};
|
752
|
-
|
753
|
-
/**
|
754
|
-
* @private
|
755
|
-
*/
|
756
|
-
Cartesian3.equalsArray = function (cartesian, array, offset) {
|
757
|
-
return (
|
758
|
-
cartesian.x === array[offset] &&
|
759
|
-
cartesian.y === array[offset + 1] &&
|
760
|
-
cartesian.z === array[offset + 2]
|
761
|
-
);
|
762
|
-
};
|
763
|
-
|
764
|
-
/**
|
765
|
-
* Compares the provided Cartesians componentwise and returns
|
766
|
-
* <code>true</code> if they pass an absolute or relative tolerance test,
|
767
|
-
* <code>false</code> otherwise.
|
768
|
-
*
|
769
|
-
* @param {Cartesian3} [left] The first Cartesian.
|
770
|
-
* @param {Cartesian3} [right] The second Cartesian.
|
771
|
-
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
772
|
-
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
773
|
-
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
774
|
-
*/
|
775
|
-
Cartesian3.equalsEpsilon = function (
|
776
|
-
left,
|
777
|
-
right,
|
778
|
-
relativeEpsilon,
|
779
|
-
absoluteEpsilon
|
780
|
-
) {
|
781
|
-
return (
|
782
|
-
left === right ||
|
783
|
-
(defaultValue.defined(left) &&
|
784
|
-
defaultValue.defined(right) &&
|
785
|
-
Math$1.CesiumMath.equalsEpsilon(
|
786
|
-
left.x,
|
787
|
-
right.x,
|
788
|
-
relativeEpsilon,
|
789
|
-
absoluteEpsilon
|
790
|
-
) &&
|
791
|
-
Math$1.CesiumMath.equalsEpsilon(
|
792
|
-
left.y,
|
793
|
-
right.y,
|
794
|
-
relativeEpsilon,
|
795
|
-
absoluteEpsilon
|
796
|
-
) &&
|
797
|
-
Math$1.CesiumMath.equalsEpsilon(
|
798
|
-
left.z,
|
799
|
-
right.z,
|
800
|
-
relativeEpsilon,
|
801
|
-
absoluteEpsilon
|
802
|
-
))
|
803
|
-
);
|
804
|
-
};
|
805
|
-
|
806
|
-
/**
|
807
|
-
* Computes the cross (outer) product of two Cartesians.
|
808
|
-
*
|
809
|
-
* @param {Cartesian3} left The first Cartesian.
|
810
|
-
* @param {Cartesian3} right The second Cartesian.
|
811
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
812
|
-
* @returns {Cartesian3} The cross product.
|
813
|
-
*/
|
814
|
-
Cartesian3.cross = function (left, right, result) {
|
815
|
-
//>>includeStart('debug', pragmas.debug);
|
816
|
-
Check.Check.typeOf.object("left", left);
|
817
|
-
Check.Check.typeOf.object("right", right);
|
818
|
-
Check.Check.typeOf.object("result", result);
|
819
|
-
//>>includeEnd('debug');
|
820
|
-
|
821
|
-
const leftX = left.x;
|
822
|
-
const leftY = left.y;
|
823
|
-
const leftZ = left.z;
|
824
|
-
const rightX = right.x;
|
825
|
-
const rightY = right.y;
|
826
|
-
const rightZ = right.z;
|
827
|
-
|
828
|
-
const x = leftY * rightZ - leftZ * rightY;
|
829
|
-
const y = leftZ * rightX - leftX * rightZ;
|
830
|
-
const z = leftX * rightY - leftY * rightX;
|
831
|
-
|
832
|
-
result.x = x;
|
833
|
-
result.y = y;
|
834
|
-
result.z = z;
|
835
|
-
return result;
|
836
|
-
};
|
837
|
-
|
838
|
-
/**
|
839
|
-
* Computes the midpoint between the right and left Cartesian.
|
840
|
-
* @param {Cartesian3} left The first Cartesian.
|
841
|
-
* @param {Cartesian3} right The second Cartesian.
|
842
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
843
|
-
* @returns {Cartesian3} The midpoint.
|
844
|
-
*/
|
845
|
-
Cartesian3.midpoint = function (left, right, result) {
|
846
|
-
//>>includeStart('debug', pragmas.debug);
|
847
|
-
Check.Check.typeOf.object("left", left);
|
848
|
-
Check.Check.typeOf.object("right", right);
|
849
|
-
Check.Check.typeOf.object("result", result);
|
850
|
-
//>>includeEnd('debug');
|
851
|
-
|
852
|
-
result.x = (left.x + right.x) * 0.5;
|
853
|
-
result.y = (left.y + right.y) * 0.5;
|
854
|
-
result.z = (left.z + right.z) * 0.5;
|
855
|
-
|
856
|
-
return result;
|
857
|
-
};
|
858
|
-
|
859
|
-
/**
|
860
|
-
* Returns a Cartesian3 position from longitude and latitude values given in degrees.
|
861
|
-
*
|
862
|
-
* @param {number} longitude The longitude, in degrees
|
863
|
-
* @param {number} latitude The latitude, in degrees
|
864
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
865
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
866
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
867
|
-
* @returns {Cartesian3} The position
|
868
|
-
*
|
869
|
-
* @example
|
870
|
-
* const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);
|
871
|
-
*/
|
872
|
-
Cartesian3.fromDegrees = function (
|
873
|
-
longitude,
|
874
|
-
latitude,
|
875
|
-
height,
|
876
|
-
ellipsoid,
|
877
|
-
result
|
878
|
-
) {
|
879
|
-
//>>includeStart('debug', pragmas.debug);
|
880
|
-
Check.Check.typeOf.number("longitude", longitude);
|
881
|
-
Check.Check.typeOf.number("latitude", latitude);
|
882
|
-
//>>includeEnd('debug');
|
883
|
-
|
884
|
-
longitude = Math$1.CesiumMath.toRadians(longitude);
|
885
|
-
latitude = Math$1.CesiumMath.toRadians(latitude);
|
886
|
-
return Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result);
|
887
|
-
};
|
888
|
-
|
889
|
-
let scratchN = new Cartesian3();
|
890
|
-
let scratchK = new Cartesian3();
|
891
|
-
const wgs84RadiiSquared = new Cartesian3(
|
892
|
-
6378137.0 * 6378137.0,
|
893
|
-
6378137.0 * 6378137.0,
|
894
|
-
6356752.3142451793 * 6356752.3142451793
|
895
|
-
);
|
896
|
-
|
897
|
-
/**
|
898
|
-
* Returns a Cartesian3 position from longitude and latitude values given in radians.
|
899
|
-
*
|
900
|
-
* @param {number} longitude The longitude, in radians
|
901
|
-
* @param {number} latitude The latitude, in radians
|
902
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
903
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
904
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
905
|
-
* @returns {Cartesian3} The position
|
906
|
-
*
|
907
|
-
* @example
|
908
|
-
* const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);
|
909
|
-
*/
|
910
|
-
Cartesian3.fromRadians = function (
|
911
|
-
longitude,
|
912
|
-
latitude,
|
913
|
-
height,
|
914
|
-
ellipsoid,
|
915
|
-
result
|
916
|
-
) {
|
917
|
-
//>>includeStart('debug', pragmas.debug);
|
918
|
-
Check.Check.typeOf.number("longitude", longitude);
|
919
|
-
Check.Check.typeOf.number("latitude", latitude);
|
920
|
-
//>>includeEnd('debug');
|
921
|
-
|
922
|
-
height = defaultValue.defaultValue(height, 0.0);
|
923
|
-
const radiiSquared = defaultValue.defined(ellipsoid)
|
924
|
-
? ellipsoid.radiiSquared
|
925
|
-
: wgs84RadiiSquared;
|
926
|
-
|
927
|
-
const cosLatitude = Math.cos(latitude);
|
928
|
-
scratchN.x = cosLatitude * Math.cos(longitude);
|
929
|
-
scratchN.y = cosLatitude * Math.sin(longitude);
|
930
|
-
scratchN.z = Math.sin(latitude);
|
931
|
-
scratchN = Cartesian3.normalize(scratchN, scratchN);
|
932
|
-
|
933
|
-
Cartesian3.multiplyComponents(radiiSquared, scratchN, scratchK);
|
934
|
-
const gamma = Math.sqrt(Cartesian3.dot(scratchN, scratchK));
|
935
|
-
scratchK = Cartesian3.divideByScalar(scratchK, gamma, scratchK);
|
936
|
-
scratchN = Cartesian3.multiplyByScalar(scratchN, height, scratchN);
|
937
|
-
|
938
|
-
if (!defaultValue.defined(result)) {
|
939
|
-
result = new Cartesian3();
|
940
|
-
}
|
941
|
-
return Cartesian3.add(scratchK, scratchN, result);
|
942
|
-
};
|
943
|
-
|
944
|
-
/**
|
945
|
-
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees.
|
946
|
-
*
|
947
|
-
* @param {number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
|
948
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the coordinates lie.
|
949
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
950
|
-
* @returns {Cartesian3[]} The array of positions.
|
951
|
-
*
|
952
|
-
* @example
|
953
|
-
* const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);
|
954
|
-
*/
|
955
|
-
Cartesian3.fromDegreesArray = function (coordinates, ellipsoid, result) {
|
956
|
-
//>>includeStart('debug', pragmas.debug);
|
957
|
-
Check.Check.defined("coordinates", coordinates);
|
958
|
-
if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
|
959
|
-
throw new Check.DeveloperError(
|
960
|
-
"the number of coordinates must be a multiple of 2 and at least 2"
|
961
|
-
);
|
962
|
-
}
|
963
|
-
//>>includeEnd('debug');
|
964
|
-
|
965
|
-
const length = coordinates.length;
|
966
|
-
if (!defaultValue.defined(result)) {
|
967
|
-
result = new Array(length / 2);
|
968
|
-
} else {
|
969
|
-
result.length = length / 2;
|
970
|
-
}
|
971
|
-
|
972
|
-
for (let i = 0; i < length; i += 2) {
|
973
|
-
const longitude = coordinates[i];
|
974
|
-
const latitude = coordinates[i + 1];
|
975
|
-
const index = i / 2;
|
976
|
-
result[index] = Cartesian3.fromDegrees(
|
977
|
-
longitude,
|
978
|
-
latitude,
|
979
|
-
0,
|
980
|
-
ellipsoid,
|
981
|
-
result[index]
|
982
|
-
);
|
983
|
-
}
|
984
|
-
|
985
|
-
return result;
|
986
|
-
};
|
987
|
-
|
988
|
-
/**
|
989
|
-
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians.
|
990
|
-
*
|
991
|
-
* @param {number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
|
992
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the coordinates lie.
|
993
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
994
|
-
* @returns {Cartesian3[]} The array of positions.
|
995
|
-
*
|
996
|
-
* @example
|
997
|
-
* const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);
|
998
|
-
*/
|
999
|
-
Cartesian3.fromRadiansArray = function (coordinates, ellipsoid, result) {
|
1000
|
-
//>>includeStart('debug', pragmas.debug);
|
1001
|
-
Check.Check.defined("coordinates", coordinates);
|
1002
|
-
if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
|
1003
|
-
throw new Check.DeveloperError(
|
1004
|
-
"the number of coordinates must be a multiple of 2 and at least 2"
|
1005
|
-
);
|
1006
|
-
}
|
1007
|
-
//>>includeEnd('debug');
|
1008
|
-
|
1009
|
-
const length = coordinates.length;
|
1010
|
-
if (!defaultValue.defined(result)) {
|
1011
|
-
result = new Array(length / 2);
|
1012
|
-
} else {
|
1013
|
-
result.length = length / 2;
|
1014
|
-
}
|
1015
|
-
|
1016
|
-
for (let i = 0; i < length; i += 2) {
|
1017
|
-
const longitude = coordinates[i];
|
1018
|
-
const latitude = coordinates[i + 1];
|
1019
|
-
const index = i / 2;
|
1020
|
-
result[index] = Cartesian3.fromRadians(
|
1021
|
-
longitude,
|
1022
|
-
latitude,
|
1023
|
-
0,
|
1024
|
-
ellipsoid,
|
1025
|
-
result[index]
|
1026
|
-
);
|
1027
|
-
}
|
1028
|
-
|
1029
|
-
return result;
|
1030
|
-
};
|
1031
|
-
|
1032
|
-
/**
|
1033
|
-
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees.
|
1034
|
-
*
|
1035
|
-
* @param {number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
|
1036
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
1037
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
1038
|
-
* @returns {Cartesian3[]} The array of positions.
|
1039
|
-
*
|
1040
|
-
* @example
|
1041
|
-
* const positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]);
|
1042
|
-
*/
|
1043
|
-
Cartesian3.fromDegreesArrayHeights = function (coordinates, ellipsoid, result) {
|
1044
|
-
//>>includeStart('debug', pragmas.debug);
|
1045
|
-
Check.Check.defined("coordinates", coordinates);
|
1046
|
-
if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
|
1047
|
-
throw new Check.DeveloperError(
|
1048
|
-
"the number of coordinates must be a multiple of 3 and at least 3"
|
1049
|
-
);
|
1050
|
-
}
|
1051
|
-
//>>includeEnd('debug');
|
1052
|
-
|
1053
|
-
const length = coordinates.length;
|
1054
|
-
if (!defaultValue.defined(result)) {
|
1055
|
-
result = new Array(length / 3);
|
1056
|
-
} else {
|
1057
|
-
result.length = length / 3;
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
for (let i = 0; i < length; i += 3) {
|
1061
|
-
const longitude = coordinates[i];
|
1062
|
-
const latitude = coordinates[i + 1];
|
1063
|
-
const height = coordinates[i + 2];
|
1064
|
-
const index = i / 3;
|
1065
|
-
result[index] = Cartesian3.fromDegrees(
|
1066
|
-
longitude,
|
1067
|
-
latitude,
|
1068
|
-
height,
|
1069
|
-
ellipsoid,
|
1070
|
-
result[index]
|
1071
|
-
);
|
1072
|
-
}
|
1073
|
-
|
1074
|
-
return result;
|
1075
|
-
};
|
1076
|
-
|
1077
|
-
/**
|
1078
|
-
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians.
|
1079
|
-
*
|
1080
|
-
* @param {number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
|
1081
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
1082
|
-
* @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result.
|
1083
|
-
* @returns {Cartesian3[]} The array of positions.
|
1084
|
-
*
|
1085
|
-
* @example
|
1086
|
-
* const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);
|
1087
|
-
*/
|
1088
|
-
Cartesian3.fromRadiansArrayHeights = function (coordinates, ellipsoid, result) {
|
1089
|
-
//>>includeStart('debug', pragmas.debug);
|
1090
|
-
Check.Check.defined("coordinates", coordinates);
|
1091
|
-
if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
|
1092
|
-
throw new Check.DeveloperError(
|
1093
|
-
"the number of coordinates must be a multiple of 3 and at least 3"
|
1094
|
-
);
|
1095
|
-
}
|
1096
|
-
//>>includeEnd('debug');
|
1097
|
-
|
1098
|
-
const length = coordinates.length;
|
1099
|
-
if (!defaultValue.defined(result)) {
|
1100
|
-
result = new Array(length / 3);
|
1101
|
-
} else {
|
1102
|
-
result.length = length / 3;
|
1103
|
-
}
|
1104
|
-
|
1105
|
-
for (let i = 0; i < length; i += 3) {
|
1106
|
-
const longitude = coordinates[i];
|
1107
|
-
const latitude = coordinates[i + 1];
|
1108
|
-
const height = coordinates[i + 2];
|
1109
|
-
const index = i / 3;
|
1110
|
-
result[index] = Cartesian3.fromRadians(
|
1111
|
-
longitude,
|
1112
|
-
latitude,
|
1113
|
-
height,
|
1114
|
-
ellipsoid,
|
1115
|
-
result[index]
|
1116
|
-
);
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
return result;
|
1120
|
-
};
|
1121
|
-
|
1122
|
-
/**
|
1123
|
-
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
|
1124
|
-
*
|
1125
|
-
* @type {Cartesian3}
|
1126
|
-
* @constant
|
1127
|
-
*/
|
1128
|
-
Cartesian3.ZERO = Object.freeze(new Cartesian3(0.0, 0.0, 0.0));
|
1129
|
-
|
1130
|
-
/**
|
1131
|
-
* An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
|
1132
|
-
*
|
1133
|
-
* @type {Cartesian3}
|
1134
|
-
* @constant
|
1135
|
-
*/
|
1136
|
-
Cartesian3.ONE = Object.freeze(new Cartesian3(1.0, 1.0, 1.0));
|
1137
|
-
|
1138
|
-
/**
|
1139
|
-
* An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
|
1140
|
-
*
|
1141
|
-
* @type {Cartesian3}
|
1142
|
-
* @constant
|
1143
|
-
*/
|
1144
|
-
Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1.0, 0.0, 0.0));
|
1145
|
-
|
1146
|
-
/**
|
1147
|
-
* An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
|
1148
|
-
*
|
1149
|
-
* @type {Cartesian3}
|
1150
|
-
* @constant
|
1151
|
-
*/
|
1152
|
-
Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0.0, 1.0, 0.0));
|
1153
|
-
|
1154
|
-
/**
|
1155
|
-
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
|
1156
|
-
*
|
1157
|
-
* @type {Cartesian3}
|
1158
|
-
* @constant
|
1159
|
-
*/
|
1160
|
-
Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0.0, 0.0, 1.0));
|
1161
|
-
|
1162
|
-
/**
|
1163
|
-
* Duplicates this Cartesian3 instance.
|
1164
|
-
*
|
1165
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
1166
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
1167
|
-
*/
|
1168
|
-
Cartesian3.prototype.clone = function (result) {
|
1169
|
-
return Cartesian3.clone(this, result);
|
1170
|
-
};
|
1171
|
-
|
1172
|
-
/**
|
1173
|
-
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
1174
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
1175
|
-
*
|
1176
|
-
* @param {Cartesian3} [right] The right hand side Cartesian.
|
1177
|
-
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
1178
|
-
*/
|
1179
|
-
Cartesian3.prototype.equals = function (right) {
|
1180
|
-
return Cartesian3.equals(this, right);
|
1181
|
-
};
|
1182
|
-
|
1183
|
-
/**
|
1184
|
-
* Compares this Cartesian against the provided Cartesian componentwise and returns
|
1185
|
-
* <code>true</code> if they pass an absolute or relative tolerance test,
|
1186
|
-
* <code>false</code> otherwise.
|
1187
|
-
*
|
1188
|
-
* @param {Cartesian3} [right] The right hand side Cartesian.
|
1189
|
-
* @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
|
1190
|
-
* @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
|
1191
|
-
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
1192
|
-
*/
|
1193
|
-
Cartesian3.prototype.equalsEpsilon = function (
|
1194
|
-
right,
|
1195
|
-
relativeEpsilon,
|
1196
|
-
absoluteEpsilon
|
1197
|
-
) {
|
1198
|
-
return Cartesian3.equalsEpsilon(
|
1199
|
-
this,
|
1200
|
-
right,
|
1201
|
-
relativeEpsilon,
|
1202
|
-
absoluteEpsilon
|
1203
|
-
);
|
1204
|
-
};
|
1205
|
-
|
1206
|
-
/**
|
1207
|
-
* Creates a string representing this Cartesian in the format '(x, y, z)'.
|
1208
|
-
*
|
1209
|
-
* @returns {string} A string representing this Cartesian in the format '(x, y, z)'.
|
1210
|
-
*/
|
1211
|
-
Cartesian3.prototype.toString = function () {
|
1212
|
-
return `(${this.x}, ${this.y}, ${this.z})`;
|
1213
|
-
};
|
1214
|
-
|
1215
|
-
const scaleToGeodeticSurfaceIntersection = new Cartesian3();
|
1216
|
-
const scaleToGeodeticSurfaceGradient = new Cartesian3();
|
1217
|
-
|
1218
|
-
/**
|
1219
|
-
* Scales the provided Cartesian position along the geodetic surface normal
|
1220
|
-
* so that it is on the surface of this ellipsoid. If the position is
|
1221
|
-
* at the center of the ellipsoid, this function returns undefined.
|
1222
|
-
*
|
1223
|
-
* @param {Cartesian3} cartesian The Cartesian position to scale.
|
1224
|
-
* @param {Cartesian3} oneOverRadii One over radii of the ellipsoid.
|
1225
|
-
* @param {Cartesian3} oneOverRadiiSquared One over radii squared of the ellipsoid.
|
1226
|
-
* @param {number} centerToleranceSquared Tolerance for closeness to the center.
|
1227
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
1228
|
-
* @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
|
1229
|
-
*
|
1230
|
-
* @function scaleToGeodeticSurface
|
1231
|
-
*
|
1232
|
-
* @private
|
1233
|
-
*/
|
1234
|
-
function scaleToGeodeticSurface(
|
1235
|
-
cartesian,
|
1236
|
-
oneOverRadii,
|
1237
|
-
oneOverRadiiSquared,
|
1238
|
-
centerToleranceSquared,
|
1239
|
-
result
|
1240
|
-
) {
|
1241
|
-
//>>includeStart('debug', pragmas.debug);
|
1242
|
-
if (!defaultValue.defined(cartesian)) {
|
1243
|
-
throw new Check.DeveloperError("cartesian is required.");
|
1244
|
-
}
|
1245
|
-
if (!defaultValue.defined(oneOverRadii)) {
|
1246
|
-
throw new Check.DeveloperError("oneOverRadii is required.");
|
1247
|
-
}
|
1248
|
-
if (!defaultValue.defined(oneOverRadiiSquared)) {
|
1249
|
-
throw new Check.DeveloperError("oneOverRadiiSquared is required.");
|
1250
|
-
}
|
1251
|
-
if (!defaultValue.defined(centerToleranceSquared)) {
|
1252
|
-
throw new Check.DeveloperError("centerToleranceSquared is required.");
|
1253
|
-
}
|
1254
|
-
//>>includeEnd('debug');
|
1255
|
-
|
1256
|
-
const positionX = cartesian.x;
|
1257
|
-
const positionY = cartesian.y;
|
1258
|
-
const positionZ = cartesian.z;
|
1259
|
-
|
1260
|
-
const oneOverRadiiX = oneOverRadii.x;
|
1261
|
-
const oneOverRadiiY = oneOverRadii.y;
|
1262
|
-
const oneOverRadiiZ = oneOverRadii.z;
|
1263
|
-
|
1264
|
-
const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
|
1265
|
-
const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
|
1266
|
-
const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
|
1267
|
-
|
1268
|
-
// Compute the squared ellipsoid norm.
|
1269
|
-
const squaredNorm = x2 + y2 + z2;
|
1270
|
-
const ratio = Math.sqrt(1.0 / squaredNorm);
|
1271
|
-
|
1272
|
-
// As an initial approximation, assume that the radial intersection is the projection point.
|
1273
|
-
const intersection = Cartesian3.multiplyByScalar(
|
1274
|
-
cartesian,
|
1275
|
-
ratio,
|
1276
|
-
scaleToGeodeticSurfaceIntersection
|
1277
|
-
);
|
1278
|
-
|
1279
|
-
// If the position is near the center, the iteration will not converge.
|
1280
|
-
if (squaredNorm < centerToleranceSquared) {
|
1281
|
-
return !isFinite(ratio)
|
1282
|
-
? undefined
|
1283
|
-
: Cartesian3.clone(intersection, result);
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
|
1287
|
-
const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
|
1288
|
-
const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
|
1289
|
-
|
1290
|
-
// Use the gradient at the intersection point in place of the true unit normal.
|
1291
|
-
// The difference in magnitude will be absorbed in the multiplier.
|
1292
|
-
const gradient = scaleToGeodeticSurfaceGradient;
|
1293
|
-
gradient.x = intersection.x * oneOverRadiiSquaredX * 2.0;
|
1294
|
-
gradient.y = intersection.y * oneOverRadiiSquaredY * 2.0;
|
1295
|
-
gradient.z = intersection.z * oneOverRadiiSquaredZ * 2.0;
|
1296
|
-
|
1297
|
-
// Compute the initial guess at the normal vector multiplier, lambda.
|
1298
|
-
let lambda =
|
1299
|
-
((1.0 - ratio) * Cartesian3.magnitude(cartesian)) /
|
1300
|
-
(0.5 * Cartesian3.magnitude(gradient));
|
1301
|
-
let correction = 0.0;
|
1302
|
-
|
1303
|
-
let func;
|
1304
|
-
let denominator;
|
1305
|
-
let xMultiplier;
|
1306
|
-
let yMultiplier;
|
1307
|
-
let zMultiplier;
|
1308
|
-
let xMultiplier2;
|
1309
|
-
let yMultiplier2;
|
1310
|
-
let zMultiplier2;
|
1311
|
-
let xMultiplier3;
|
1312
|
-
let yMultiplier3;
|
1313
|
-
let zMultiplier3;
|
1314
|
-
|
1315
|
-
do {
|
1316
|
-
lambda -= correction;
|
1317
|
-
|
1318
|
-
xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);
|
1319
|
-
yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);
|
1320
|
-
zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);
|
1321
|
-
|
1322
|
-
xMultiplier2 = xMultiplier * xMultiplier;
|
1323
|
-
yMultiplier2 = yMultiplier * yMultiplier;
|
1324
|
-
zMultiplier2 = zMultiplier * zMultiplier;
|
1325
|
-
|
1326
|
-
xMultiplier3 = xMultiplier2 * xMultiplier;
|
1327
|
-
yMultiplier3 = yMultiplier2 * yMultiplier;
|
1328
|
-
zMultiplier3 = zMultiplier2 * zMultiplier;
|
1329
|
-
|
1330
|
-
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;
|
1331
|
-
|
1332
|
-
// "denominator" here refers to the use of this expression in the velocity and acceleration
|
1333
|
-
// computations in the sections to follow.
|
1334
|
-
denominator =
|
1335
|
-
x2 * xMultiplier3 * oneOverRadiiSquaredX +
|
1336
|
-
y2 * yMultiplier3 * oneOverRadiiSquaredY +
|
1337
|
-
z2 * zMultiplier3 * oneOverRadiiSquaredZ;
|
1338
|
-
|
1339
|
-
const derivative = -2.0 * denominator;
|
1340
|
-
|
1341
|
-
correction = func / derivative;
|
1342
|
-
} while (Math.abs(func) > Math$1.CesiumMath.EPSILON12);
|
1343
|
-
|
1344
|
-
if (!defaultValue.defined(result)) {
|
1345
|
-
return new Cartesian3(
|
1346
|
-
positionX * xMultiplier,
|
1347
|
-
positionY * yMultiplier,
|
1348
|
-
positionZ * zMultiplier
|
1349
|
-
);
|
1350
|
-
}
|
1351
|
-
result.x = positionX * xMultiplier;
|
1352
|
-
result.y = positionY * yMultiplier;
|
1353
|
-
result.z = positionZ * zMultiplier;
|
1354
|
-
return result;
|
1355
|
-
}
|
1356
|
-
|
1357
|
-
/**
|
1358
|
-
* A position defined by longitude, latitude, and height.
|
1359
|
-
* @alias Cartographic
|
1360
|
-
* @constructor
|
1361
|
-
*
|
1362
|
-
* @param {number} [longitude=0.0] The longitude, in radians.
|
1363
|
-
* @param {number} [latitude=0.0] The latitude, in radians.
|
1364
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
1365
|
-
*
|
1366
|
-
* @see Ellipsoid
|
1367
|
-
*/
|
1368
|
-
function Cartographic(longitude, latitude, height) {
|
1369
|
-
/**
|
1370
|
-
* The longitude, in radians.
|
1371
|
-
* @type {number}
|
1372
|
-
* @default 0.0
|
1373
|
-
*/
|
1374
|
-
this.longitude = defaultValue.defaultValue(longitude, 0.0);
|
1375
|
-
|
1376
|
-
/**
|
1377
|
-
* The latitude, in radians.
|
1378
|
-
* @type {number}
|
1379
|
-
* @default 0.0
|
1380
|
-
*/
|
1381
|
-
this.latitude = defaultValue.defaultValue(latitude, 0.0);
|
1382
|
-
|
1383
|
-
/**
|
1384
|
-
* The height, in meters, above the ellipsoid.
|
1385
|
-
* @type {number}
|
1386
|
-
* @default 0.0
|
1387
|
-
*/
|
1388
|
-
this.height = defaultValue.defaultValue(height, 0.0);
|
1389
|
-
}
|
1390
|
-
|
1391
|
-
/**
|
1392
|
-
* Creates a new Cartographic instance from longitude and latitude
|
1393
|
-
* specified in radians.
|
1394
|
-
*
|
1395
|
-
* @param {number} longitude The longitude, in radians.
|
1396
|
-
* @param {number} latitude The latitude, in radians.
|
1397
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
1398
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
1399
|
-
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided.
|
1400
|
-
*/
|
1401
|
-
Cartographic.fromRadians = function (longitude, latitude, height, result) {
|
1402
|
-
//>>includeStart('debug', pragmas.debug);
|
1403
|
-
Check.Check.typeOf.number("longitude", longitude);
|
1404
|
-
Check.Check.typeOf.number("latitude", latitude);
|
1405
|
-
//>>includeEnd('debug');
|
1406
|
-
|
1407
|
-
height = defaultValue.defaultValue(height, 0.0);
|
1408
|
-
|
1409
|
-
if (!defaultValue.defined(result)) {
|
1410
|
-
return new Cartographic(longitude, latitude, height);
|
1411
|
-
}
|
1412
|
-
|
1413
|
-
result.longitude = longitude;
|
1414
|
-
result.latitude = latitude;
|
1415
|
-
result.height = height;
|
1416
|
-
return result;
|
1417
|
-
};
|
1418
|
-
|
1419
|
-
/**
|
1420
|
-
* Creates a new Cartographic instance from longitude and latitude
|
1421
|
-
* specified in degrees. The values in the resulting object will
|
1422
|
-
* be in radians.
|
1423
|
-
*
|
1424
|
-
* @param {number} longitude The longitude, in degrees.
|
1425
|
-
* @param {number} latitude The latitude, in degrees.
|
1426
|
-
* @param {number} [height=0.0] The height, in meters, above the ellipsoid.
|
1427
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
1428
|
-
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided.
|
1429
|
-
*/
|
1430
|
-
Cartographic.fromDegrees = function (longitude, latitude, height, result) {
|
1431
|
-
//>>includeStart('debug', pragmas.debug);
|
1432
|
-
Check.Check.typeOf.number("longitude", longitude);
|
1433
|
-
Check.Check.typeOf.number("latitude", latitude);
|
1434
|
-
//>>includeEnd('debug');
|
1435
|
-
longitude = Math$1.CesiumMath.toRadians(longitude);
|
1436
|
-
latitude = Math$1.CesiumMath.toRadians(latitude);
|
1437
|
-
|
1438
|
-
return Cartographic.fromRadians(longitude, latitude, height, result);
|
1439
|
-
};
|
1440
|
-
|
1441
|
-
const cartesianToCartographicN$1 = new Cartesian3();
|
1442
|
-
const cartesianToCartographicP$1 = new Cartesian3();
|
1443
|
-
const cartesianToCartographicH$1 = new Cartesian3();
|
1444
|
-
const wgs84OneOverRadii = new Cartesian3(
|
1445
|
-
1.0 / 6378137.0,
|
1446
|
-
1.0 / 6378137.0,
|
1447
|
-
1.0 / 6356752.3142451793
|
1448
|
-
);
|
1449
|
-
const wgs84OneOverRadiiSquared = new Cartesian3(
|
1450
|
-
1.0 / (6378137.0 * 6378137.0),
|
1451
|
-
1.0 / (6378137.0 * 6378137.0),
|
1452
|
-
1.0 / (6356752.3142451793 * 6356752.3142451793)
|
1453
|
-
);
|
1454
|
-
const wgs84CenterToleranceSquared = Math$1.CesiumMath.EPSILON1;
|
1455
|
-
|
1456
|
-
/**
|
1457
|
-
* Creates a new Cartographic instance from a Cartesian position. The values in the
|
1458
|
-
* resulting object will be in radians.
|
1459
|
-
*
|
1460
|
-
* @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation.
|
1461
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
1462
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
1463
|
-
* @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
|
1464
|
-
*/
|
1465
|
-
Cartographic.fromCartesian = function (cartesian, ellipsoid, result) {
|
1466
|
-
const oneOverRadii = defaultValue.defined(ellipsoid)
|
1467
|
-
? ellipsoid.oneOverRadii
|
1468
|
-
: wgs84OneOverRadii;
|
1469
|
-
const oneOverRadiiSquared = defaultValue.defined(ellipsoid)
|
1470
|
-
? ellipsoid.oneOverRadiiSquared
|
1471
|
-
: wgs84OneOverRadiiSquared;
|
1472
|
-
const centerToleranceSquared = defaultValue.defined(ellipsoid)
|
1473
|
-
? ellipsoid._centerToleranceSquared
|
1474
|
-
: wgs84CenterToleranceSquared;
|
1475
|
-
|
1476
|
-
//`cartesian is required.` is thrown from scaleToGeodeticSurface
|
1477
|
-
const p = scaleToGeodeticSurface(
|
1478
|
-
cartesian,
|
1479
|
-
oneOverRadii,
|
1480
|
-
oneOverRadiiSquared,
|
1481
|
-
centerToleranceSquared,
|
1482
|
-
cartesianToCartographicP$1
|
1483
|
-
);
|
1484
|
-
|
1485
|
-
if (!defaultValue.defined(p)) {
|
1486
|
-
return undefined;
|
1487
|
-
}
|
1488
|
-
|
1489
|
-
let n = Cartesian3.multiplyComponents(
|
1490
|
-
p,
|
1491
|
-
oneOverRadiiSquared,
|
1492
|
-
cartesianToCartographicN$1
|
1493
|
-
);
|
1494
|
-
n = Cartesian3.normalize(n, n);
|
1495
|
-
|
1496
|
-
const h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH$1);
|
1497
|
-
|
1498
|
-
const longitude = Math.atan2(n.y, n.x);
|
1499
|
-
const latitude = Math.asin(n.z);
|
1500
|
-
const height =
|
1501
|
-
Math$1.CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h);
|
1502
|
-
|
1503
|
-
if (!defaultValue.defined(result)) {
|
1504
|
-
return new Cartographic(longitude, latitude, height);
|
1505
|
-
}
|
1506
|
-
result.longitude = longitude;
|
1507
|
-
result.latitude = latitude;
|
1508
|
-
result.height = height;
|
1509
|
-
return result;
|
1510
|
-
};
|
1511
|
-
|
1512
|
-
/**
|
1513
|
-
* Creates a new Cartesian3 instance from a Cartographic input. The values in the inputted
|
1514
|
-
* object should be in radians.
|
1515
|
-
*
|
1516
|
-
* @param {Cartographic} cartographic Input to be converted into a Cartesian3 output.
|
1517
|
-
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies.
|
1518
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
1519
|
-
* @returns {Cartesian3} The position
|
1520
|
-
*/
|
1521
|
-
Cartographic.toCartesian = function (cartographic, ellipsoid, result) {
|
1522
|
-
//>>includeStart('debug', pragmas.debug);
|
1523
|
-
Check.Check.defined("cartographic", cartographic);
|
1524
|
-
//>>includeEnd('debug');
|
1525
|
-
|
1526
|
-
return Cartesian3.fromRadians(
|
1527
|
-
cartographic.longitude,
|
1528
|
-
cartographic.latitude,
|
1529
|
-
cartographic.height,
|
1530
|
-
ellipsoid,
|
1531
|
-
result
|
1532
|
-
);
|
1533
|
-
};
|
1534
|
-
|
1535
|
-
/**
|
1536
|
-
* Duplicates a Cartographic instance.
|
1537
|
-
*
|
1538
|
-
* @param {Cartographic} cartographic The cartographic to duplicate.
|
1539
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
1540
|
-
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided. (Returns undefined if cartographic is undefined)
|
1541
|
-
*/
|
1542
|
-
Cartographic.clone = function (cartographic, result) {
|
1543
|
-
if (!defaultValue.defined(cartographic)) {
|
1544
|
-
return undefined;
|
1545
|
-
}
|
1546
|
-
if (!defaultValue.defined(result)) {
|
1547
|
-
return new Cartographic(
|
1548
|
-
cartographic.longitude,
|
1549
|
-
cartographic.latitude,
|
1550
|
-
cartographic.height
|
1551
|
-
);
|
1552
|
-
}
|
1553
|
-
result.longitude = cartographic.longitude;
|
1554
|
-
result.latitude = cartographic.latitude;
|
1555
|
-
result.height = cartographic.height;
|
1556
|
-
return result;
|
1557
|
-
};
|
1558
|
-
|
1559
|
-
/**
|
1560
|
-
* Compares the provided cartographics componentwise and returns
|
1561
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
1562
|
-
*
|
1563
|
-
* @param {Cartographic} [left] The first cartographic.
|
1564
|
-
* @param {Cartographic} [right] The second cartographic.
|
1565
|
-
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
1566
|
-
*/
|
1567
|
-
Cartographic.equals = function (left, right) {
|
1568
|
-
return (
|
1569
|
-
left === right ||
|
1570
|
-
(defaultValue.defined(left) &&
|
1571
|
-
defaultValue.defined(right) &&
|
1572
|
-
left.longitude === right.longitude &&
|
1573
|
-
left.latitude === right.latitude &&
|
1574
|
-
left.height === right.height)
|
1575
|
-
);
|
1576
|
-
};
|
1577
|
-
|
1578
|
-
/**
|
1579
|
-
* Compares the provided cartographics componentwise and returns
|
1580
|
-
* <code>true</code> if they are within the provided epsilon,
|
1581
|
-
* <code>false</code> otherwise.
|
1582
|
-
*
|
1583
|
-
* @param {Cartographic} [left] The first cartographic.
|
1584
|
-
* @param {Cartographic} [right] The second cartographic.
|
1585
|
-
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
1586
|
-
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
1587
|
-
*/
|
1588
|
-
Cartographic.equalsEpsilon = function (left, right, epsilon) {
|
1589
|
-
epsilon = defaultValue.defaultValue(epsilon, 0);
|
1590
|
-
|
1591
|
-
return (
|
1592
|
-
left === right ||
|
1593
|
-
(defaultValue.defined(left) &&
|
1594
|
-
defaultValue.defined(right) &&
|
1595
|
-
Math.abs(left.longitude - right.longitude) <= epsilon &&
|
1596
|
-
Math.abs(left.latitude - right.latitude) <= epsilon &&
|
1597
|
-
Math.abs(left.height - right.height) <= epsilon)
|
1598
|
-
);
|
1599
|
-
};
|
1600
|
-
|
1601
|
-
/**
|
1602
|
-
* An immutable Cartographic instance initialized to (0.0, 0.0, 0.0).
|
1603
|
-
*
|
1604
|
-
* @type {Cartographic}
|
1605
|
-
* @constant
|
1606
|
-
*/
|
1607
|
-
Cartographic.ZERO = Object.freeze(new Cartographic(0.0, 0.0, 0.0));
|
1608
|
-
|
1609
|
-
/**
|
1610
|
-
* Duplicates this instance.
|
1611
|
-
*
|
1612
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
1613
|
-
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided.
|
1614
|
-
*/
|
1615
|
-
Cartographic.prototype.clone = function (result) {
|
1616
|
-
return Cartographic.clone(this, result);
|
1617
|
-
};
|
1618
|
-
|
1619
|
-
/**
|
1620
|
-
* Compares the provided against this cartographic componentwise and returns
|
1621
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
1622
|
-
*
|
1623
|
-
* @param {Cartographic} [right] The second cartographic.
|
1624
|
-
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
1625
|
-
*/
|
1626
|
-
Cartographic.prototype.equals = function (right) {
|
1627
|
-
return Cartographic.equals(this, right);
|
1628
|
-
};
|
1629
|
-
|
1630
|
-
/**
|
1631
|
-
* Compares the provided against this cartographic componentwise and returns
|
1632
|
-
* <code>true</code> if they are within the provided epsilon,
|
1633
|
-
* <code>false</code> otherwise.
|
1634
|
-
*
|
1635
|
-
* @param {Cartographic} [right] The second cartographic.
|
1636
|
-
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
1637
|
-
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
1638
|
-
*/
|
1639
|
-
Cartographic.prototype.equalsEpsilon = function (right, epsilon) {
|
1640
|
-
return Cartographic.equalsEpsilon(this, right, epsilon);
|
1641
|
-
};
|
1642
|
-
|
1643
|
-
/**
|
1644
|
-
* Creates a string representing this cartographic in the format '(longitude, latitude, height)'.
|
1645
|
-
*
|
1646
|
-
* @returns {string} A string representing the provided cartographic in the format '(longitude, latitude, height)'.
|
1647
|
-
*/
|
1648
|
-
Cartographic.prototype.toString = function () {
|
1649
|
-
return `(${this.longitude}, ${this.latitude}, ${this.height})`;
|
1650
|
-
};
|
1651
|
-
|
1652
|
-
function initialize(ellipsoid, x, y, z) {
|
1653
|
-
x = defaultValue.defaultValue(x, 0.0);
|
1654
|
-
y = defaultValue.defaultValue(y, 0.0);
|
1655
|
-
z = defaultValue.defaultValue(z, 0.0);
|
1656
|
-
|
1657
|
-
//>>includeStart('debug', pragmas.debug);
|
1658
|
-
Check.Check.typeOf.number.greaterThanOrEquals("x", x, 0.0);
|
1659
|
-
Check.Check.typeOf.number.greaterThanOrEquals("y", y, 0.0);
|
1660
|
-
Check.Check.typeOf.number.greaterThanOrEquals("z", z, 0.0);
|
1661
|
-
//>>includeEnd('debug');
|
1662
|
-
|
1663
|
-
ellipsoid._radii = new Cartesian3(x, y, z);
|
1664
|
-
|
1665
|
-
ellipsoid._radiiSquared = new Cartesian3(x * x, y * y, z * z);
|
1666
|
-
|
1667
|
-
ellipsoid._radiiToTheFourth = new Cartesian3(
|
1668
|
-
x * x * x * x,
|
1669
|
-
y * y * y * y,
|
1670
|
-
z * z * z * z
|
1671
|
-
);
|
1672
|
-
|
1673
|
-
ellipsoid._oneOverRadii = new Cartesian3(
|
1674
|
-
x === 0.0 ? 0.0 : 1.0 / x,
|
1675
|
-
y === 0.0 ? 0.0 : 1.0 / y,
|
1676
|
-
z === 0.0 ? 0.0 : 1.0 / z
|
1677
|
-
);
|
1678
|
-
|
1679
|
-
ellipsoid._oneOverRadiiSquared = new Cartesian3(
|
1680
|
-
x === 0.0 ? 0.0 : 1.0 / (x * x),
|
1681
|
-
y === 0.0 ? 0.0 : 1.0 / (y * y),
|
1682
|
-
z === 0.0 ? 0.0 : 1.0 / (z * z)
|
1683
|
-
);
|
1684
|
-
|
1685
|
-
ellipsoid._minimumRadius = Math.min(x, y, z);
|
1686
|
-
|
1687
|
-
ellipsoid._maximumRadius = Math.max(x, y, z);
|
1688
|
-
|
1689
|
-
ellipsoid._centerToleranceSquared = Math$1.CesiumMath.EPSILON1;
|
1690
|
-
|
1691
|
-
if (ellipsoid._radiiSquared.z !== 0) {
|
1692
|
-
ellipsoid._squaredXOverSquaredZ =
|
1693
|
-
ellipsoid._radiiSquared.x / ellipsoid._radiiSquared.z;
|
1694
|
-
}
|
1695
|
-
}
|
1696
|
-
|
1697
|
-
/**
|
1698
|
-
* A quadratic surface defined in Cartesian coordinates by the equation
|
1699
|
-
* <code>(x / a)^2 + (y / b)^2 + (z / c)^2 = 1</code>. Primarily used
|
1700
|
-
* by Cesium to represent the shape of planetary bodies.
|
1701
|
-
*
|
1702
|
-
* Rather than constructing this object directly, one of the provided
|
1703
|
-
* constants is normally used.
|
1704
|
-
* @alias Ellipsoid
|
1705
|
-
* @constructor
|
1706
|
-
*
|
1707
|
-
* @param {number} [x=0] The radius in the x direction.
|
1708
|
-
* @param {number} [y=0] The radius in the y direction.
|
1709
|
-
* @param {number} [z=0] The radius in the z direction.
|
1710
|
-
*
|
1711
|
-
* @exception {DeveloperError} All radii components must be greater than or equal to zero.
|
1712
|
-
*
|
1713
|
-
* @see Ellipsoid.fromCartesian3
|
1714
|
-
* @see Ellipsoid.WGS84
|
1715
|
-
* @see Ellipsoid.UNIT_SPHERE
|
1716
|
-
*/
|
1717
|
-
function Ellipsoid(x, y, z) {
|
1718
|
-
this._radii = undefined;
|
1719
|
-
this._radiiSquared = undefined;
|
1720
|
-
this._radiiToTheFourth = undefined;
|
1721
|
-
this._oneOverRadii = undefined;
|
1722
|
-
this._oneOverRadiiSquared = undefined;
|
1723
|
-
this._minimumRadius = undefined;
|
1724
|
-
this._maximumRadius = undefined;
|
1725
|
-
this._centerToleranceSquared = undefined;
|
1726
|
-
this._squaredXOverSquaredZ = undefined;
|
1727
|
-
|
1728
|
-
initialize(this, x, y, z);
|
1729
|
-
}
|
1730
|
-
|
1731
|
-
Object.defineProperties(Ellipsoid.prototype, {
|
1732
|
-
/**
|
1733
|
-
* Gets the radii of the ellipsoid.
|
1734
|
-
* @memberof Ellipsoid.prototype
|
1735
|
-
* @type {Cartesian3}
|
1736
|
-
* @readonly
|
1737
|
-
*/
|
1738
|
-
radii: {
|
1739
|
-
get: function () {
|
1740
|
-
return this._radii;
|
1741
|
-
},
|
1742
|
-
},
|
1743
|
-
/**
|
1744
|
-
* Gets the squared radii of the ellipsoid.
|
1745
|
-
* @memberof Ellipsoid.prototype
|
1746
|
-
* @type {Cartesian3}
|
1747
|
-
* @readonly
|
1748
|
-
*/
|
1749
|
-
radiiSquared: {
|
1750
|
-
get: function () {
|
1751
|
-
return this._radiiSquared;
|
1752
|
-
},
|
1753
|
-
},
|
1754
|
-
/**
|
1755
|
-
* Gets the radii of the ellipsoid raise to the fourth power.
|
1756
|
-
* @memberof Ellipsoid.prototype
|
1757
|
-
* @type {Cartesian3}
|
1758
|
-
* @readonly
|
1759
|
-
*/
|
1760
|
-
radiiToTheFourth: {
|
1761
|
-
get: function () {
|
1762
|
-
return this._radiiToTheFourth;
|
1763
|
-
},
|
1764
|
-
},
|
1765
|
-
/**
|
1766
|
-
* Gets one over the radii of the ellipsoid.
|
1767
|
-
* @memberof Ellipsoid.prototype
|
1768
|
-
* @type {Cartesian3}
|
1769
|
-
* @readonly
|
1770
|
-
*/
|
1771
|
-
oneOverRadii: {
|
1772
|
-
get: function () {
|
1773
|
-
return this._oneOverRadii;
|
1774
|
-
},
|
1775
|
-
},
|
1776
|
-
/**
|
1777
|
-
* Gets one over the squared radii of the ellipsoid.
|
1778
|
-
* @memberof Ellipsoid.prototype
|
1779
|
-
* @type {Cartesian3}
|
1780
|
-
* @readonly
|
1781
|
-
*/
|
1782
|
-
oneOverRadiiSquared: {
|
1783
|
-
get: function () {
|
1784
|
-
return this._oneOverRadiiSquared;
|
1785
|
-
},
|
1786
|
-
},
|
1787
|
-
/**
|
1788
|
-
* Gets the minimum radius of the ellipsoid.
|
1789
|
-
* @memberof Ellipsoid.prototype
|
1790
|
-
* @type {number}
|
1791
|
-
* @readonly
|
1792
|
-
*/
|
1793
|
-
minimumRadius: {
|
1794
|
-
get: function () {
|
1795
|
-
return this._minimumRadius;
|
1796
|
-
},
|
1797
|
-
},
|
1798
|
-
/**
|
1799
|
-
* Gets the maximum radius of the ellipsoid.
|
1800
|
-
* @memberof Ellipsoid.prototype
|
1801
|
-
* @type {number}
|
1802
|
-
* @readonly
|
1803
|
-
*/
|
1804
|
-
maximumRadius: {
|
1805
|
-
get: function () {
|
1806
|
-
return this._maximumRadius;
|
1807
|
-
},
|
1808
|
-
},
|
1809
|
-
});
|
1810
|
-
|
1811
|
-
/**
|
1812
|
-
* Duplicates an Ellipsoid instance.
|
1813
|
-
*
|
1814
|
-
* @param {Ellipsoid} ellipsoid The ellipsoid to duplicate.
|
1815
|
-
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
|
1816
|
-
* instance should be created.
|
1817
|
-
* @returns {Ellipsoid} The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
|
1818
|
-
*/
|
1819
|
-
Ellipsoid.clone = function (ellipsoid, result) {
|
1820
|
-
if (!defaultValue.defined(ellipsoid)) {
|
1821
|
-
return undefined;
|
1822
|
-
}
|
1823
|
-
const radii = ellipsoid._radii;
|
1824
|
-
|
1825
|
-
if (!defaultValue.defined(result)) {
|
1826
|
-
return new Ellipsoid(radii.x, radii.y, radii.z);
|
1827
|
-
}
|
1828
|
-
|
1829
|
-
Cartesian3.clone(radii, result._radii);
|
1830
|
-
Cartesian3.clone(ellipsoid._radiiSquared, result._radiiSquared);
|
1831
|
-
Cartesian3.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
|
1832
|
-
Cartesian3.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
|
1833
|
-
Cartesian3.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
|
1834
|
-
result._minimumRadius = ellipsoid._minimumRadius;
|
1835
|
-
result._maximumRadius = ellipsoid._maximumRadius;
|
1836
|
-
result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
|
1837
|
-
|
1838
|
-
return result;
|
1839
|
-
};
|
1840
|
-
|
1841
|
-
/**
|
1842
|
-
* Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
|
1843
|
-
*
|
1844
|
-
* @param {Cartesian3} [cartesian=Cartesian3.ZERO] The ellipsoid's radius in the x, y, and z directions.
|
1845
|
-
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
|
1846
|
-
* instance should be created.
|
1847
|
-
* @returns {Ellipsoid} A new Ellipsoid instance.
|
1848
|
-
*
|
1849
|
-
* @exception {DeveloperError} All radii components must be greater than or equal to zero.
|
1850
|
-
*
|
1851
|
-
* @see Ellipsoid.WGS84
|
1852
|
-
* @see Ellipsoid.UNIT_SPHERE
|
1853
|
-
*/
|
1854
|
-
Ellipsoid.fromCartesian3 = function (cartesian, result) {
|
1855
|
-
if (!defaultValue.defined(result)) {
|
1856
|
-
result = new Ellipsoid();
|
1857
|
-
}
|
1858
|
-
|
1859
|
-
if (!defaultValue.defined(cartesian)) {
|
1860
|
-
return result;
|
1861
|
-
}
|
1862
|
-
|
1863
|
-
initialize(result, cartesian.x, cartesian.y, cartesian.z);
|
1864
|
-
return result;
|
1865
|
-
};
|
1866
|
-
|
1867
|
-
/**
|
1868
|
-
* An Ellipsoid instance initialized to the WGS84 standard.
|
1869
|
-
*
|
1870
|
-
* @type {Ellipsoid}
|
1871
|
-
* @constant
|
1872
|
-
*/
|
1873
|
-
Ellipsoid.WGS84 = Object.freeze(
|
1874
|
-
new Ellipsoid(6378137.0, 6378137.0, 6356752.3142451793)
|
1875
|
-
);
|
1876
|
-
|
1877
|
-
/**
|
1878
|
-
* An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
|
1879
|
-
*
|
1880
|
-
* @type {Ellipsoid}
|
1881
|
-
* @constant
|
1882
|
-
*/
|
1883
|
-
Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1.0, 1.0, 1.0));
|
1884
|
-
|
1885
|
-
/**
|
1886
|
-
* An Ellipsoid instance initialized to a sphere with the lunar radius.
|
1887
|
-
*
|
1888
|
-
* @type {Ellipsoid}
|
1889
|
-
* @constant
|
1890
|
-
*/
|
1891
|
-
Ellipsoid.MOON = Object.freeze(
|
1892
|
-
new Ellipsoid(
|
1893
|
-
Math$1.CesiumMath.LUNAR_RADIUS,
|
1894
|
-
Math$1.CesiumMath.LUNAR_RADIUS,
|
1895
|
-
Math$1.CesiumMath.LUNAR_RADIUS
|
1896
|
-
)
|
1897
|
-
);
|
1898
|
-
|
1899
|
-
/**
|
1900
|
-
* Duplicates an Ellipsoid instance.
|
1901
|
-
*
|
1902
|
-
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
|
1903
|
-
* instance should be created.
|
1904
|
-
* @returns {Ellipsoid} The cloned Ellipsoid.
|
1905
|
-
*/
|
1906
|
-
Ellipsoid.prototype.clone = function (result) {
|
1907
|
-
return Ellipsoid.clone(this, result);
|
1908
|
-
};
|
1909
|
-
|
1910
|
-
/**
|
1911
|
-
* The number of elements used to pack the object into an array.
|
1912
|
-
* @type {number}
|
1913
|
-
*/
|
1914
|
-
Ellipsoid.packedLength = Cartesian3.packedLength;
|
1915
|
-
|
1916
|
-
/**
|
1917
|
-
* Stores the provided instance into the provided array.
|
1918
|
-
*
|
1919
|
-
* @param {Ellipsoid} value The value to pack.
|
1920
|
-
* @param {number[]} array The array to pack into.
|
1921
|
-
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
1922
|
-
*
|
1923
|
-
* @returns {number[]} The array that was packed into
|
1924
|
-
*/
|
1925
|
-
Ellipsoid.pack = function (value, array, startingIndex) {
|
1926
|
-
//>>includeStart('debug', pragmas.debug);
|
1927
|
-
Check.Check.typeOf.object("value", value);
|
1928
|
-
Check.Check.defined("array", array);
|
1929
|
-
//>>includeEnd('debug');
|
1930
|
-
|
1931
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
1932
|
-
|
1933
|
-
Cartesian3.pack(value._radii, array, startingIndex);
|
1934
|
-
|
1935
|
-
return array;
|
1936
|
-
};
|
1937
|
-
|
1938
|
-
/**
|
1939
|
-
* Retrieves an instance from a packed array.
|
1940
|
-
*
|
1941
|
-
* @param {number[]} array The packed array.
|
1942
|
-
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
1943
|
-
* @param {Ellipsoid} [result] The object into which to store the result.
|
1944
|
-
* @returns {Ellipsoid} The modified result parameter or a new Ellipsoid instance if one was not provided.
|
1945
|
-
*/
|
1946
|
-
Ellipsoid.unpack = function (array, startingIndex, result) {
|
1947
|
-
//>>includeStart('debug', pragmas.debug);
|
1948
|
-
Check.Check.defined("array", array);
|
1949
|
-
//>>includeEnd('debug');
|
1950
|
-
|
1951
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
1952
|
-
|
1953
|
-
const radii = Cartesian3.unpack(array, startingIndex);
|
1954
|
-
return Ellipsoid.fromCartesian3(radii, result);
|
1955
|
-
};
|
1956
|
-
|
1957
|
-
/**
|
1958
|
-
* Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
|
1959
|
-
* @function
|
1960
|
-
*
|
1961
|
-
* @param {Cartesian3} cartesian The Cartesian for which to to determine the geocentric normal.
|
1962
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
1963
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
|
1964
|
-
*/
|
1965
|
-
Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3.normalize;
|
1966
|
-
|
1967
|
-
/**
|
1968
|
-
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
|
1969
|
-
*
|
1970
|
-
* @param {Cartographic} cartographic The cartographic position for which to to determine the geodetic normal.
|
1971
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
1972
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
|
1973
|
-
*/
|
1974
|
-
Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function (
|
1975
|
-
cartographic,
|
1976
|
-
result
|
1977
|
-
) {
|
1978
|
-
//>>includeStart('debug', pragmas.debug);
|
1979
|
-
Check.Check.typeOf.object("cartographic", cartographic);
|
1980
|
-
//>>includeEnd('debug');
|
1981
|
-
|
1982
|
-
const longitude = cartographic.longitude;
|
1983
|
-
const latitude = cartographic.latitude;
|
1984
|
-
const cosLatitude = Math.cos(latitude);
|
1985
|
-
|
1986
|
-
const x = cosLatitude * Math.cos(longitude);
|
1987
|
-
const y = cosLatitude * Math.sin(longitude);
|
1988
|
-
const z = Math.sin(latitude);
|
1989
|
-
|
1990
|
-
if (!defaultValue.defined(result)) {
|
1991
|
-
result = new Cartesian3();
|
1992
|
-
}
|
1993
|
-
result.x = x;
|
1994
|
-
result.y = y;
|
1995
|
-
result.z = z;
|
1996
|
-
return Cartesian3.normalize(result, result);
|
1997
|
-
};
|
1998
|
-
|
1999
|
-
/**
|
2000
|
-
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
|
2001
|
-
*
|
2002
|
-
* @param {Cartesian3} cartesian The Cartesian position for which to to determine the surface normal.
|
2003
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
2004
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
|
2005
|
-
*/
|
2006
|
-
Ellipsoid.prototype.geodeticSurfaceNormal = function (cartesian, result) {
|
2007
|
-
if (
|
2008
|
-
Cartesian3.equalsEpsilon(cartesian, Cartesian3.ZERO, Math$1.CesiumMath.EPSILON14)
|
2009
|
-
) {
|
2010
|
-
return undefined;
|
2011
|
-
}
|
2012
|
-
if (!defaultValue.defined(result)) {
|
2013
|
-
result = new Cartesian3();
|
2014
|
-
}
|
2015
|
-
result = Cartesian3.multiplyComponents(
|
2016
|
-
cartesian,
|
2017
|
-
this._oneOverRadiiSquared,
|
2018
|
-
result
|
2019
|
-
);
|
2020
|
-
return Cartesian3.normalize(result, result);
|
2021
|
-
};
|
2022
|
-
|
2023
|
-
const cartographicToCartesianNormal = new Cartesian3();
|
2024
|
-
const cartographicToCartesianK = new Cartesian3();
|
2025
|
-
|
2026
|
-
/**
|
2027
|
-
* Converts the provided cartographic to Cartesian representation.
|
2028
|
-
*
|
2029
|
-
* @param {Cartographic} cartographic The cartographic position.
|
2030
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
2031
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
|
2032
|
-
*
|
2033
|
-
* @example
|
2034
|
-
* //Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
|
2035
|
-
* const position = new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 5000);
|
2036
|
-
* const cartesianPosition = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);
|
2037
|
-
*/
|
2038
|
-
Ellipsoid.prototype.cartographicToCartesian = function (cartographic, result) {
|
2039
|
-
//`cartographic is required` is thrown from geodeticSurfaceNormalCartographic.
|
2040
|
-
const n = cartographicToCartesianNormal;
|
2041
|
-
const k = cartographicToCartesianK;
|
2042
|
-
this.geodeticSurfaceNormalCartographic(cartographic, n);
|
2043
|
-
Cartesian3.multiplyComponents(this._radiiSquared, n, k);
|
2044
|
-
const gamma = Math.sqrt(Cartesian3.dot(n, k));
|
2045
|
-
Cartesian3.divideByScalar(k, gamma, k);
|
2046
|
-
Cartesian3.multiplyByScalar(n, cartographic.height, n);
|
2047
|
-
|
2048
|
-
if (!defaultValue.defined(result)) {
|
2049
|
-
result = new Cartesian3();
|
2050
|
-
}
|
2051
|
-
return Cartesian3.add(k, n, result);
|
2052
|
-
};
|
2053
|
-
|
2054
|
-
/**
|
2055
|
-
* Converts the provided array of cartographics to an array of Cartesians.
|
2056
|
-
*
|
2057
|
-
* @param {Cartographic[]} cartographics An array of cartographic positions.
|
2058
|
-
* @param {Cartesian3[]} [result] The object onto which to store the result.
|
2059
|
-
* @returns {Cartesian3[]} The modified result parameter or a new Array instance if none was provided.
|
2060
|
-
*
|
2061
|
-
* @example
|
2062
|
-
* //Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
|
2063
|
-
* const positions = [new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 0),
|
2064
|
-
* new Cesium.Cartographic(Cesium.Math.toRadians(21.321), Cesium.Math.toRadians(78.123), 100),
|
2065
|
-
* new Cesium.Cartographic(Cesium.Math.toRadians(21.645), Cesium.Math.toRadians(78.456), 250)];
|
2066
|
-
* const cartesianPositions = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
|
2067
|
-
*/
|
2068
|
-
Ellipsoid.prototype.cartographicArrayToCartesianArray = function (
|
2069
|
-
cartographics,
|
2070
|
-
result
|
2071
|
-
) {
|
2072
|
-
//>>includeStart('debug', pragmas.debug);
|
2073
|
-
Check.Check.defined("cartographics", cartographics);
|
2074
|
-
//>>includeEnd('debug')
|
2075
|
-
|
2076
|
-
const length = cartographics.length;
|
2077
|
-
if (!defaultValue.defined(result)) {
|
2078
|
-
result = new Array(length);
|
2079
|
-
} else {
|
2080
|
-
result.length = length;
|
2081
|
-
}
|
2082
|
-
for (let i = 0; i < length; i++) {
|
2083
|
-
result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
|
2084
|
-
}
|
2085
|
-
return result;
|
2086
|
-
};
|
2087
|
-
|
2088
|
-
const cartesianToCartographicN = new Cartesian3();
|
2089
|
-
const cartesianToCartographicP = new Cartesian3();
|
2090
|
-
const cartesianToCartographicH = new Cartesian3();
|
2091
|
-
|
2092
|
-
/**
|
2093
|
-
* Converts the provided cartesian to cartographic representation.
|
2094
|
-
* The cartesian is undefined at the center of the ellipsoid.
|
2095
|
-
*
|
2096
|
-
* @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation.
|
2097
|
-
* @param {Cartographic} [result] The object onto which to store the result.
|
2098
|
-
* @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
|
2099
|
-
*
|
2100
|
-
* @example
|
2101
|
-
* //Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
|
2102
|
-
* const position = new Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
|
2103
|
-
* const cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
|
2104
|
-
*/
|
2105
|
-
Ellipsoid.prototype.cartesianToCartographic = function (cartesian, result) {
|
2106
|
-
//`cartesian is required.` is thrown from scaleToGeodeticSurface
|
2107
|
-
const p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP);
|
2108
|
-
|
2109
|
-
if (!defaultValue.defined(p)) {
|
2110
|
-
return undefined;
|
2111
|
-
}
|
2112
|
-
|
2113
|
-
const n = this.geodeticSurfaceNormal(p, cartesianToCartographicN);
|
2114
|
-
const h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH);
|
2115
|
-
|
2116
|
-
const longitude = Math.atan2(n.y, n.x);
|
2117
|
-
const latitude = Math.asin(n.z);
|
2118
|
-
const height =
|
2119
|
-
Math$1.CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h);
|
2120
|
-
|
2121
|
-
if (!defaultValue.defined(result)) {
|
2122
|
-
return new Cartographic(longitude, latitude, height);
|
2123
|
-
}
|
2124
|
-
result.longitude = longitude;
|
2125
|
-
result.latitude = latitude;
|
2126
|
-
result.height = height;
|
2127
|
-
return result;
|
2128
|
-
};
|
2129
|
-
|
2130
|
-
/**
|
2131
|
-
* Converts the provided array of cartesians to an array of cartographics.
|
2132
|
-
*
|
2133
|
-
* @param {Cartesian3[]} cartesians An array of Cartesian positions.
|
2134
|
-
* @param {Cartographic[]} [result] The object onto which to store the result.
|
2135
|
-
* @returns {Cartographic[]} The modified result parameter or a new Array instance if none was provided.
|
2136
|
-
*
|
2137
|
-
* @example
|
2138
|
-
* //Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
|
2139
|
-
* const positions = [new Cesium.Cartesian3(17832.12, 83234.52, 952313.73),
|
2140
|
-
* new Cesium.Cartesian3(17832.13, 83234.53, 952313.73),
|
2141
|
-
* new Cesium.Cartesian3(17832.14, 83234.54, 952313.73)]
|
2142
|
-
* const cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
|
2143
|
-
*/
|
2144
|
-
Ellipsoid.prototype.cartesianArrayToCartographicArray = function (
|
2145
|
-
cartesians,
|
2146
|
-
result
|
2147
|
-
) {
|
2148
|
-
//>>includeStart('debug', pragmas.debug);
|
2149
|
-
Check.Check.defined("cartesians", cartesians);
|
2150
|
-
//>>includeEnd('debug');
|
2151
|
-
|
2152
|
-
const length = cartesians.length;
|
2153
|
-
if (!defaultValue.defined(result)) {
|
2154
|
-
result = new Array(length);
|
2155
|
-
} else {
|
2156
|
-
result.length = length;
|
2157
|
-
}
|
2158
|
-
for (let i = 0; i < length; ++i) {
|
2159
|
-
result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
|
2160
|
-
}
|
2161
|
-
return result;
|
2162
|
-
};
|
2163
|
-
|
2164
|
-
/**
|
2165
|
-
* Scales the provided Cartesian position along the geodetic surface normal
|
2166
|
-
* so that it is on the surface of this ellipsoid. If the position is
|
2167
|
-
* at the center of the ellipsoid, this function returns undefined.
|
2168
|
-
*
|
2169
|
-
* @param {Cartesian3} cartesian The Cartesian position to scale.
|
2170
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
2171
|
-
* @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
|
2172
|
-
*/
|
2173
|
-
Ellipsoid.prototype.scaleToGeodeticSurface = function (cartesian, result) {
|
2174
|
-
return scaleToGeodeticSurface(
|
2175
|
-
cartesian,
|
2176
|
-
this._oneOverRadii,
|
2177
|
-
this._oneOverRadiiSquared,
|
2178
|
-
this._centerToleranceSquared,
|
2179
|
-
result
|
2180
|
-
);
|
2181
|
-
};
|
2182
|
-
|
2183
|
-
/**
|
2184
|
-
* Scales the provided Cartesian position along the geocentric surface normal
|
2185
|
-
* so that it is on the surface of this ellipsoid.
|
2186
|
-
*
|
2187
|
-
* @param {Cartesian3} cartesian The Cartesian position to scale.
|
2188
|
-
* @param {Cartesian3} [result] The object onto which to store the result.
|
2189
|
-
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
|
2190
|
-
*/
|
2191
|
-
Ellipsoid.prototype.scaleToGeocentricSurface = function (cartesian, result) {
|
2192
|
-
//>>includeStart('debug', pragmas.debug);
|
2193
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
2194
|
-
//>>includeEnd('debug');
|
2195
|
-
|
2196
|
-
if (!defaultValue.defined(result)) {
|
2197
|
-
result = new Cartesian3();
|
2198
|
-
}
|
2199
|
-
|
2200
|
-
const positionX = cartesian.x;
|
2201
|
-
const positionY = cartesian.y;
|
2202
|
-
const positionZ = cartesian.z;
|
2203
|
-
const oneOverRadiiSquared = this._oneOverRadiiSquared;
|
2204
|
-
|
2205
|
-
const beta =
|
2206
|
-
1.0 /
|
2207
|
-
Math.sqrt(
|
2208
|
-
positionX * positionX * oneOverRadiiSquared.x +
|
2209
|
-
positionY * positionY * oneOverRadiiSquared.y +
|
2210
|
-
positionZ * positionZ * oneOverRadiiSquared.z
|
2211
|
-
);
|
2212
|
-
|
2213
|
-
return Cartesian3.multiplyByScalar(cartesian, beta, result);
|
2214
|
-
};
|
2215
|
-
|
2216
|
-
/**
|
2217
|
-
* Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
|
2218
|
-
* its components by the result of {@link Ellipsoid#oneOverRadii}.
|
2219
|
-
*
|
2220
|
-
* @param {Cartesian3} position The position to transform.
|
2221
|
-
* @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
|
2222
|
-
* return a new instance.
|
2223
|
-
* @returns {Cartesian3} The position expressed in the scaled space. The returned instance is the
|
2224
|
-
* one passed as the result parameter if it is not undefined, or a new instance of it is.
|
2225
|
-
*/
|
2226
|
-
Ellipsoid.prototype.transformPositionToScaledSpace = function (
|
2227
|
-
position,
|
2228
|
-
result
|
2229
|
-
) {
|
2230
|
-
if (!defaultValue.defined(result)) {
|
2231
|
-
result = new Cartesian3();
|
2232
|
-
}
|
2233
|
-
|
2234
|
-
return Cartesian3.multiplyComponents(position, this._oneOverRadii, result);
|
2235
|
-
};
|
2236
|
-
|
2237
|
-
/**
|
2238
|
-
* Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
|
2239
|
-
* its components by the result of {@link Ellipsoid#radii}.
|
2240
|
-
*
|
2241
|
-
* @param {Cartesian3} position The position to transform.
|
2242
|
-
* @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
|
2243
|
-
* return a new instance.
|
2244
|
-
* @returns {Cartesian3} The position expressed in the unscaled space. The returned instance is the
|
2245
|
-
* one passed as the result parameter if it is not undefined, or a new instance of it is.
|
2246
|
-
*/
|
2247
|
-
Ellipsoid.prototype.transformPositionFromScaledSpace = function (
|
2248
|
-
position,
|
2249
|
-
result
|
2250
|
-
) {
|
2251
|
-
if (!defaultValue.defined(result)) {
|
2252
|
-
result = new Cartesian3();
|
2253
|
-
}
|
2254
|
-
|
2255
|
-
return Cartesian3.multiplyComponents(position, this._radii, result);
|
2256
|
-
};
|
2257
|
-
|
2258
|
-
/**
|
2259
|
-
* Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
|
2260
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
2261
|
-
*
|
2262
|
-
* @param {Ellipsoid} [right] The other Ellipsoid.
|
2263
|
-
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
2264
|
-
*/
|
2265
|
-
Ellipsoid.prototype.equals = function (right) {
|
2266
|
-
return (
|
2267
|
-
this === right ||
|
2268
|
-
(defaultValue.defined(right) && Cartesian3.equals(this._radii, right._radii))
|
2269
|
-
);
|
2270
|
-
};
|
2271
|
-
|
2272
|
-
/**
|
2273
|
-
* Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
|
2274
|
-
*
|
2275
|
-
* @returns {string} A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
|
2276
|
-
*/
|
2277
|
-
Ellipsoid.prototype.toString = function () {
|
2278
|
-
return this._radii.toString();
|
2279
|
-
};
|
2280
|
-
|
2281
|
-
/**
|
2282
|
-
* Computes a point which is the intersection of the surface normal with the z-axis.
|
2283
|
-
*
|
2284
|
-
* @param {Cartesian3} position the position. must be on the surface of the ellipsoid.
|
2285
|
-
* @param {number} [buffer = 0.0] A buffer to subtract from the ellipsoid size when checking if the point is inside the ellipsoid.
|
2286
|
-
* In earth case, with common earth datums, there is no need for this buffer since the intersection point is always (relatively) very close to the center.
|
2287
|
-
* In WGS84 datum, intersection point is at max z = +-42841.31151331382 (0.673% of z-axis).
|
2288
|
-
* Intersection point could be outside the ellipsoid if the ratio of MajorAxis / AxisOfRotation is bigger than the square root of 2
|
2289
|
-
* @param {Cartesian3} [result] The cartesian to which to copy the result, or undefined to create and
|
2290
|
-
* return a new instance.
|
2291
|
-
* @returns {Cartesian3 | undefined} the intersection point if it's inside the ellipsoid, undefined otherwise
|
2292
|
-
*
|
2293
|
-
* @exception {DeveloperError} position is required.
|
2294
|
-
* @exception {DeveloperError} Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y).
|
2295
|
-
* @exception {DeveloperError} Ellipsoid.radii.z must be greater than 0.
|
2296
|
-
*/
|
2297
|
-
Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function (
|
2298
|
-
position,
|
2299
|
-
buffer,
|
2300
|
-
result
|
2301
|
-
) {
|
2302
|
-
//>>includeStart('debug', pragmas.debug);
|
2303
|
-
Check.Check.typeOf.object("position", position);
|
2304
|
-
|
2305
|
-
if (
|
2306
|
-
!Math$1.CesiumMath.equalsEpsilon(
|
2307
|
-
this._radii.x,
|
2308
|
-
this._radii.y,
|
2309
|
-
Math$1.CesiumMath.EPSILON15
|
2310
|
-
)
|
2311
|
-
) {
|
2312
|
-
throw new Check.DeveloperError(
|
2313
|
-
"Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
|
2314
|
-
);
|
2315
|
-
}
|
2316
|
-
|
2317
|
-
Check.Check.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
|
2318
|
-
//>>includeEnd('debug');
|
2319
|
-
|
2320
|
-
buffer = defaultValue.defaultValue(buffer, 0.0);
|
2321
|
-
|
2322
|
-
const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
|
2323
|
-
|
2324
|
-
if (!defaultValue.defined(result)) {
|
2325
|
-
result = new Cartesian3();
|
2326
|
-
}
|
2327
|
-
|
2328
|
-
result.x = 0.0;
|
2329
|
-
result.y = 0.0;
|
2330
|
-
result.z = position.z * (1 - squaredXOverSquaredZ);
|
2331
|
-
|
2332
|
-
if (Math.abs(result.z) >= this._radii.z - buffer) {
|
2333
|
-
return undefined;
|
2334
|
-
}
|
2335
|
-
|
2336
|
-
return result;
|
2337
|
-
};
|
2338
|
-
|
2339
|
-
const abscissas = [
|
2340
|
-
0.14887433898163,
|
2341
|
-
0.43339539412925,
|
2342
|
-
0.67940956829902,
|
2343
|
-
0.86506336668898,
|
2344
|
-
0.97390652851717,
|
2345
|
-
0.0,
|
2346
|
-
];
|
2347
|
-
const weights = [
|
2348
|
-
0.29552422471475,
|
2349
|
-
0.26926671930999,
|
2350
|
-
0.21908636251598,
|
2351
|
-
0.14945134915058,
|
2352
|
-
0.066671344308684,
|
2353
|
-
0.0,
|
2354
|
-
];
|
2355
|
-
|
2356
|
-
/**
|
2357
|
-
* Compute the 10th order Gauss-Legendre Quadrature of the given definite integral.
|
2358
|
-
*
|
2359
|
-
* @param {number} a The lower bound for the integration.
|
2360
|
-
* @param {number} b The upper bound for the integration.
|
2361
|
-
* @param {Ellipsoid~RealValuedScalarFunction} func The function to integrate.
|
2362
|
-
* @returns {number} The value of the integral of the given function over the given domain.
|
2363
|
-
*
|
2364
|
-
* @private
|
2365
|
-
*/
|
2366
|
-
function gaussLegendreQuadrature(a, b, func) {
|
2367
|
-
//>>includeStart('debug', pragmas.debug);
|
2368
|
-
Check.Check.typeOf.number("a", a);
|
2369
|
-
Check.Check.typeOf.number("b", b);
|
2370
|
-
Check.Check.typeOf.func("func", func);
|
2371
|
-
//>>includeEnd('debug');
|
2372
|
-
|
2373
|
-
// The range is half of the normal range since the five weights add to one (ten weights add to two).
|
2374
|
-
// The values of the abscissas are multiplied by two to account for this.
|
2375
|
-
const xMean = 0.5 * (b + a);
|
2376
|
-
const xRange = 0.5 * (b - a);
|
2377
|
-
|
2378
|
-
let sum = 0.0;
|
2379
|
-
for (let i = 0; i < 5; i++) {
|
2380
|
-
const dx = xRange * abscissas[i];
|
2381
|
-
sum += weights[i] * (func(xMean + dx) + func(xMean - dx));
|
2382
|
-
}
|
2383
|
-
|
2384
|
-
// Scale the sum to the range of x.
|
2385
|
-
sum *= xRange;
|
2386
|
-
return sum;
|
2387
|
-
}
|
2388
|
-
|
2389
|
-
/**
|
2390
|
-
* A real valued scalar function.
|
2391
|
-
* @callback Ellipsoid~RealValuedScalarFunction
|
2392
|
-
*
|
2393
|
-
* @param {number} x The value used to evaluate the function.
|
2394
|
-
* @returns {number} The value of the function at x.
|
2395
|
-
*
|
2396
|
-
* @private
|
2397
|
-
*/
|
2398
|
-
|
2399
|
-
/**
|
2400
|
-
* Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using
|
2401
|
-
* Gauss-Legendre 10th order quadrature.
|
2402
|
-
*
|
2403
|
-
* @param {Rectangle} rectangle The rectangle used for computing the surface area.
|
2404
|
-
* @returns {number} The approximate area of the rectangle on the surface of this ellipsoid.
|
2405
|
-
*/
|
2406
|
-
Ellipsoid.prototype.surfaceArea = function (rectangle) {
|
2407
|
-
//>>includeStart('debug', pragmas.debug);
|
2408
|
-
Check.Check.typeOf.object("rectangle", rectangle);
|
2409
|
-
//>>includeEnd('debug');
|
2410
|
-
const minLongitude = rectangle.west;
|
2411
|
-
let maxLongitude = rectangle.east;
|
2412
|
-
const minLatitude = rectangle.south;
|
2413
|
-
const maxLatitude = rectangle.north;
|
2414
|
-
|
2415
|
-
while (maxLongitude < minLongitude) {
|
2416
|
-
maxLongitude += Math$1.CesiumMath.TWO_PI;
|
2417
|
-
}
|
2418
|
-
|
2419
|
-
const radiiSquared = this._radiiSquared;
|
2420
|
-
const a2 = radiiSquared.x;
|
2421
|
-
const b2 = radiiSquared.y;
|
2422
|
-
const c2 = radiiSquared.z;
|
2423
|
-
const a2b2 = a2 * b2;
|
2424
|
-
return gaussLegendreQuadrature(minLatitude, maxLatitude, function (lat) {
|
2425
|
-
// phi represents the angle measured from the north pole
|
2426
|
-
// sin(phi) = sin(pi / 2 - lat) = cos(lat), cos(phi) is similar
|
2427
|
-
const sinPhi = Math.cos(lat);
|
2428
|
-
const cosPhi = Math.sin(lat);
|
2429
|
-
return (
|
2430
|
-
Math.cos(lat) *
|
2431
|
-
gaussLegendreQuadrature(minLongitude, maxLongitude, function (lon) {
|
2432
|
-
const cosTheta = Math.cos(lon);
|
2433
|
-
const sinTheta = Math.sin(lon);
|
2434
|
-
return Math.sqrt(
|
2435
|
-
a2b2 * cosPhi * cosPhi +
|
2436
|
-
c2 *
|
2437
|
-
(b2 * cosTheta * cosTheta + a2 * sinTheta * sinTheta) *
|
2438
|
-
sinPhi *
|
2439
|
-
sinPhi
|
2440
|
-
);
|
2441
|
-
})
|
2442
|
-
);
|
2443
|
-
});
|
2444
|
-
};
|
2445
|
-
|
2446
|
-
/**
|
2447
|
-
* A 3x3 matrix, indexable as a column-major order array.
|
2448
|
-
* Constructor parameters are in row-major order for code readability.
|
2449
|
-
* @alias Matrix3
|
2450
|
-
* @constructor
|
2451
|
-
* @implements {ArrayLike<number>}
|
2452
|
-
*
|
2453
|
-
* @param {number} [column0Row0=0.0] The value for column 0, row 0.
|
2454
|
-
* @param {number} [column1Row0=0.0] The value for column 1, row 0.
|
2455
|
-
* @param {number} [column2Row0=0.0] The value for column 2, row 0.
|
2456
|
-
* @param {number} [column0Row1=0.0] The value for column 0, row 1.
|
2457
|
-
* @param {number} [column1Row1=0.0] The value for column 1, row 1.
|
2458
|
-
* @param {number} [column2Row1=0.0] The value for column 2, row 1.
|
2459
|
-
* @param {number} [column0Row2=0.0] The value for column 0, row 2.
|
2460
|
-
* @param {number} [column1Row2=0.0] The value for column 1, row 2.
|
2461
|
-
* @param {number} [column2Row2=0.0] The value for column 2, row 2.
|
2462
|
-
*
|
2463
|
-
* @see Matrix3.fromArray
|
2464
|
-
* @see Matrix3.fromColumnMajorArray
|
2465
|
-
* @see Matrix3.fromRowMajorArray
|
2466
|
-
* @see Matrix3.fromQuaternion
|
2467
|
-
* @see Matrix3.fromHeadingPitchRoll
|
2468
|
-
* @see Matrix3.fromScale
|
2469
|
-
* @see Matrix3.fromUniformScale
|
2470
|
-
* @see Matrix3.fromCrossProduct
|
2471
|
-
* @see Matrix3.fromRotationX
|
2472
|
-
* @see Matrix3.fromRotationY
|
2473
|
-
* @see Matrix3.fromRotationZ
|
2474
|
-
* @see Matrix2
|
2475
|
-
* @see Matrix4
|
2476
|
-
*/
|
2477
|
-
function Matrix3(
|
2478
|
-
column0Row0,
|
2479
|
-
column1Row0,
|
2480
|
-
column2Row0,
|
2481
|
-
column0Row1,
|
2482
|
-
column1Row1,
|
2483
|
-
column2Row1,
|
2484
|
-
column0Row2,
|
2485
|
-
column1Row2,
|
2486
|
-
column2Row2
|
2487
|
-
) {
|
2488
|
-
this[0] = defaultValue.defaultValue(column0Row0, 0.0);
|
2489
|
-
this[1] = defaultValue.defaultValue(column0Row1, 0.0);
|
2490
|
-
this[2] = defaultValue.defaultValue(column0Row2, 0.0);
|
2491
|
-
this[3] = defaultValue.defaultValue(column1Row0, 0.0);
|
2492
|
-
this[4] = defaultValue.defaultValue(column1Row1, 0.0);
|
2493
|
-
this[5] = defaultValue.defaultValue(column1Row2, 0.0);
|
2494
|
-
this[6] = defaultValue.defaultValue(column2Row0, 0.0);
|
2495
|
-
this[7] = defaultValue.defaultValue(column2Row1, 0.0);
|
2496
|
-
this[8] = defaultValue.defaultValue(column2Row2, 0.0);
|
2497
|
-
}
|
2498
|
-
|
2499
|
-
/**
|
2500
|
-
* The number of elements used to pack the object into an array.
|
2501
|
-
* @type {number}
|
2502
|
-
*/
|
2503
|
-
Matrix3.packedLength = 9;
|
2504
|
-
|
2505
|
-
/**
|
2506
|
-
* Stores the provided instance into the provided array.
|
2507
|
-
*
|
2508
|
-
* @param {Matrix3} value The value to pack.
|
2509
|
-
* @param {number[]} array The array to pack into.
|
2510
|
-
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
|
2511
|
-
*
|
2512
|
-
* @returns {number[]} The array that was packed into
|
2513
|
-
*/
|
2514
|
-
Matrix3.pack = function (value, array, startingIndex) {
|
2515
|
-
//>>includeStart('debug', pragmas.debug);
|
2516
|
-
Check.Check.typeOf.object("value", value);
|
2517
|
-
Check.Check.defined("array", array);
|
2518
|
-
//>>includeEnd('debug');
|
2519
|
-
|
2520
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
2521
|
-
|
2522
|
-
array[startingIndex++] = value[0];
|
2523
|
-
array[startingIndex++] = value[1];
|
2524
|
-
array[startingIndex++] = value[2];
|
2525
|
-
array[startingIndex++] = value[3];
|
2526
|
-
array[startingIndex++] = value[4];
|
2527
|
-
array[startingIndex++] = value[5];
|
2528
|
-
array[startingIndex++] = value[6];
|
2529
|
-
array[startingIndex++] = value[7];
|
2530
|
-
array[startingIndex++] = value[8];
|
2531
|
-
|
2532
|
-
return array;
|
2533
|
-
};
|
2534
|
-
|
2535
|
-
/**
|
2536
|
-
* Retrieves an instance from a packed array.
|
2537
|
-
*
|
2538
|
-
* @param {number[]} array The packed array.
|
2539
|
-
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
|
2540
|
-
* @param {Matrix3} [result] The object into which to store the result.
|
2541
|
-
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
|
2542
|
-
*/
|
2543
|
-
Matrix3.unpack = function (array, startingIndex, result) {
|
2544
|
-
//>>includeStart('debug', pragmas.debug);
|
2545
|
-
Check.Check.defined("array", array);
|
2546
|
-
//>>includeEnd('debug');
|
2547
|
-
|
2548
|
-
startingIndex = defaultValue.defaultValue(startingIndex, 0);
|
2549
|
-
|
2550
|
-
if (!defaultValue.defined(result)) {
|
2551
|
-
result = new Matrix3();
|
2552
|
-
}
|
2553
|
-
|
2554
|
-
result[0] = array[startingIndex++];
|
2555
|
-
result[1] = array[startingIndex++];
|
2556
|
-
result[2] = array[startingIndex++];
|
2557
|
-
result[3] = array[startingIndex++];
|
2558
|
-
result[4] = array[startingIndex++];
|
2559
|
-
result[5] = array[startingIndex++];
|
2560
|
-
result[6] = array[startingIndex++];
|
2561
|
-
result[7] = array[startingIndex++];
|
2562
|
-
result[8] = array[startingIndex++];
|
2563
|
-
return result;
|
2564
|
-
};
|
2565
|
-
|
2566
|
-
/**
|
2567
|
-
* Flattens an array of Matrix3s into an array of components. The components
|
2568
|
-
* are stored in column-major order.
|
2569
|
-
*
|
2570
|
-
* @param {Matrix3[]} array The array of matrices to pack.
|
2571
|
-
* @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 9 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 9) elements.
|
2572
|
-
* @returns {number[]} The packed array.
|
2573
|
-
*/
|
2574
|
-
Matrix3.packArray = function (array, result) {
|
2575
|
-
//>>includeStart('debug', pragmas.debug);
|
2576
|
-
Check.Check.defined("array", array);
|
2577
|
-
//>>includeEnd('debug');
|
2578
|
-
|
2579
|
-
const length = array.length;
|
2580
|
-
const resultLength = length * 9;
|
2581
|
-
if (!defaultValue.defined(result)) {
|
2582
|
-
result = new Array(resultLength);
|
2583
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
2584
|
-
//>>includeStart('debug', pragmas.debug);
|
2585
|
-
throw new Check.DeveloperError(
|
2586
|
-
"If result is a typed array, it must have exactly array.length * 9 elements"
|
2587
|
-
);
|
2588
|
-
//>>includeEnd('debug');
|
2589
|
-
} else if (result.length !== resultLength) {
|
2590
|
-
result.length = resultLength;
|
2591
|
-
}
|
2592
|
-
|
2593
|
-
for (let i = 0; i < length; ++i) {
|
2594
|
-
Matrix3.pack(array[i], result, i * 9);
|
2595
|
-
}
|
2596
|
-
return result;
|
2597
|
-
};
|
2598
|
-
|
2599
|
-
/**
|
2600
|
-
* Unpacks an array of column-major matrix components into an array of Matrix3s.
|
2601
|
-
*
|
2602
|
-
* @param {number[]} array The array of components to unpack.
|
2603
|
-
* @param {Matrix3[]} [result] The array onto which to store the result.
|
2604
|
-
* @returns {Matrix3[]} The unpacked array.
|
2605
|
-
*/
|
2606
|
-
Matrix3.unpackArray = function (array, result) {
|
2607
|
-
//>>includeStart('debug', pragmas.debug);
|
2608
|
-
Check.Check.defined("array", array);
|
2609
|
-
Check.Check.typeOf.number.greaterThanOrEquals("array.length", array.length, 9);
|
2610
|
-
if (array.length % 9 !== 0) {
|
2611
|
-
throw new Check.DeveloperError("array length must be a multiple of 9.");
|
2612
|
-
}
|
2613
|
-
//>>includeEnd('debug');
|
2614
|
-
|
2615
|
-
const length = array.length;
|
2616
|
-
if (!defaultValue.defined(result)) {
|
2617
|
-
result = new Array(length / 9);
|
2618
|
-
} else {
|
2619
|
-
result.length = length / 9;
|
2620
|
-
}
|
2621
|
-
|
2622
|
-
for (let i = 0; i < length; i += 9) {
|
2623
|
-
const index = i / 9;
|
2624
|
-
result[index] = Matrix3.unpack(array, i, result[index]);
|
2625
|
-
}
|
2626
|
-
return result;
|
2627
|
-
};
|
2628
|
-
|
2629
|
-
/**
|
2630
|
-
* Duplicates a Matrix3 instance.
|
2631
|
-
*
|
2632
|
-
* @param {Matrix3} matrix The matrix to duplicate.
|
2633
|
-
* @param {Matrix3} [result] The object onto which to store the result.
|
2634
|
-
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided. (Returns undefined if matrix is undefined)
|
2635
|
-
*/
|
2636
|
-
Matrix3.clone = function (matrix, result) {
|
2637
|
-
if (!defaultValue.defined(matrix)) {
|
2638
|
-
return undefined;
|
2639
|
-
}
|
2640
|
-
if (!defaultValue.defined(result)) {
|
2641
|
-
return new Matrix3(
|
2642
|
-
matrix[0],
|
2643
|
-
matrix[3],
|
2644
|
-
matrix[6],
|
2645
|
-
matrix[1],
|
2646
|
-
matrix[4],
|
2647
|
-
matrix[7],
|
2648
|
-
matrix[2],
|
2649
|
-
matrix[5],
|
2650
|
-
matrix[8]
|
2651
|
-
);
|
2652
|
-
}
|
2653
|
-
result[0] = matrix[0];
|
2654
|
-
result[1] = matrix[1];
|
2655
|
-
result[2] = matrix[2];
|
2656
|
-
result[3] = matrix[3];
|
2657
|
-
result[4] = matrix[4];
|
2658
|
-
result[5] = matrix[5];
|
2659
|
-
result[6] = matrix[6];
|
2660
|
-
result[7] = matrix[7];
|
2661
|
-
result[8] = matrix[8];
|
2662
|
-
return result;
|
2663
|
-
};
|
2664
|
-
|
2665
|
-
/**
|
2666
|
-
* Creates a Matrix3 from 9 consecutive elements in an array.
|
2667
|
-
*
|
2668
|
-
* @function
|
2669
|
-
* @param {number[]} array The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
|
2670
|
-
* @param {number} [startingIndex=0] The offset into the array of the first element, which corresponds to first column first row position in the matrix.
|
2671
|
-
* @param {Matrix3} [result] The object onto which to store the result.
|
2672
|
-
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
|
2673
|
-
*
|
2674
|
-
* @example
|
2675
|
-
* // Create the Matrix3:
|
2676
|
-
* // [1.0, 2.0, 3.0]
|
2677
|
-
* // [1.0, 2.0, 3.0]
|
2678
|
-
* // [1.0, 2.0, 3.0]
|
2679
|
-
*
|
2680
|
-
* const v = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
|
2681
|
-
* const m = Cesium.Matrix3.fromArray(v);
|
2682
|
-
*
|
2683
|
-
* // Create same Matrix3 with using an offset into an array
|
2684
|
-
* const v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
|
2685
|
-
* const m2 = Cesium.Matrix3.fromArray(v2, 2);
|
2686
|
-
*/
|
2687
|
-
Matrix3.fromArray = Matrix3.unpack;
|
2688
|
-
|
2689
|
-
/**
|
2690
|
-
* Creates a Matrix3 instance from a column-major order array.
|
2691
|
-
*
|
2692
|
-
* @param {number[]} values The column-major order array.
|
2693
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2694
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2695
|
-
*/
|
2696
|
-
Matrix3.fromColumnMajorArray = function (values, result) {
|
2697
|
-
//>>includeStart('debug', pragmas.debug);
|
2698
|
-
Check.Check.defined("values", values);
|
2699
|
-
//>>includeEnd('debug');
|
2700
|
-
|
2701
|
-
return Matrix3.clone(values, result);
|
2702
|
-
};
|
2703
|
-
|
2704
|
-
/**
|
2705
|
-
* Creates a Matrix3 instance from a row-major order array.
|
2706
|
-
* The resulting matrix will be in column-major order.
|
2707
|
-
*
|
2708
|
-
* @param {number[]} values The row-major order array.
|
2709
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2710
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2711
|
-
*/
|
2712
|
-
Matrix3.fromRowMajorArray = function (values, result) {
|
2713
|
-
//>>includeStart('debug', pragmas.debug);
|
2714
|
-
Check.Check.defined("values", values);
|
2715
|
-
//>>includeEnd('debug');
|
2716
|
-
|
2717
|
-
if (!defaultValue.defined(result)) {
|
2718
|
-
return new Matrix3(
|
2719
|
-
values[0],
|
2720
|
-
values[1],
|
2721
|
-
values[2],
|
2722
|
-
values[3],
|
2723
|
-
values[4],
|
2724
|
-
values[5],
|
2725
|
-
values[6],
|
2726
|
-
values[7],
|
2727
|
-
values[8]
|
2728
|
-
);
|
2729
|
-
}
|
2730
|
-
result[0] = values[0];
|
2731
|
-
result[1] = values[3];
|
2732
|
-
result[2] = values[6];
|
2733
|
-
result[3] = values[1];
|
2734
|
-
result[4] = values[4];
|
2735
|
-
result[5] = values[7];
|
2736
|
-
result[6] = values[2];
|
2737
|
-
result[7] = values[5];
|
2738
|
-
result[8] = values[8];
|
2739
|
-
return result;
|
2740
|
-
};
|
2741
|
-
|
2742
|
-
/**
|
2743
|
-
* Computes a 3x3 rotation matrix from the provided quaternion.
|
2744
|
-
*
|
2745
|
-
* @param {Quaternion} quaternion the quaternion to use.
|
2746
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2747
|
-
* @returns {Matrix3} The 3x3 rotation matrix from this quaternion.
|
2748
|
-
*/
|
2749
|
-
Matrix3.fromQuaternion = function (quaternion, result) {
|
2750
|
-
//>>includeStart('debug', pragmas.debug);
|
2751
|
-
Check.Check.typeOf.object("quaternion", quaternion);
|
2752
|
-
//>>includeEnd('debug');
|
2753
|
-
|
2754
|
-
const x2 = quaternion.x * quaternion.x;
|
2755
|
-
const xy = quaternion.x * quaternion.y;
|
2756
|
-
const xz = quaternion.x * quaternion.z;
|
2757
|
-
const xw = quaternion.x * quaternion.w;
|
2758
|
-
const y2 = quaternion.y * quaternion.y;
|
2759
|
-
const yz = quaternion.y * quaternion.z;
|
2760
|
-
const yw = quaternion.y * quaternion.w;
|
2761
|
-
const z2 = quaternion.z * quaternion.z;
|
2762
|
-
const zw = quaternion.z * quaternion.w;
|
2763
|
-
const w2 = quaternion.w * quaternion.w;
|
2764
|
-
|
2765
|
-
const m00 = x2 - y2 - z2 + w2;
|
2766
|
-
const m01 = 2.0 * (xy - zw);
|
2767
|
-
const m02 = 2.0 * (xz + yw);
|
2768
|
-
|
2769
|
-
const m10 = 2.0 * (xy + zw);
|
2770
|
-
const m11 = -x2 + y2 - z2 + w2;
|
2771
|
-
const m12 = 2.0 * (yz - xw);
|
2772
|
-
|
2773
|
-
const m20 = 2.0 * (xz - yw);
|
2774
|
-
const m21 = 2.0 * (yz + xw);
|
2775
|
-
const m22 = -x2 - y2 + z2 + w2;
|
2776
|
-
|
2777
|
-
if (!defaultValue.defined(result)) {
|
2778
|
-
return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
|
2779
|
-
}
|
2780
|
-
result[0] = m00;
|
2781
|
-
result[1] = m10;
|
2782
|
-
result[2] = m20;
|
2783
|
-
result[3] = m01;
|
2784
|
-
result[4] = m11;
|
2785
|
-
result[5] = m21;
|
2786
|
-
result[6] = m02;
|
2787
|
-
result[7] = m12;
|
2788
|
-
result[8] = m22;
|
2789
|
-
return result;
|
2790
|
-
};
|
2791
|
-
|
2792
|
-
/**
|
2793
|
-
* Computes a 3x3 rotation matrix from the provided headingPitchRoll. (see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles )
|
2794
|
-
*
|
2795
|
-
* @param {HeadingPitchRoll} headingPitchRoll the headingPitchRoll to use.
|
2796
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2797
|
-
* @returns {Matrix3} The 3x3 rotation matrix from this headingPitchRoll.
|
2798
|
-
*/
|
2799
|
-
Matrix3.fromHeadingPitchRoll = function (headingPitchRoll, result) {
|
2800
|
-
//>>includeStart('debug', pragmas.debug);
|
2801
|
-
Check.Check.typeOf.object("headingPitchRoll", headingPitchRoll);
|
2802
|
-
//>>includeEnd('debug');
|
2803
|
-
|
2804
|
-
const cosTheta = Math.cos(-headingPitchRoll.pitch);
|
2805
|
-
const cosPsi = Math.cos(-headingPitchRoll.heading);
|
2806
|
-
const cosPhi = Math.cos(headingPitchRoll.roll);
|
2807
|
-
const sinTheta = Math.sin(-headingPitchRoll.pitch);
|
2808
|
-
const sinPsi = Math.sin(-headingPitchRoll.heading);
|
2809
|
-
const sinPhi = Math.sin(headingPitchRoll.roll);
|
2810
|
-
|
2811
|
-
const m00 = cosTheta * cosPsi;
|
2812
|
-
const m01 = -cosPhi * sinPsi + sinPhi * sinTheta * cosPsi;
|
2813
|
-
const m02 = sinPhi * sinPsi + cosPhi * sinTheta * cosPsi;
|
2814
|
-
|
2815
|
-
const m10 = cosTheta * sinPsi;
|
2816
|
-
const m11 = cosPhi * cosPsi + sinPhi * sinTheta * sinPsi;
|
2817
|
-
const m12 = -sinPhi * cosPsi + cosPhi * sinTheta * sinPsi;
|
2818
|
-
|
2819
|
-
const m20 = -sinTheta;
|
2820
|
-
const m21 = sinPhi * cosTheta;
|
2821
|
-
const m22 = cosPhi * cosTheta;
|
2822
|
-
|
2823
|
-
if (!defaultValue.defined(result)) {
|
2824
|
-
return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
|
2825
|
-
}
|
2826
|
-
result[0] = m00;
|
2827
|
-
result[1] = m10;
|
2828
|
-
result[2] = m20;
|
2829
|
-
result[3] = m01;
|
2830
|
-
result[4] = m11;
|
2831
|
-
result[5] = m21;
|
2832
|
-
result[6] = m02;
|
2833
|
-
result[7] = m12;
|
2834
|
-
result[8] = m22;
|
2835
|
-
return result;
|
2836
|
-
};
|
2837
|
-
|
2838
|
-
/**
|
2839
|
-
* Computes a Matrix3 instance representing a non-uniform scale.
|
2840
|
-
*
|
2841
|
-
* @param {Cartesian3} scale The x, y, and z scale factors.
|
2842
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2843
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2844
|
-
*
|
2845
|
-
* @example
|
2846
|
-
* // Creates
|
2847
|
-
* // [7.0, 0.0, 0.0]
|
2848
|
-
* // [0.0, 8.0, 0.0]
|
2849
|
-
* // [0.0, 0.0, 9.0]
|
2850
|
-
* const m = Cesium.Matrix3.fromScale(new Cesium.Cartesian3(7.0, 8.0, 9.0));
|
2851
|
-
*/
|
2852
|
-
Matrix3.fromScale = function (scale, result) {
|
2853
|
-
//>>includeStart('debug', pragmas.debug);
|
2854
|
-
Check.Check.typeOf.object("scale", scale);
|
2855
|
-
//>>includeEnd('debug');
|
2856
|
-
|
2857
|
-
if (!defaultValue.defined(result)) {
|
2858
|
-
return new Matrix3(scale.x, 0.0, 0.0, 0.0, scale.y, 0.0, 0.0, 0.0, scale.z);
|
2859
|
-
}
|
2860
|
-
|
2861
|
-
result[0] = scale.x;
|
2862
|
-
result[1] = 0.0;
|
2863
|
-
result[2] = 0.0;
|
2864
|
-
result[3] = 0.0;
|
2865
|
-
result[4] = scale.y;
|
2866
|
-
result[5] = 0.0;
|
2867
|
-
result[6] = 0.0;
|
2868
|
-
result[7] = 0.0;
|
2869
|
-
result[8] = scale.z;
|
2870
|
-
return result;
|
2871
|
-
};
|
2872
|
-
|
2873
|
-
/**
|
2874
|
-
* Computes a Matrix3 instance representing a uniform scale.
|
2875
|
-
*
|
2876
|
-
* @param {number} scale The uniform scale factor.
|
2877
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2878
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2879
|
-
*
|
2880
|
-
* @example
|
2881
|
-
* // Creates
|
2882
|
-
* // [2.0, 0.0, 0.0]
|
2883
|
-
* // [0.0, 2.0, 0.0]
|
2884
|
-
* // [0.0, 0.0, 2.0]
|
2885
|
-
* const m = Cesium.Matrix3.fromUniformScale(2.0);
|
2886
|
-
*/
|
2887
|
-
Matrix3.fromUniformScale = function (scale, result) {
|
2888
|
-
//>>includeStart('debug', pragmas.debug);
|
2889
|
-
Check.Check.typeOf.number("scale", scale);
|
2890
|
-
//>>includeEnd('debug');
|
2891
|
-
|
2892
|
-
if (!defaultValue.defined(result)) {
|
2893
|
-
return new Matrix3(scale, 0.0, 0.0, 0.0, scale, 0.0, 0.0, 0.0, scale);
|
2894
|
-
}
|
2895
|
-
|
2896
|
-
result[0] = scale;
|
2897
|
-
result[1] = 0.0;
|
2898
|
-
result[2] = 0.0;
|
2899
|
-
result[3] = 0.0;
|
2900
|
-
result[4] = scale;
|
2901
|
-
result[5] = 0.0;
|
2902
|
-
result[6] = 0.0;
|
2903
|
-
result[7] = 0.0;
|
2904
|
-
result[8] = scale;
|
2905
|
-
return result;
|
2906
|
-
};
|
2907
|
-
|
2908
|
-
/**
|
2909
|
-
* Computes a Matrix3 instance representing the cross product equivalent matrix of a Cartesian3 vector.
|
2910
|
-
*
|
2911
|
-
* @param {Cartesian3} vector the vector on the left hand side of the cross product operation.
|
2912
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2913
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2914
|
-
*
|
2915
|
-
* @example
|
2916
|
-
* // Creates
|
2917
|
-
* // [0.0, -9.0, 8.0]
|
2918
|
-
* // [9.0, 0.0, -7.0]
|
2919
|
-
* // [-8.0, 7.0, 0.0]
|
2920
|
-
* const m = Cesium.Matrix3.fromCrossProduct(new Cesium.Cartesian3(7.0, 8.0, 9.0));
|
2921
|
-
*/
|
2922
|
-
Matrix3.fromCrossProduct = function (vector, result) {
|
2923
|
-
//>>includeStart('debug', pragmas.debug);
|
2924
|
-
Check.Check.typeOf.object("vector", vector);
|
2925
|
-
//>>includeEnd('debug');
|
2926
|
-
|
2927
|
-
if (!defaultValue.defined(result)) {
|
2928
|
-
return new Matrix3(
|
2929
|
-
0.0,
|
2930
|
-
-vector.z,
|
2931
|
-
vector.y,
|
2932
|
-
vector.z,
|
2933
|
-
0.0,
|
2934
|
-
-vector.x,
|
2935
|
-
-vector.y,
|
2936
|
-
vector.x,
|
2937
|
-
0.0
|
2938
|
-
);
|
2939
|
-
}
|
2940
|
-
|
2941
|
-
result[0] = 0.0;
|
2942
|
-
result[1] = vector.z;
|
2943
|
-
result[2] = -vector.y;
|
2944
|
-
result[3] = -vector.z;
|
2945
|
-
result[4] = 0.0;
|
2946
|
-
result[5] = vector.x;
|
2947
|
-
result[6] = vector.y;
|
2948
|
-
result[7] = -vector.x;
|
2949
|
-
result[8] = 0.0;
|
2950
|
-
return result;
|
2951
|
-
};
|
2952
|
-
|
2953
|
-
/**
|
2954
|
-
* Creates a rotation matrix around the x-axis.
|
2955
|
-
*
|
2956
|
-
* @param {number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
|
2957
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
2958
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
2959
|
-
*
|
2960
|
-
* @example
|
2961
|
-
* // Rotate a point 45 degrees counterclockwise around the x-axis.
|
2962
|
-
* const p = new Cesium.Cartesian3(5, 6, 7);
|
2963
|
-
* const m = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(45.0));
|
2964
|
-
* const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
|
2965
|
-
*/
|
2966
|
-
Matrix3.fromRotationX = function (angle, result) {
|
2967
|
-
//>>includeStart('debug', pragmas.debug);
|
2968
|
-
Check.Check.typeOf.number("angle", angle);
|
2969
|
-
//>>includeEnd('debug');
|
2970
|
-
|
2971
|
-
const cosAngle = Math.cos(angle);
|
2972
|
-
const sinAngle = Math.sin(angle);
|
2973
|
-
|
2974
|
-
if (!defaultValue.defined(result)) {
|
2975
|
-
return new Matrix3(
|
2976
|
-
1.0,
|
2977
|
-
0.0,
|
2978
|
-
0.0,
|
2979
|
-
0.0,
|
2980
|
-
cosAngle,
|
2981
|
-
-sinAngle,
|
2982
|
-
0.0,
|
2983
|
-
sinAngle,
|
2984
|
-
cosAngle
|
2985
|
-
);
|
2986
|
-
}
|
2987
|
-
|
2988
|
-
result[0] = 1.0;
|
2989
|
-
result[1] = 0.0;
|
2990
|
-
result[2] = 0.0;
|
2991
|
-
result[3] = 0.0;
|
2992
|
-
result[4] = cosAngle;
|
2993
|
-
result[5] = sinAngle;
|
2994
|
-
result[6] = 0.0;
|
2995
|
-
result[7] = -sinAngle;
|
2996
|
-
result[8] = cosAngle;
|
2997
|
-
|
2998
|
-
return result;
|
2999
|
-
};
|
3000
|
-
|
3001
|
-
/**
|
3002
|
-
* Creates a rotation matrix around the y-axis.
|
3003
|
-
*
|
3004
|
-
* @param {number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
|
3005
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
3006
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
3007
|
-
*
|
3008
|
-
* @example
|
3009
|
-
* // Rotate a point 45 degrees counterclockwise around the y-axis.
|
3010
|
-
* const p = new Cesium.Cartesian3(5, 6, 7);
|
3011
|
-
* const m = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(45.0));
|
3012
|
-
* const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
|
3013
|
-
*/
|
3014
|
-
Matrix3.fromRotationY = function (angle, result) {
|
3015
|
-
//>>includeStart('debug', pragmas.debug);
|
3016
|
-
Check.Check.typeOf.number("angle", angle);
|
3017
|
-
//>>includeEnd('debug');
|
3018
|
-
|
3019
|
-
const cosAngle = Math.cos(angle);
|
3020
|
-
const sinAngle = Math.sin(angle);
|
3021
|
-
|
3022
|
-
if (!defaultValue.defined(result)) {
|
3023
|
-
return new Matrix3(
|
3024
|
-
cosAngle,
|
3025
|
-
0.0,
|
3026
|
-
sinAngle,
|
3027
|
-
0.0,
|
3028
|
-
1.0,
|
3029
|
-
0.0,
|
3030
|
-
-sinAngle,
|
3031
|
-
0.0,
|
3032
|
-
cosAngle
|
3033
|
-
);
|
3034
|
-
}
|
3035
|
-
|
3036
|
-
result[0] = cosAngle;
|
3037
|
-
result[1] = 0.0;
|
3038
|
-
result[2] = -sinAngle;
|
3039
|
-
result[3] = 0.0;
|
3040
|
-
result[4] = 1.0;
|
3041
|
-
result[5] = 0.0;
|
3042
|
-
result[6] = sinAngle;
|
3043
|
-
result[7] = 0.0;
|
3044
|
-
result[8] = cosAngle;
|
3045
|
-
|
3046
|
-
return result;
|
3047
|
-
};
|
3048
|
-
|
3049
|
-
/**
|
3050
|
-
* Creates a rotation matrix around the z-axis.
|
3051
|
-
*
|
3052
|
-
* @param {number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
|
3053
|
-
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
|
3054
|
-
* @returns {Matrix3} The modified result parameter, or a new Matrix3 instance if one was not provided.
|
3055
|
-
*
|
3056
|
-
* @example
|
3057
|
-
* // Rotate a point 45 degrees counterclockwise around the z-axis.
|
3058
|
-
* const p = new Cesium.Cartesian3(5, 6, 7);
|
3059
|
-
* const m = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(45.0));
|
3060
|
-
* const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
|
3061
|
-
*/
|
3062
|
-
Matrix3.fromRotationZ = function (angle, result) {
|
3063
|
-
//>>includeStart('debug', pragmas.debug);
|
3064
|
-
Check.Check.typeOf.number("angle", angle);
|
3065
|
-
//>>includeEnd('debug');
|
3066
|
-
|
3067
|
-
const cosAngle = Math.cos(angle);
|
3068
|
-
const sinAngle = Math.sin(angle);
|
3069
|
-
|
3070
|
-
if (!defaultValue.defined(result)) {
|
3071
|
-
return new Matrix3(
|
3072
|
-
cosAngle,
|
3073
|
-
-sinAngle,
|
3074
|
-
0.0,
|
3075
|
-
sinAngle,
|
3076
|
-
cosAngle,
|
3077
|
-
0.0,
|
3078
|
-
0.0,
|
3079
|
-
0.0,
|
3080
|
-
1.0
|
3081
|
-
);
|
3082
|
-
}
|
3083
|
-
|
3084
|
-
result[0] = cosAngle;
|
3085
|
-
result[1] = sinAngle;
|
3086
|
-
result[2] = 0.0;
|
3087
|
-
result[3] = -sinAngle;
|
3088
|
-
result[4] = cosAngle;
|
3089
|
-
result[5] = 0.0;
|
3090
|
-
result[6] = 0.0;
|
3091
|
-
result[7] = 0.0;
|
3092
|
-
result[8] = 1.0;
|
3093
|
-
|
3094
|
-
return result;
|
3095
|
-
};
|
3096
|
-
|
3097
|
-
/**
|
3098
|
-
* Creates an Array from the provided Matrix3 instance.
|
3099
|
-
* The array will be in column-major order.
|
3100
|
-
*
|
3101
|
-
* @param {Matrix3} matrix The matrix to use..
|
3102
|
-
* @param {number[]} [result] The Array onto which to store the result.
|
3103
|
-
* @returns {number[]} The modified Array parameter or a new Array instance if one was not provided.
|
3104
|
-
*/
|
3105
|
-
Matrix3.toArray = function (matrix, result) {
|
3106
|
-
//>>includeStart('debug', pragmas.debug);
|
3107
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3108
|
-
//>>includeEnd('debug');
|
3109
|
-
|
3110
|
-
if (!defaultValue.defined(result)) {
|
3111
|
-
return [
|
3112
|
-
matrix[0],
|
3113
|
-
matrix[1],
|
3114
|
-
matrix[2],
|
3115
|
-
matrix[3],
|
3116
|
-
matrix[4],
|
3117
|
-
matrix[5],
|
3118
|
-
matrix[6],
|
3119
|
-
matrix[7],
|
3120
|
-
matrix[8],
|
3121
|
-
];
|
3122
|
-
}
|
3123
|
-
result[0] = matrix[0];
|
3124
|
-
result[1] = matrix[1];
|
3125
|
-
result[2] = matrix[2];
|
3126
|
-
result[3] = matrix[3];
|
3127
|
-
result[4] = matrix[4];
|
3128
|
-
result[5] = matrix[5];
|
3129
|
-
result[6] = matrix[6];
|
3130
|
-
result[7] = matrix[7];
|
3131
|
-
result[8] = matrix[8];
|
3132
|
-
return result;
|
3133
|
-
};
|
3134
|
-
|
3135
|
-
/**
|
3136
|
-
* Computes the array index of the element at the provided row and column.
|
3137
|
-
*
|
3138
|
-
* @param {number} column The zero-based index of the column.
|
3139
|
-
* @param {number} row The zero-based index of the row.
|
3140
|
-
* @returns {number} The index of the element at the provided row and column.
|
3141
|
-
*
|
3142
|
-
* @exception {DeveloperError} row must be 0, 1, or 2.
|
3143
|
-
* @exception {DeveloperError} column must be 0, 1, or 2.
|
3144
|
-
*
|
3145
|
-
* @example
|
3146
|
-
* const myMatrix = new Cesium.Matrix3();
|
3147
|
-
* const column1Row0Index = Cesium.Matrix3.getElementIndex(1, 0);
|
3148
|
-
* const column1Row0 = myMatrix[column1Row0Index]
|
3149
|
-
* myMatrix[column1Row0Index] = 10.0;
|
3150
|
-
*/
|
3151
|
-
Matrix3.getElementIndex = function (column, row) {
|
3152
|
-
//>>includeStart('debug', pragmas.debug);
|
3153
|
-
Check.Check.typeOf.number.greaterThanOrEquals("row", row, 0);
|
3154
|
-
Check.Check.typeOf.number.lessThanOrEquals("row", row, 2);
|
3155
|
-
Check.Check.typeOf.number.greaterThanOrEquals("column", column, 0);
|
3156
|
-
Check.Check.typeOf.number.lessThanOrEquals("column", column, 2);
|
3157
|
-
//>>includeEnd('debug');
|
3158
|
-
|
3159
|
-
return column * 3 + row;
|
3160
|
-
};
|
3161
|
-
|
3162
|
-
/**
|
3163
|
-
* Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
|
3164
|
-
*
|
3165
|
-
* @param {Matrix3} matrix The matrix to use.
|
3166
|
-
* @param {number} index The zero-based index of the column to retrieve.
|
3167
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
3168
|
-
* @returns {Cartesian3} The modified result parameter.
|
3169
|
-
*
|
3170
|
-
* @exception {DeveloperError} index must be 0, 1, or 2.
|
3171
|
-
*/
|
3172
|
-
Matrix3.getColumn = function (matrix, index, result) {
|
3173
|
-
//>>includeStart('debug', pragmas.debug);
|
3174
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3175
|
-
Check.Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3176
|
-
Check.Check.typeOf.number.lessThanOrEquals("index", index, 2);
|
3177
|
-
Check.Check.typeOf.object("result", result);
|
3178
|
-
//>>includeEnd('debug');
|
3179
|
-
|
3180
|
-
const startIndex = index * 3;
|
3181
|
-
const x = matrix[startIndex];
|
3182
|
-
const y = matrix[startIndex + 1];
|
3183
|
-
const z = matrix[startIndex + 2];
|
3184
|
-
|
3185
|
-
result.x = x;
|
3186
|
-
result.y = y;
|
3187
|
-
result.z = z;
|
3188
|
-
return result;
|
3189
|
-
};
|
3190
|
-
|
3191
|
-
/**
|
3192
|
-
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.
|
3193
|
-
*
|
3194
|
-
* @param {Matrix3} matrix The matrix to use.
|
3195
|
-
* @param {number} index The zero-based index of the column to set.
|
3196
|
-
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified column.
|
3197
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3198
|
-
* @returns {Matrix3} The modified result parameter.
|
3199
|
-
*
|
3200
|
-
* @exception {DeveloperError} index must be 0, 1, or 2.
|
3201
|
-
*/
|
3202
|
-
Matrix3.setColumn = function (matrix, index, cartesian, result) {
|
3203
|
-
//>>includeStart('debug', pragmas.debug);
|
3204
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3205
|
-
Check.Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3206
|
-
Check.Check.typeOf.number.lessThanOrEquals("index", index, 2);
|
3207
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
3208
|
-
Check.Check.typeOf.object("result", result);
|
3209
|
-
//>>includeEnd('debug');
|
3210
|
-
|
3211
|
-
result = Matrix3.clone(matrix, result);
|
3212
|
-
const startIndex = index * 3;
|
3213
|
-
result[startIndex] = cartesian.x;
|
3214
|
-
result[startIndex + 1] = cartesian.y;
|
3215
|
-
result[startIndex + 2] = cartesian.z;
|
3216
|
-
return result;
|
3217
|
-
};
|
3218
|
-
|
3219
|
-
/**
|
3220
|
-
* Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
|
3221
|
-
*
|
3222
|
-
* @param {Matrix3} matrix The matrix to use.
|
3223
|
-
* @param {number} index The zero-based index of the row to retrieve.
|
3224
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
3225
|
-
* @returns {Cartesian3} The modified result parameter.
|
3226
|
-
*
|
3227
|
-
* @exception {DeveloperError} index must be 0, 1, or 2.
|
3228
|
-
*/
|
3229
|
-
Matrix3.getRow = function (matrix, index, result) {
|
3230
|
-
//>>includeStart('debug', pragmas.debug);
|
3231
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3232
|
-
Check.Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3233
|
-
Check.Check.typeOf.number.lessThanOrEquals("index", index, 2);
|
3234
|
-
Check.Check.typeOf.object("result", result);
|
3235
|
-
//>>includeEnd('debug');
|
3236
|
-
|
3237
|
-
const x = matrix[index];
|
3238
|
-
const y = matrix[index + 3];
|
3239
|
-
const z = matrix[index + 6];
|
3240
|
-
|
3241
|
-
result.x = x;
|
3242
|
-
result.y = y;
|
3243
|
-
result.z = z;
|
3244
|
-
return result;
|
3245
|
-
};
|
3246
|
-
|
3247
|
-
/**
|
3248
|
-
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.
|
3249
|
-
*
|
3250
|
-
* @param {Matrix3} matrix The matrix to use.
|
3251
|
-
* @param {number} index The zero-based index of the row to set.
|
3252
|
-
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified row.
|
3253
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3254
|
-
* @returns {Matrix3} The modified result parameter.
|
3255
|
-
*
|
3256
|
-
* @exception {DeveloperError} index must be 0, 1, or 2.
|
3257
|
-
*/
|
3258
|
-
Matrix3.setRow = function (matrix, index, cartesian, result) {
|
3259
|
-
//>>includeStart('debug', pragmas.debug);
|
3260
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3261
|
-
Check.Check.typeOf.number.greaterThanOrEquals("index", index, 0);
|
3262
|
-
Check.Check.typeOf.number.lessThanOrEquals("index", index, 2);
|
3263
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
3264
|
-
Check.Check.typeOf.object("result", result);
|
3265
|
-
//>>includeEnd('debug');
|
3266
|
-
|
3267
|
-
result = Matrix3.clone(matrix, result);
|
3268
|
-
result[index] = cartesian.x;
|
3269
|
-
result[index + 3] = cartesian.y;
|
3270
|
-
result[index + 6] = cartesian.z;
|
3271
|
-
return result;
|
3272
|
-
};
|
3273
|
-
|
3274
|
-
const scaleScratch1 = new Cartesian3();
|
3275
|
-
|
3276
|
-
/**
|
3277
|
-
* Computes a new matrix that replaces the scale with the provided scale.
|
3278
|
-
* This assumes the matrix is an affine transformation.
|
3279
|
-
*
|
3280
|
-
* @param {Matrix3} matrix The matrix to use.
|
3281
|
-
* @param {Cartesian3} scale The scale that replaces the scale of the provided matrix.
|
3282
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3283
|
-
* @returns {Matrix3} The modified result parameter.
|
3284
|
-
*
|
3285
|
-
* @see Matrix3.setUniformScale
|
3286
|
-
* @see Matrix3.fromScale
|
3287
|
-
* @see Matrix3.fromUniformScale
|
3288
|
-
* @see Matrix3.multiplyByScale
|
3289
|
-
* @see Matrix3.multiplyByUniformScale
|
3290
|
-
* @see Matrix3.getScale
|
3291
|
-
*/
|
3292
|
-
Matrix3.setScale = function (matrix, scale, result) {
|
3293
|
-
//>>includeStart('debug', pragmas.debug);
|
3294
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3295
|
-
Check.Check.typeOf.object("scale", scale);
|
3296
|
-
Check.Check.typeOf.object("result", result);
|
3297
|
-
//>>includeEnd('debug');
|
3298
|
-
|
3299
|
-
const existingScale = Matrix3.getScale(matrix, scaleScratch1);
|
3300
|
-
const scaleRatioX = scale.x / existingScale.x;
|
3301
|
-
const scaleRatioY = scale.y / existingScale.y;
|
3302
|
-
const scaleRatioZ = scale.z / existingScale.z;
|
3303
|
-
|
3304
|
-
result[0] = matrix[0] * scaleRatioX;
|
3305
|
-
result[1] = matrix[1] * scaleRatioX;
|
3306
|
-
result[2] = matrix[2] * scaleRatioX;
|
3307
|
-
result[3] = matrix[3] * scaleRatioY;
|
3308
|
-
result[4] = matrix[4] * scaleRatioY;
|
3309
|
-
result[5] = matrix[5] * scaleRatioY;
|
3310
|
-
result[6] = matrix[6] * scaleRatioZ;
|
3311
|
-
result[7] = matrix[7] * scaleRatioZ;
|
3312
|
-
result[8] = matrix[8] * scaleRatioZ;
|
3313
|
-
|
3314
|
-
return result;
|
3315
|
-
};
|
3316
|
-
|
3317
|
-
const scaleScratch2 = new Cartesian3();
|
3318
|
-
|
3319
|
-
/**
|
3320
|
-
* Computes a new matrix that replaces the scale with the provided uniform scale.
|
3321
|
-
* This assumes the matrix is an affine transformation.
|
3322
|
-
*
|
3323
|
-
* @param {Matrix3} matrix The matrix to use.
|
3324
|
-
* @param {number} scale The uniform scale that replaces the scale of the provided matrix.
|
3325
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3326
|
-
* @returns {Matrix3} The modified result parameter.
|
3327
|
-
*
|
3328
|
-
* @see Matrix3.setScale
|
3329
|
-
* @see Matrix3.fromScale
|
3330
|
-
* @see Matrix3.fromUniformScale
|
3331
|
-
* @see Matrix3.multiplyByScale
|
3332
|
-
* @see Matrix3.multiplyByUniformScale
|
3333
|
-
* @see Matrix3.getScale
|
3334
|
-
*/
|
3335
|
-
Matrix3.setUniformScale = function (matrix, scale, result) {
|
3336
|
-
//>>includeStart('debug', pragmas.debug);
|
3337
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3338
|
-
Check.Check.typeOf.number("scale", scale);
|
3339
|
-
Check.Check.typeOf.object("result", result);
|
3340
|
-
//>>includeEnd('debug');
|
3341
|
-
|
3342
|
-
const existingScale = Matrix3.getScale(matrix, scaleScratch2);
|
3343
|
-
const scaleRatioX = scale / existingScale.x;
|
3344
|
-
const scaleRatioY = scale / existingScale.y;
|
3345
|
-
const scaleRatioZ = scale / existingScale.z;
|
3346
|
-
|
3347
|
-
result[0] = matrix[0] * scaleRatioX;
|
3348
|
-
result[1] = matrix[1] * scaleRatioX;
|
3349
|
-
result[2] = matrix[2] * scaleRatioX;
|
3350
|
-
result[3] = matrix[3] * scaleRatioY;
|
3351
|
-
result[4] = matrix[4] * scaleRatioY;
|
3352
|
-
result[5] = matrix[5] * scaleRatioY;
|
3353
|
-
result[6] = matrix[6] * scaleRatioZ;
|
3354
|
-
result[7] = matrix[7] * scaleRatioZ;
|
3355
|
-
result[8] = matrix[8] * scaleRatioZ;
|
3356
|
-
|
3357
|
-
return result;
|
3358
|
-
};
|
3359
|
-
|
3360
|
-
const scratchColumn = new Cartesian3();
|
3361
|
-
|
3362
|
-
/**
|
3363
|
-
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
3364
|
-
*
|
3365
|
-
* @param {Matrix3} matrix The matrix.
|
3366
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
3367
|
-
* @returns {Cartesian3} The modified result parameter.
|
3368
|
-
*
|
3369
|
-
* @see Matrix3.multiplyByScale
|
3370
|
-
* @see Matrix3.multiplyByUniformScale
|
3371
|
-
* @see Matrix3.fromScale
|
3372
|
-
* @see Matrix3.fromUniformScale
|
3373
|
-
* @see Matrix3.setScale
|
3374
|
-
* @see Matrix3.setUniformScale
|
3375
|
-
*/
|
3376
|
-
Matrix3.getScale = function (matrix, result) {
|
3377
|
-
//>>includeStart('debug', pragmas.debug);
|
3378
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3379
|
-
Check.Check.typeOf.object("result", result);
|
3380
|
-
//>>includeEnd('debug');
|
3381
|
-
|
3382
|
-
result.x = Cartesian3.magnitude(
|
3383
|
-
Cartesian3.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
|
3384
|
-
);
|
3385
|
-
result.y = Cartesian3.magnitude(
|
3386
|
-
Cartesian3.fromElements(matrix[3], matrix[4], matrix[5], scratchColumn)
|
3387
|
-
);
|
3388
|
-
result.z = Cartesian3.magnitude(
|
3389
|
-
Cartesian3.fromElements(matrix[6], matrix[7], matrix[8], scratchColumn)
|
3390
|
-
);
|
3391
|
-
return result;
|
3392
|
-
};
|
3393
|
-
|
3394
|
-
const scaleScratch3 = new Cartesian3();
|
3395
|
-
|
3396
|
-
/**
|
3397
|
-
* Computes the maximum scale assuming the matrix is an affine transformation.
|
3398
|
-
* The maximum scale is the maximum length of the column vectors.
|
3399
|
-
*
|
3400
|
-
* @param {Matrix3} matrix The matrix.
|
3401
|
-
* @returns {number} The maximum scale.
|
3402
|
-
*/
|
3403
|
-
Matrix3.getMaximumScale = function (matrix) {
|
3404
|
-
Matrix3.getScale(matrix, scaleScratch3);
|
3405
|
-
return Cartesian3.maximumComponent(scaleScratch3);
|
3406
|
-
};
|
3407
|
-
|
3408
|
-
const scaleScratch4 = new Cartesian3();
|
3409
|
-
|
3410
|
-
/**
|
3411
|
-
* Sets the rotation assuming the matrix is an affine transformation.
|
3412
|
-
*
|
3413
|
-
* @param {Matrix3} matrix The matrix.
|
3414
|
-
* @param {Matrix3} rotation The rotation matrix.
|
3415
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3416
|
-
* @returns {Matrix3} The modified result parameter.
|
3417
|
-
*
|
3418
|
-
* @see Matrix3.getRotation
|
3419
|
-
*/
|
3420
|
-
Matrix3.setRotation = function (matrix, rotation, result) {
|
3421
|
-
//>>includeStart('debug', pragmas.debug);
|
3422
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3423
|
-
Check.Check.typeOf.object("result", result);
|
3424
|
-
//>>includeEnd('debug');
|
3425
|
-
|
3426
|
-
const scale = Matrix3.getScale(matrix, scaleScratch4);
|
3427
|
-
|
3428
|
-
result[0] = rotation[0] * scale.x;
|
3429
|
-
result[1] = rotation[1] * scale.x;
|
3430
|
-
result[2] = rotation[2] * scale.x;
|
3431
|
-
result[3] = rotation[3] * scale.y;
|
3432
|
-
result[4] = rotation[4] * scale.y;
|
3433
|
-
result[5] = rotation[5] * scale.y;
|
3434
|
-
result[6] = rotation[6] * scale.z;
|
3435
|
-
result[7] = rotation[7] * scale.z;
|
3436
|
-
result[8] = rotation[8] * scale.z;
|
3437
|
-
|
3438
|
-
return result;
|
3439
|
-
};
|
3440
|
-
|
3441
|
-
const scaleScratch5 = new Cartesian3();
|
3442
|
-
|
3443
|
-
/**
|
3444
|
-
* Extracts the rotation matrix assuming the matrix is an affine transformation.
|
3445
|
-
*
|
3446
|
-
* @param {Matrix3} matrix The matrix.
|
3447
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3448
|
-
* @returns {Matrix3} The modified result parameter.
|
3449
|
-
*
|
3450
|
-
* @see Matrix3.setRotation
|
3451
|
-
*/
|
3452
|
-
Matrix3.getRotation = function (matrix, result) {
|
3453
|
-
//>>includeStart('debug', pragmas.debug);
|
3454
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3455
|
-
Check.Check.typeOf.object("result", result);
|
3456
|
-
//>>includeEnd('debug');
|
3457
|
-
|
3458
|
-
const scale = Matrix3.getScale(matrix, scaleScratch5);
|
3459
|
-
|
3460
|
-
result[0] = matrix[0] / scale.x;
|
3461
|
-
result[1] = matrix[1] / scale.x;
|
3462
|
-
result[2] = matrix[2] / scale.x;
|
3463
|
-
result[3] = matrix[3] / scale.y;
|
3464
|
-
result[4] = matrix[4] / scale.y;
|
3465
|
-
result[5] = matrix[5] / scale.y;
|
3466
|
-
result[6] = matrix[6] / scale.z;
|
3467
|
-
result[7] = matrix[7] / scale.z;
|
3468
|
-
result[8] = matrix[8] / scale.z;
|
3469
|
-
|
3470
|
-
return result;
|
3471
|
-
};
|
3472
|
-
|
3473
|
-
/**
|
3474
|
-
* Computes the product of two matrices.
|
3475
|
-
*
|
3476
|
-
* @param {Matrix3} left The first matrix.
|
3477
|
-
* @param {Matrix3} right The second matrix.
|
3478
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3479
|
-
* @returns {Matrix3} The modified result parameter.
|
3480
|
-
*/
|
3481
|
-
Matrix3.multiply = function (left, right, result) {
|
3482
|
-
//>>includeStart('debug', pragmas.debug);
|
3483
|
-
Check.Check.typeOf.object("left", left);
|
3484
|
-
Check.Check.typeOf.object("right", right);
|
3485
|
-
Check.Check.typeOf.object("result", result);
|
3486
|
-
//>>includeEnd('debug');
|
3487
|
-
|
3488
|
-
const column0Row0 =
|
3489
|
-
left[0] * right[0] + left[3] * right[1] + left[6] * right[2];
|
3490
|
-
const column0Row1 =
|
3491
|
-
left[1] * right[0] + left[4] * right[1] + left[7] * right[2];
|
3492
|
-
const column0Row2 =
|
3493
|
-
left[2] * right[0] + left[5] * right[1] + left[8] * right[2];
|
3494
|
-
|
3495
|
-
const column1Row0 =
|
3496
|
-
left[0] * right[3] + left[3] * right[4] + left[6] * right[5];
|
3497
|
-
const column1Row1 =
|
3498
|
-
left[1] * right[3] + left[4] * right[4] + left[7] * right[5];
|
3499
|
-
const column1Row2 =
|
3500
|
-
left[2] * right[3] + left[5] * right[4] + left[8] * right[5];
|
3501
|
-
|
3502
|
-
const column2Row0 =
|
3503
|
-
left[0] * right[6] + left[3] * right[7] + left[6] * right[8];
|
3504
|
-
const column2Row1 =
|
3505
|
-
left[1] * right[6] + left[4] * right[7] + left[7] * right[8];
|
3506
|
-
const column2Row2 =
|
3507
|
-
left[2] * right[6] + left[5] * right[7] + left[8] * right[8];
|
3508
|
-
|
3509
|
-
result[0] = column0Row0;
|
3510
|
-
result[1] = column0Row1;
|
3511
|
-
result[2] = column0Row2;
|
3512
|
-
result[3] = column1Row0;
|
3513
|
-
result[4] = column1Row1;
|
3514
|
-
result[5] = column1Row2;
|
3515
|
-
result[6] = column2Row0;
|
3516
|
-
result[7] = column2Row1;
|
3517
|
-
result[8] = column2Row2;
|
3518
|
-
return result;
|
3519
|
-
};
|
3520
|
-
|
3521
|
-
/**
|
3522
|
-
* Computes the sum of two matrices.
|
3523
|
-
*
|
3524
|
-
* @param {Matrix3} left The first matrix.
|
3525
|
-
* @param {Matrix3} right The second matrix.
|
3526
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3527
|
-
* @returns {Matrix3} The modified result parameter.
|
3528
|
-
*/
|
3529
|
-
Matrix3.add = function (left, right, result) {
|
3530
|
-
//>>includeStart('debug', pragmas.debug);
|
3531
|
-
Check.Check.typeOf.object("left", left);
|
3532
|
-
Check.Check.typeOf.object("right", right);
|
3533
|
-
Check.Check.typeOf.object("result", result);
|
3534
|
-
//>>includeEnd('debug');
|
3535
|
-
|
3536
|
-
result[0] = left[0] + right[0];
|
3537
|
-
result[1] = left[1] + right[1];
|
3538
|
-
result[2] = left[2] + right[2];
|
3539
|
-
result[3] = left[3] + right[3];
|
3540
|
-
result[4] = left[4] + right[4];
|
3541
|
-
result[5] = left[5] + right[5];
|
3542
|
-
result[6] = left[6] + right[6];
|
3543
|
-
result[7] = left[7] + right[7];
|
3544
|
-
result[8] = left[8] + right[8];
|
3545
|
-
return result;
|
3546
|
-
};
|
3547
|
-
|
3548
|
-
/**
|
3549
|
-
* Computes the difference of two matrices.
|
3550
|
-
*
|
3551
|
-
* @param {Matrix3} left The first matrix.
|
3552
|
-
* @param {Matrix3} right The second matrix.
|
3553
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3554
|
-
* @returns {Matrix3} The modified result parameter.
|
3555
|
-
*/
|
3556
|
-
Matrix3.subtract = function (left, right, result) {
|
3557
|
-
//>>includeStart('debug', pragmas.debug);
|
3558
|
-
Check.Check.typeOf.object("left", left);
|
3559
|
-
Check.Check.typeOf.object("right", right);
|
3560
|
-
Check.Check.typeOf.object("result", result);
|
3561
|
-
//>>includeEnd('debug');
|
3562
|
-
|
3563
|
-
result[0] = left[0] - right[0];
|
3564
|
-
result[1] = left[1] - right[1];
|
3565
|
-
result[2] = left[2] - right[2];
|
3566
|
-
result[3] = left[3] - right[3];
|
3567
|
-
result[4] = left[4] - right[4];
|
3568
|
-
result[5] = left[5] - right[5];
|
3569
|
-
result[6] = left[6] - right[6];
|
3570
|
-
result[7] = left[7] - right[7];
|
3571
|
-
result[8] = left[8] - right[8];
|
3572
|
-
return result;
|
3573
|
-
};
|
3574
|
-
|
3575
|
-
/**
|
3576
|
-
* Computes the product of a matrix and a column vector.
|
3577
|
-
*
|
3578
|
-
* @param {Matrix3} matrix The matrix.
|
3579
|
-
* @param {Cartesian3} cartesian The column.
|
3580
|
-
* @param {Cartesian3} result The object onto which to store the result.
|
3581
|
-
* @returns {Cartesian3} The modified result parameter.
|
3582
|
-
*/
|
3583
|
-
Matrix3.multiplyByVector = function (matrix, cartesian, result) {
|
3584
|
-
//>>includeStart('debug', pragmas.debug);
|
3585
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3586
|
-
Check.Check.typeOf.object("cartesian", cartesian);
|
3587
|
-
Check.Check.typeOf.object("result", result);
|
3588
|
-
//>>includeEnd('debug');
|
3589
|
-
|
3590
|
-
const vX = cartesian.x;
|
3591
|
-
const vY = cartesian.y;
|
3592
|
-
const vZ = cartesian.z;
|
3593
|
-
|
3594
|
-
const x = matrix[0] * vX + matrix[3] * vY + matrix[6] * vZ;
|
3595
|
-
const y = matrix[1] * vX + matrix[4] * vY + matrix[7] * vZ;
|
3596
|
-
const z = matrix[2] * vX + matrix[5] * vY + matrix[8] * vZ;
|
3597
|
-
|
3598
|
-
result.x = x;
|
3599
|
-
result.y = y;
|
3600
|
-
result.z = z;
|
3601
|
-
return result;
|
3602
|
-
};
|
3603
|
-
|
3604
|
-
/**
|
3605
|
-
* Computes the product of a matrix and a scalar.
|
3606
|
-
*
|
3607
|
-
* @param {Matrix3} matrix The matrix.
|
3608
|
-
* @param {number} scalar The number to multiply by.
|
3609
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3610
|
-
* @returns {Matrix3} The modified result parameter.
|
3611
|
-
*/
|
3612
|
-
Matrix3.multiplyByScalar = function (matrix, scalar, result) {
|
3613
|
-
//>>includeStart('debug', pragmas.debug);
|
3614
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3615
|
-
Check.Check.typeOf.number("scalar", scalar);
|
3616
|
-
Check.Check.typeOf.object("result", result);
|
3617
|
-
//>>includeEnd('debug');
|
3618
|
-
|
3619
|
-
result[0] = matrix[0] * scalar;
|
3620
|
-
result[1] = matrix[1] * scalar;
|
3621
|
-
result[2] = matrix[2] * scalar;
|
3622
|
-
result[3] = matrix[3] * scalar;
|
3623
|
-
result[4] = matrix[4] * scalar;
|
3624
|
-
result[5] = matrix[5] * scalar;
|
3625
|
-
result[6] = matrix[6] * scalar;
|
3626
|
-
result[7] = matrix[7] * scalar;
|
3627
|
-
result[8] = matrix[8] * scalar;
|
3628
|
-
return result;
|
3629
|
-
};
|
3630
|
-
|
3631
|
-
/**
|
3632
|
-
* Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
3633
|
-
*
|
3634
|
-
* @param {Matrix3} matrix The matrix on the left-hand side.
|
3635
|
-
* @param {Cartesian3} scale The non-uniform scale on the right-hand side.
|
3636
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3637
|
-
* @returns {Matrix3} The modified result parameter.
|
3638
|
-
*
|
3639
|
-
*
|
3640
|
-
* @example
|
3641
|
-
* // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m);
|
3642
|
-
* Cesium.Matrix3.multiplyByScale(m, scale, m);
|
3643
|
-
*
|
3644
|
-
* @see Matrix3.multiplyByUniformScale
|
3645
|
-
* @see Matrix3.fromScale
|
3646
|
-
* @see Matrix3.fromUniformScale
|
3647
|
-
* @see Matrix3.setScale
|
3648
|
-
* @see Matrix3.setUniformScale
|
3649
|
-
* @see Matrix3.getScale
|
3650
|
-
*/
|
3651
|
-
Matrix3.multiplyByScale = function (matrix, scale, result) {
|
3652
|
-
//>>includeStart('debug', pragmas.debug);
|
3653
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3654
|
-
Check.Check.typeOf.object("scale", scale);
|
3655
|
-
Check.Check.typeOf.object("result", result);
|
3656
|
-
//>>includeEnd('debug');
|
3657
|
-
|
3658
|
-
result[0] = matrix[0] * scale.x;
|
3659
|
-
result[1] = matrix[1] * scale.x;
|
3660
|
-
result[2] = matrix[2] * scale.x;
|
3661
|
-
result[3] = matrix[3] * scale.y;
|
3662
|
-
result[4] = matrix[4] * scale.y;
|
3663
|
-
result[5] = matrix[5] * scale.y;
|
3664
|
-
result[6] = matrix[6] * scale.z;
|
3665
|
-
result[7] = matrix[7] * scale.z;
|
3666
|
-
result[8] = matrix[8] * scale.z;
|
3667
|
-
|
3668
|
-
return result;
|
3669
|
-
};
|
3670
|
-
|
3671
|
-
/**
|
3672
|
-
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
|
3673
|
-
*
|
3674
|
-
* @param {Matrix3} matrix The matrix on the left-hand side.
|
3675
|
-
* @param {number} scale The uniform scale on the right-hand side.
|
3676
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3677
|
-
* @returns {Matrix3} The modified result parameter.
|
3678
|
-
*
|
3679
|
-
* @example
|
3680
|
-
* // Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromUniformScale(scale), m);
|
3681
|
-
* Cesium.Matrix3.multiplyByUniformScale(m, scale, m);
|
3682
|
-
*
|
3683
|
-
* @see Matrix3.multiplyByScale
|
3684
|
-
* @see Matrix3.fromScale
|
3685
|
-
* @see Matrix3.fromUniformScale
|
3686
|
-
* @see Matrix3.setScale
|
3687
|
-
* @see Matrix3.setUniformScale
|
3688
|
-
* @see Matrix3.getScale
|
3689
|
-
*/
|
3690
|
-
Matrix3.multiplyByUniformScale = function (matrix, scale, result) {
|
3691
|
-
//>>includeStart('debug', pragmas.debug);
|
3692
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3693
|
-
Check.Check.typeOf.number("scale", scale);
|
3694
|
-
Check.Check.typeOf.object("result", result);
|
3695
|
-
//>>includeEnd('debug');
|
3696
|
-
|
3697
|
-
result[0] = matrix[0] * scale;
|
3698
|
-
result[1] = matrix[1] * scale;
|
3699
|
-
result[2] = matrix[2] * scale;
|
3700
|
-
result[3] = matrix[3] * scale;
|
3701
|
-
result[4] = matrix[4] * scale;
|
3702
|
-
result[5] = matrix[5] * scale;
|
3703
|
-
result[6] = matrix[6] * scale;
|
3704
|
-
result[7] = matrix[7] * scale;
|
3705
|
-
result[8] = matrix[8] * scale;
|
3706
|
-
|
3707
|
-
return result;
|
3708
|
-
};
|
3709
|
-
|
3710
|
-
/**
|
3711
|
-
* Creates a negated copy of the provided matrix.
|
3712
|
-
*
|
3713
|
-
* @param {Matrix3} matrix The matrix to negate.
|
3714
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3715
|
-
* @returns {Matrix3} The modified result parameter.
|
3716
|
-
*/
|
3717
|
-
Matrix3.negate = function (matrix, result) {
|
3718
|
-
//>>includeStart('debug', pragmas.debug);
|
3719
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3720
|
-
Check.Check.typeOf.object("result", result);
|
3721
|
-
//>>includeEnd('debug');
|
3722
|
-
|
3723
|
-
result[0] = -matrix[0];
|
3724
|
-
result[1] = -matrix[1];
|
3725
|
-
result[2] = -matrix[2];
|
3726
|
-
result[3] = -matrix[3];
|
3727
|
-
result[4] = -matrix[4];
|
3728
|
-
result[5] = -matrix[5];
|
3729
|
-
result[6] = -matrix[6];
|
3730
|
-
result[7] = -matrix[7];
|
3731
|
-
result[8] = -matrix[8];
|
3732
|
-
return result;
|
3733
|
-
};
|
3734
|
-
|
3735
|
-
/**
|
3736
|
-
* Computes the transpose of the provided matrix.
|
3737
|
-
*
|
3738
|
-
* @param {Matrix3} matrix The matrix to transpose.
|
3739
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3740
|
-
* @returns {Matrix3} The modified result parameter.
|
3741
|
-
*/
|
3742
|
-
Matrix3.transpose = function (matrix, result) {
|
3743
|
-
//>>includeStart('debug', pragmas.debug);
|
3744
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3745
|
-
Check.Check.typeOf.object("result", result);
|
3746
|
-
//>>includeEnd('debug');
|
3747
|
-
|
3748
|
-
const column0Row0 = matrix[0];
|
3749
|
-
const column0Row1 = matrix[3];
|
3750
|
-
const column0Row2 = matrix[6];
|
3751
|
-
const column1Row0 = matrix[1];
|
3752
|
-
const column1Row1 = matrix[4];
|
3753
|
-
const column1Row2 = matrix[7];
|
3754
|
-
const column2Row0 = matrix[2];
|
3755
|
-
const column2Row1 = matrix[5];
|
3756
|
-
const column2Row2 = matrix[8];
|
3757
|
-
|
3758
|
-
result[0] = column0Row0;
|
3759
|
-
result[1] = column0Row1;
|
3760
|
-
result[2] = column0Row2;
|
3761
|
-
result[3] = column1Row0;
|
3762
|
-
result[4] = column1Row1;
|
3763
|
-
result[5] = column1Row2;
|
3764
|
-
result[6] = column2Row0;
|
3765
|
-
result[7] = column2Row1;
|
3766
|
-
result[8] = column2Row2;
|
3767
|
-
return result;
|
3768
|
-
};
|
3769
|
-
|
3770
|
-
function computeFrobeniusNorm(matrix) {
|
3771
|
-
let norm = 0.0;
|
3772
|
-
for (let i = 0; i < 9; ++i) {
|
3773
|
-
const temp = matrix[i];
|
3774
|
-
norm += temp * temp;
|
3775
|
-
}
|
3776
|
-
|
3777
|
-
return Math.sqrt(norm);
|
3778
|
-
}
|
3779
|
-
|
3780
|
-
const rowVal = [1, 0, 0];
|
3781
|
-
const colVal = [2, 2, 1];
|
3782
|
-
|
3783
|
-
function offDiagonalFrobeniusNorm(matrix) {
|
3784
|
-
// Computes the "off-diagonal" Frobenius norm.
|
3785
|
-
// Assumes matrix is symmetric.
|
3786
|
-
|
3787
|
-
let norm = 0.0;
|
3788
|
-
for (let i = 0; i < 3; ++i) {
|
3789
|
-
const temp = matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])];
|
3790
|
-
norm += 2.0 * temp * temp;
|
3791
|
-
}
|
3792
|
-
|
3793
|
-
return Math.sqrt(norm);
|
3794
|
-
}
|
3795
|
-
|
3796
|
-
function shurDecomposition(matrix, result) {
|
3797
|
-
// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,
|
3798
|
-
// section 8.4.2 The 2by2 Symmetric Schur Decomposition.
|
3799
|
-
//
|
3800
|
-
// The routine takes a matrix, which is assumed to be symmetric, and
|
3801
|
-
// finds the largest off-diagonal term, and then creates
|
3802
|
-
// a matrix (result) which can be used to help reduce it
|
3803
|
-
|
3804
|
-
const tolerance = Math$1.CesiumMath.EPSILON15;
|
3805
|
-
|
3806
|
-
let maxDiagonal = 0.0;
|
3807
|
-
let rotAxis = 1;
|
3808
|
-
|
3809
|
-
// find pivot (rotAxis) based on max diagonal of matrix
|
3810
|
-
for (let i = 0; i < 3; ++i) {
|
3811
|
-
const temp = Math.abs(
|
3812
|
-
matrix[Matrix3.getElementIndex(colVal[i], rowVal[i])]
|
3813
|
-
);
|
3814
|
-
if (temp > maxDiagonal) {
|
3815
|
-
rotAxis = i;
|
3816
|
-
maxDiagonal = temp;
|
3817
|
-
}
|
3818
|
-
}
|
3819
|
-
|
3820
|
-
let c = 1.0;
|
3821
|
-
let s = 0.0;
|
3822
|
-
|
3823
|
-
const p = rowVal[rotAxis];
|
3824
|
-
const q = colVal[rotAxis];
|
3825
|
-
|
3826
|
-
if (Math.abs(matrix[Matrix3.getElementIndex(q, p)]) > tolerance) {
|
3827
|
-
const qq = matrix[Matrix3.getElementIndex(q, q)];
|
3828
|
-
const pp = matrix[Matrix3.getElementIndex(p, p)];
|
3829
|
-
const qp = matrix[Matrix3.getElementIndex(q, p)];
|
3830
|
-
|
3831
|
-
const tau = (qq - pp) / 2.0 / qp;
|
3832
|
-
let t;
|
3833
|
-
|
3834
|
-
if (tau < 0.0) {
|
3835
|
-
t = -1.0 / (-tau + Math.sqrt(1.0 + tau * tau));
|
3836
|
-
} else {
|
3837
|
-
t = 1.0 / (tau + Math.sqrt(1.0 + tau * tau));
|
3838
|
-
}
|
3839
|
-
|
3840
|
-
c = 1.0 / Math.sqrt(1.0 + t * t);
|
3841
|
-
s = t * c;
|
3842
|
-
}
|
3843
|
-
|
3844
|
-
result = Matrix3.clone(Matrix3.IDENTITY, result);
|
3845
|
-
|
3846
|
-
result[Matrix3.getElementIndex(p, p)] = result[
|
3847
|
-
Matrix3.getElementIndex(q, q)
|
3848
|
-
] = c;
|
3849
|
-
result[Matrix3.getElementIndex(q, p)] = s;
|
3850
|
-
result[Matrix3.getElementIndex(p, q)] = -s;
|
3851
|
-
|
3852
|
-
return result;
|
3853
|
-
}
|
3854
|
-
|
3855
|
-
const jMatrix = new Matrix3();
|
3856
|
-
const jMatrixTranspose = new Matrix3();
|
3857
|
-
|
3858
|
-
/**
|
3859
|
-
* Computes the eigenvectors and eigenvalues of a symmetric matrix.
|
3860
|
-
* <p>
|
3861
|
-
* Returns a diagonal matrix and unitary matrix such that:
|
3862
|
-
* <code>matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)</code>
|
3863
|
-
* </p>
|
3864
|
-
* <p>
|
3865
|
-
* The values along the diagonal of the diagonal matrix are the eigenvalues. The columns
|
3866
|
-
* of the unitary matrix are the corresponding eigenvectors.
|
3867
|
-
* </p>
|
3868
|
-
*
|
3869
|
-
* @param {Matrix3} matrix The matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.
|
3870
|
-
* @param {object} [result] An object with unitary and diagonal properties which are matrices onto which to store the result.
|
3871
|
-
* @returns {object} An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.
|
3872
|
-
*
|
3873
|
-
* @example
|
3874
|
-
* const a = //... symetric matrix
|
3875
|
-
* const result = {
|
3876
|
-
* unitary : new Cesium.Matrix3(),
|
3877
|
-
* diagonal : new Cesium.Matrix3()
|
3878
|
-
* };
|
3879
|
-
* Cesium.Matrix3.computeEigenDecomposition(a, result);
|
3880
|
-
*
|
3881
|
-
* const unitaryTranspose = Cesium.Matrix3.transpose(result.unitary, new Cesium.Matrix3());
|
3882
|
-
* const b = Cesium.Matrix3.multiply(result.unitary, result.diagonal, new Cesium.Matrix3());
|
3883
|
-
* Cesium.Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a
|
3884
|
-
*
|
3885
|
-
* const lambda = Cesium.Matrix3.getColumn(result.diagonal, 0, new Cesium.Cartesian3()).x; // first eigenvalue
|
3886
|
-
* const v = Cesium.Matrix3.getColumn(result.unitary, 0, new Cesium.Cartesian3()); // first eigenvector
|
3887
|
-
* const c = Cesium.Cartesian3.multiplyByScalar(v, lambda, new Cesium.Cartesian3()); // equal to Cesium.Matrix3.multiplyByVector(a, v)
|
3888
|
-
*/
|
3889
|
-
Matrix3.computeEigenDecomposition = function (matrix, result) {
|
3890
|
-
//>>includeStart('debug', pragmas.debug);
|
3891
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3892
|
-
//>>includeEnd('debug');
|
3893
|
-
|
3894
|
-
// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,
|
3895
|
-
// section 8.4.3 The Classical Jacobi Algorithm
|
3896
|
-
|
3897
|
-
const tolerance = Math$1.CesiumMath.EPSILON20;
|
3898
|
-
const maxSweeps = 10;
|
3899
|
-
|
3900
|
-
let count = 0;
|
3901
|
-
let sweep = 0;
|
3902
|
-
|
3903
|
-
if (!defaultValue.defined(result)) {
|
3904
|
-
result = {};
|
3905
|
-
}
|
3906
|
-
|
3907
|
-
const unitaryMatrix = (result.unitary = Matrix3.clone(
|
3908
|
-
Matrix3.IDENTITY,
|
3909
|
-
result.unitary
|
3910
|
-
));
|
3911
|
-
const diagMatrix = (result.diagonal = Matrix3.clone(matrix, result.diagonal));
|
3912
|
-
|
3913
|
-
const epsilon = tolerance * computeFrobeniusNorm(diagMatrix);
|
3914
|
-
|
3915
|
-
while (sweep < maxSweeps && offDiagonalFrobeniusNorm(diagMatrix) > epsilon) {
|
3916
|
-
shurDecomposition(diagMatrix, jMatrix);
|
3917
|
-
Matrix3.transpose(jMatrix, jMatrixTranspose);
|
3918
|
-
Matrix3.multiply(diagMatrix, jMatrix, diagMatrix);
|
3919
|
-
Matrix3.multiply(jMatrixTranspose, diagMatrix, diagMatrix);
|
3920
|
-
Matrix3.multiply(unitaryMatrix, jMatrix, unitaryMatrix);
|
3921
|
-
|
3922
|
-
if (++count > 2) {
|
3923
|
-
++sweep;
|
3924
|
-
count = 0;
|
3925
|
-
}
|
3926
|
-
}
|
3927
|
-
|
3928
|
-
return result;
|
3929
|
-
};
|
3930
|
-
|
3931
|
-
/**
|
3932
|
-
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
3933
|
-
*
|
3934
|
-
* @param {Matrix3} matrix The matrix with signed elements.
|
3935
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3936
|
-
* @returns {Matrix3} The modified result parameter.
|
3937
|
-
*/
|
3938
|
-
Matrix3.abs = function (matrix, result) {
|
3939
|
-
//>>includeStart('debug', pragmas.debug);
|
3940
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3941
|
-
Check.Check.typeOf.object("result", result);
|
3942
|
-
//>>includeEnd('debug');
|
3943
|
-
|
3944
|
-
result[0] = Math.abs(matrix[0]);
|
3945
|
-
result[1] = Math.abs(matrix[1]);
|
3946
|
-
result[2] = Math.abs(matrix[2]);
|
3947
|
-
result[3] = Math.abs(matrix[3]);
|
3948
|
-
result[4] = Math.abs(matrix[4]);
|
3949
|
-
result[5] = Math.abs(matrix[5]);
|
3950
|
-
result[6] = Math.abs(matrix[6]);
|
3951
|
-
result[7] = Math.abs(matrix[7]);
|
3952
|
-
result[8] = Math.abs(matrix[8]);
|
3953
|
-
|
3954
|
-
return result;
|
3955
|
-
};
|
3956
|
-
|
3957
|
-
/**
|
3958
|
-
* Computes the determinant of the provided matrix.
|
3959
|
-
*
|
3960
|
-
* @param {Matrix3} matrix The matrix to use.
|
3961
|
-
* @returns {number} The value of the determinant of the matrix.
|
3962
|
-
*/
|
3963
|
-
Matrix3.determinant = function (matrix) {
|
3964
|
-
//>>includeStart('debug', pragmas.debug);
|
3965
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3966
|
-
//>>includeEnd('debug');
|
3967
|
-
|
3968
|
-
const m11 = matrix[0];
|
3969
|
-
const m21 = matrix[3];
|
3970
|
-
const m31 = matrix[6];
|
3971
|
-
const m12 = matrix[1];
|
3972
|
-
const m22 = matrix[4];
|
3973
|
-
const m32 = matrix[7];
|
3974
|
-
const m13 = matrix[2];
|
3975
|
-
const m23 = matrix[5];
|
3976
|
-
const m33 = matrix[8];
|
3977
|
-
|
3978
|
-
return (
|
3979
|
-
m11 * (m22 * m33 - m23 * m32) +
|
3980
|
-
m12 * (m23 * m31 - m21 * m33) +
|
3981
|
-
m13 * (m21 * m32 - m22 * m31)
|
3982
|
-
);
|
3983
|
-
};
|
3984
|
-
|
3985
|
-
/**
|
3986
|
-
* Computes the inverse of the provided matrix.
|
3987
|
-
*
|
3988
|
-
* @param {Matrix3} matrix The matrix to invert.
|
3989
|
-
* @param {Matrix3} result The object onto which to store the result.
|
3990
|
-
* @returns {Matrix3} The modified result parameter.
|
3991
|
-
*
|
3992
|
-
* @exception {DeveloperError} matrix is not invertible.
|
3993
|
-
*/
|
3994
|
-
Matrix3.inverse = function (matrix, result) {
|
3995
|
-
//>>includeStart('debug', pragmas.debug);
|
3996
|
-
Check.Check.typeOf.object("matrix", matrix);
|
3997
|
-
Check.Check.typeOf.object("result", result);
|
3998
|
-
//>>includeEnd('debug');
|
3999
|
-
|
4000
|
-
const m11 = matrix[0];
|
4001
|
-
const m21 = matrix[1];
|
4002
|
-
const m31 = matrix[2];
|
4003
|
-
const m12 = matrix[3];
|
4004
|
-
const m22 = matrix[4];
|
4005
|
-
const m32 = matrix[5];
|
4006
|
-
const m13 = matrix[6];
|
4007
|
-
const m23 = matrix[7];
|
4008
|
-
const m33 = matrix[8];
|
4009
|
-
|
4010
|
-
const determinant = Matrix3.determinant(matrix);
|
4011
|
-
|
4012
|
-
//>>includeStart('debug', pragmas.debug);
|
4013
|
-
if (Math.abs(determinant) <= Math$1.CesiumMath.EPSILON15) {
|
4014
|
-
throw new Check.DeveloperError("matrix is not invertible");
|
4015
|
-
}
|
4016
|
-
//>>includeEnd('debug');
|
4017
|
-
|
4018
|
-
result[0] = m22 * m33 - m23 * m32;
|
4019
|
-
result[1] = m23 * m31 - m21 * m33;
|
4020
|
-
result[2] = m21 * m32 - m22 * m31;
|
4021
|
-
result[3] = m13 * m32 - m12 * m33;
|
4022
|
-
result[4] = m11 * m33 - m13 * m31;
|
4023
|
-
result[5] = m12 * m31 - m11 * m32;
|
4024
|
-
result[6] = m12 * m23 - m13 * m22;
|
4025
|
-
result[7] = m13 * m21 - m11 * m23;
|
4026
|
-
result[8] = m11 * m22 - m12 * m21;
|
4027
|
-
|
4028
|
-
const scale = 1.0 / determinant;
|
4029
|
-
return Matrix3.multiplyByScalar(result, scale, result);
|
4030
|
-
};
|
4031
|
-
|
4032
|
-
const scratchTransposeMatrix = new Matrix3();
|
4033
|
-
|
4034
|
-
/**
|
4035
|
-
* Computes the inverse transpose of a matrix.
|
4036
|
-
*
|
4037
|
-
* @param {Matrix3} matrix The matrix to transpose and invert.
|
4038
|
-
* @param {Matrix3} result The object onto which to store the result.
|
4039
|
-
* @returns {Matrix3} The modified result parameter.
|
4040
|
-
*/
|
4041
|
-
Matrix3.inverseTranspose = function (matrix, result) {
|
4042
|
-
//>>includeStart('debug', pragmas.debug);
|
4043
|
-
Check.Check.typeOf.object("matrix", matrix);
|
4044
|
-
Check.Check.typeOf.object("result", result);
|
4045
|
-
//>>includeEnd('debug');
|
4046
|
-
|
4047
|
-
return Matrix3.inverse(
|
4048
|
-
Matrix3.transpose(matrix, scratchTransposeMatrix),
|
4049
|
-
result
|
4050
|
-
);
|
4051
|
-
};
|
4052
|
-
|
4053
|
-
/**
|
4054
|
-
* Compares the provided matrices componentwise and returns
|
4055
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
4056
|
-
*
|
4057
|
-
* @param {Matrix3} [left] The first matrix.
|
4058
|
-
* @param {Matrix3} [right] The second matrix.
|
4059
|
-
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
4060
|
-
*/
|
4061
|
-
Matrix3.equals = function (left, right) {
|
4062
|
-
return (
|
4063
|
-
left === right ||
|
4064
|
-
(defaultValue.defined(left) &&
|
4065
|
-
defaultValue.defined(right) &&
|
4066
|
-
left[0] === right[0] &&
|
4067
|
-
left[1] === right[1] &&
|
4068
|
-
left[2] === right[2] &&
|
4069
|
-
left[3] === right[3] &&
|
4070
|
-
left[4] === right[4] &&
|
4071
|
-
left[5] === right[5] &&
|
4072
|
-
left[6] === right[6] &&
|
4073
|
-
left[7] === right[7] &&
|
4074
|
-
left[8] === right[8])
|
4075
|
-
);
|
4076
|
-
};
|
4077
|
-
|
4078
|
-
/**
|
4079
|
-
* Compares the provided matrices componentwise and returns
|
4080
|
-
* <code>true</code> if they are within the provided epsilon,
|
4081
|
-
* <code>false</code> otherwise.
|
4082
|
-
*
|
4083
|
-
* @param {Matrix3} [left] The first matrix.
|
4084
|
-
* @param {Matrix3} [right] The second matrix.
|
4085
|
-
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
4086
|
-
* @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
4087
|
-
*/
|
4088
|
-
Matrix3.equalsEpsilon = function (left, right, epsilon) {
|
4089
|
-
epsilon = defaultValue.defaultValue(epsilon, 0);
|
4090
|
-
|
4091
|
-
return (
|
4092
|
-
left === right ||
|
4093
|
-
(defaultValue.defined(left) &&
|
4094
|
-
defaultValue.defined(right) &&
|
4095
|
-
Math.abs(left[0] - right[0]) <= epsilon &&
|
4096
|
-
Math.abs(left[1] - right[1]) <= epsilon &&
|
4097
|
-
Math.abs(left[2] - right[2]) <= epsilon &&
|
4098
|
-
Math.abs(left[3] - right[3]) <= epsilon &&
|
4099
|
-
Math.abs(left[4] - right[4]) <= epsilon &&
|
4100
|
-
Math.abs(left[5] - right[5]) <= epsilon &&
|
4101
|
-
Math.abs(left[6] - right[6]) <= epsilon &&
|
4102
|
-
Math.abs(left[7] - right[7]) <= epsilon &&
|
4103
|
-
Math.abs(left[8] - right[8]) <= epsilon)
|
4104
|
-
);
|
4105
|
-
};
|
4106
|
-
|
4107
|
-
/**
|
4108
|
-
* An immutable Matrix3 instance initialized to the identity matrix.
|
4109
|
-
*
|
4110
|
-
* @type {Matrix3}
|
4111
|
-
* @constant
|
4112
|
-
*/
|
4113
|
-
Matrix3.IDENTITY = Object.freeze(
|
4114
|
-
new Matrix3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
|
4115
|
-
);
|
4116
|
-
|
4117
|
-
/**
|
4118
|
-
* An immutable Matrix3 instance initialized to the zero matrix.
|
4119
|
-
*
|
4120
|
-
* @type {Matrix3}
|
4121
|
-
* @constant
|
4122
|
-
*/
|
4123
|
-
Matrix3.ZERO = Object.freeze(
|
4124
|
-
new Matrix3(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
4125
|
-
);
|
4126
|
-
|
4127
|
-
/**
|
4128
|
-
* The index into Matrix3 for column 0, row 0.
|
4129
|
-
*
|
4130
|
-
* @type {number}
|
4131
|
-
* @constant
|
4132
|
-
*/
|
4133
|
-
Matrix3.COLUMN0ROW0 = 0;
|
4134
|
-
|
4135
|
-
/**
|
4136
|
-
* The index into Matrix3 for column 0, row 1.
|
4137
|
-
*
|
4138
|
-
* @type {number}
|
4139
|
-
* @constant
|
4140
|
-
*/
|
4141
|
-
Matrix3.COLUMN0ROW1 = 1;
|
4142
|
-
|
4143
|
-
/**
|
4144
|
-
* The index into Matrix3 for column 0, row 2.
|
4145
|
-
*
|
4146
|
-
* @type {number}
|
4147
|
-
* @constant
|
4148
|
-
*/
|
4149
|
-
Matrix3.COLUMN0ROW2 = 2;
|
4150
|
-
|
4151
|
-
/**
|
4152
|
-
* The index into Matrix3 for column 1, row 0.
|
4153
|
-
*
|
4154
|
-
* @type {number}
|
4155
|
-
* @constant
|
4156
|
-
*/
|
4157
|
-
Matrix3.COLUMN1ROW0 = 3;
|
4158
|
-
|
4159
|
-
/**
|
4160
|
-
* The index into Matrix3 for column 1, row 1.
|
4161
|
-
*
|
4162
|
-
* @type {number}
|
4163
|
-
* @constant
|
4164
|
-
*/
|
4165
|
-
Matrix3.COLUMN1ROW1 = 4;
|
4166
|
-
|
4167
|
-
/**
|
4168
|
-
* The index into Matrix3 for column 1, row 2.
|
4169
|
-
*
|
4170
|
-
* @type {number}
|
4171
|
-
* @constant
|
4172
|
-
*/
|
4173
|
-
Matrix3.COLUMN1ROW2 = 5;
|
4174
|
-
|
4175
|
-
/**
|
4176
|
-
* The index into Matrix3 for column 2, row 0.
|
4177
|
-
*
|
4178
|
-
* @type {number}
|
4179
|
-
* @constant
|
4180
|
-
*/
|
4181
|
-
Matrix3.COLUMN2ROW0 = 6;
|
4182
|
-
|
4183
|
-
/**
|
4184
|
-
* The index into Matrix3 for column 2, row 1.
|
4185
|
-
*
|
4186
|
-
* @type {number}
|
4187
|
-
* @constant
|
4188
|
-
*/
|
4189
|
-
Matrix3.COLUMN2ROW1 = 7;
|
4190
|
-
|
4191
|
-
/**
|
4192
|
-
* The index into Matrix3 for column 2, row 2.
|
4193
|
-
*
|
4194
|
-
* @type {number}
|
4195
|
-
* @constant
|
4196
|
-
*/
|
4197
|
-
Matrix3.COLUMN2ROW2 = 8;
|
4198
|
-
|
4199
|
-
Object.defineProperties(Matrix3.prototype, {
|
4200
|
-
/**
|
4201
|
-
* Gets the number of items in the collection.
|
4202
|
-
* @memberof Matrix3.prototype
|
4203
|
-
*
|
4204
|
-
* @type {number}
|
4205
|
-
*/
|
4206
|
-
length: {
|
4207
|
-
get: function () {
|
4208
|
-
return Matrix3.packedLength;
|
4209
|
-
},
|
4210
|
-
},
|
4211
|
-
});
|
4212
|
-
|
4213
|
-
/**
|
4214
|
-
* Duplicates the provided Matrix3 instance.
|
4215
|
-
*
|
4216
|
-
* @param {Matrix3} [result] The object onto which to store the result.
|
4217
|
-
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
|
4218
|
-
*/
|
4219
|
-
Matrix3.prototype.clone = function (result) {
|
4220
|
-
return Matrix3.clone(this, result);
|
4221
|
-
};
|
4222
|
-
|
4223
|
-
/**
|
4224
|
-
* Compares this matrix to the provided matrix componentwise and returns
|
4225
|
-
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
4226
|
-
*
|
4227
|
-
* @param {Matrix3} [right] The right hand side matrix.
|
4228
|
-
* @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
4229
|
-
*/
|
4230
|
-
Matrix3.prototype.equals = function (right) {
|
4231
|
-
return Matrix3.equals(this, right);
|
4232
|
-
};
|
4233
|
-
|
4234
|
-
/**
|
4235
|
-
* @private
|
4236
|
-
*/
|
4237
|
-
Matrix3.equalsArray = function (matrix, array, offset) {
|
4238
|
-
return (
|
4239
|
-
matrix[0] === array[offset] &&
|
4240
|
-
matrix[1] === array[offset + 1] &&
|
4241
|
-
matrix[2] === array[offset + 2] &&
|
4242
|
-
matrix[3] === array[offset + 3] &&
|
4243
|
-
matrix[4] === array[offset + 4] &&
|
4244
|
-
matrix[5] === array[offset + 5] &&
|
4245
|
-
matrix[6] === array[offset + 6] &&
|
4246
|
-
matrix[7] === array[offset + 7] &&
|
4247
|
-
matrix[8] === array[offset + 8]
|
4248
|
-
);
|
4249
|
-
};
|
4250
|
-
|
4251
|
-
/**
|
4252
|
-
* Compares this matrix to the provided matrix componentwise and returns
|
4253
|
-
* <code>true</code> if they are within the provided epsilon,
|
4254
|
-
* <code>false</code> otherwise.
|
4255
|
-
*
|
4256
|
-
* @param {Matrix3} [right] The right hand side matrix.
|
4257
|
-
* @param {number} [epsilon=0] The epsilon to use for equality testing.
|
4258
|
-
* @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
|
4259
|
-
*/
|
4260
|
-
Matrix3.prototype.equalsEpsilon = function (right, epsilon) {
|
4261
|
-
return Matrix3.equalsEpsilon(this, right, epsilon);
|
4262
|
-
};
|
4263
|
-
|
4264
|
-
/**
|
4265
|
-
* Creates a string representing this Matrix with each row being
|
4266
|
-
* on a separate line and in the format '(column0, column1, column2)'.
|
4267
|
-
*
|
4268
|
-
* @returns {string} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2)'.
|
4269
|
-
*/
|
4270
|
-
Matrix3.prototype.toString = function () {
|
4271
|
-
return (
|
4272
|
-
`(${this[0]}, ${this[3]}, ${this[6]})\n` +
|
4273
|
-
`(${this[1]}, ${this[4]}, ${this[7]})\n` +
|
4274
|
-
`(${this[2]}, ${this[5]}, ${this[8]})`
|
4275
|
-
);
|
4276
|
-
};
|
4277
|
-
|
4278
|
-
exports.Cartesian3 = Cartesian3;
|
4279
|
-
exports.Cartographic = Cartographic;
|
4280
|
-
exports.Ellipsoid = Ellipsoid;
|
4281
|
-
exports.Matrix3 = Matrix3;
|
4282
|
-
|
4283
|
-
}));
|