cesium 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +259 -0
- data/README.rdoc +90 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/Assets/Assets.profile.js +8 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
- data/app/assets/javascripts/Assets/Textures/NE2_LR_LC_SR_W_DR_2048.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/waterNormals.jpg +0 -0
- data/app/assets/javascripts/Assets/package.json +6 -0
- data/app/assets/javascripts/Cesium.js +320 -0
- data/app/assets/javascripts/Core/AnimationController.js +148 -0
- data/app/assets/javascripts/Core/AxisAlignedBoundingBox.js +243 -0
- data/app/assets/javascripts/Core/BoundingRectangle.js +364 -0
- data/app/assets/javascripts/Core/BoundingSphere.js +819 -0
- data/app/assets/javascripts/Core/BoxTessellator.js +93 -0
- data/app/assets/javascripts/Core/Cartesian2.js +762 -0
- data/app/assets/javascripts/Core/Cartesian3.js +861 -0
- data/app/assets/javascripts/Core/Cartesian4.js +762 -0
- data/app/assets/javascripts/Core/Cartographic.js +211 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +232 -0
- data/app/assets/javascripts/Core/Clock.js +195 -0
- data/app/assets/javascripts/Core/ClockRange.js +37 -0
- data/app/assets/javascripts/Core/ClockStep.js +32 -0
- data/app/assets/javascripts/Core/Color.js +1629 -0
- data/app/assets/javascripts/Core/ComponentDatatype.js +119 -0
- data/app/assets/javascripts/Core/Core.profile.js +8 -0
- data/app/assets/javascripts/Core/CubeMapEllipsoidTessellator.js +198 -0
- data/app/assets/javascripts/Core/CubicRealPolynomial.js +251 -0
- data/app/assets/javascripts/Core/DefaultProxy.js +30 -0
- data/app/assets/javascripts/Core/DeveloperError.js +60 -0
- data/app/assets/javascripts/Core/EarthOrientationParameters.js +383 -0
- data/app/assets/javascripts/Core/EarthOrientationParametersSample.js +50 -0
- data/app/assets/javascripts/Core/Ellipsoid.js +539 -0
- data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +207 -0
- data/app/assets/javascripts/Core/EllipsoidalOccluder.js +151 -0
- data/app/assets/javascripts/Core/EncodedCartesian3.js +197 -0
- data/app/assets/javascripts/Core/Enumeration.js +67 -0
- data/app/assets/javascripts/Core/Event.js +122 -0
- data/app/assets/javascripts/Core/Extent.js +383 -0
- data/app/assets/javascripts/Core/ExtentTessellator.js +384 -0
- data/app/assets/javascripts/Core/FAR.js +13 -0
- data/app/assets/javascripts/Core/FeatureDetection.js +126 -0
- data/app/assets/javascripts/Core/Fullscreen.js +235 -0
- data/app/assets/javascripts/Core/GeographicProjection.js +107 -0
- data/app/assets/javascripts/Core/HermitePolynomialApproximation.js +176 -0
- data/app/assets/javascripts/Core/HermiteSpline.js +234 -0
- data/app/assets/javascripts/Core/Iau2006XysData.js +259 -0
- data/app/assets/javascripts/Core/Iau2006XysSample.js +36 -0
- data/app/assets/javascripts/Core/IndexDatatype.js +28 -0
- data/app/assets/javascripts/Core/Intersect.js +40 -0
- data/app/assets/javascripts/Core/IntersectionTests.js +359 -0
- data/app/assets/javascripts/Core/Interval.js +27 -0
- data/app/assets/javascripts/Core/Iso8601.js +46 -0
- data/app/assets/javascripts/Core/JulianDate.js +1228 -0
- data/app/assets/javascripts/Core/KeyboardEventModifier.js +38 -0
- data/app/assets/javascripts/Core/LagrangePolynomialApproximation.js +96 -0
- data/app/assets/javascripts/Core/LeapSecond.js +158 -0
- data/app/assets/javascripts/Core/LinearApproximation.js +98 -0
- data/app/assets/javascripts/Core/Math.js +532 -0
- data/app/assets/javascripts/Core/Matrix2.js +833 -0
- data/app/assets/javascripts/Core/Matrix3.js +1099 -0
- data/app/assets/javascripts/Core/Matrix4.js +2164 -0
- data/app/assets/javascripts/Core/MeshFilters.js +568 -0
- data/app/assets/javascripts/Core/Occluder.js +474 -0
- data/app/assets/javascripts/Core/OrientationInterpolator.js +109 -0
- data/app/assets/javascripts/Core/PlaneTessellator.js +74 -0
- data/app/assets/javascripts/Core/PolygonPipeline.js +792 -0
- data/app/assets/javascripts/Core/PolylinePipeline.js +90 -0
- data/app/assets/javascripts/Core/PrimitiveType.js +80 -0
- data/app/assets/javascripts/Core/QuadraticRealPolynomial.js +146 -0
- data/app/assets/javascripts/Core/QuarticRealPolynomial.js +339 -0
- data/app/assets/javascripts/Core/Quaternion.js +947 -0
- data/app/assets/javascripts/Core/Queue.js +95 -0
- data/app/assets/javascripts/Core/Ray.js +64 -0
- data/app/assets/javascripts/Core/ReferenceFrame.js +25 -0
- data/app/assets/javascripts/Core/RequestErrorEvent.js +35 -0
- data/app/assets/javascripts/Core/RuntimeError.js +59 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventHandler.js +658 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventType.js +149 -0
- data/app/assets/javascripts/Core/Shapes.js +230 -0
- data/app/assets/javascripts/Core/Spherical.js +192 -0
- data/app/assets/javascripts/Core/TaskProcessor.js +131 -0
- data/app/assets/javascripts/Core/TimeConstants.js +85 -0
- data/app/assets/javascripts/Core/TimeInterval.js +305 -0
- data/app/assets/javascripts/Core/TimeIntervalCollection.js +543 -0
- data/app/assets/javascripts/Core/TimeStandard.js +31 -0
- data/app/assets/javascripts/Core/Tipsify.js +285 -0
- data/app/assets/javascripts/Core/Transforms.js +614 -0
- data/app/assets/javascripts/Core/TridiagonalSystemSolver.js +102 -0
- data/app/assets/javascripts/Core/Visibility.js +38 -0
- data/app/assets/javascripts/Core/WebMercatorProjection.js +154 -0
- data/app/assets/javascripts/Core/WindingOrder.js +40 -0
- data/app/assets/javascripts/Core/binarySearch.js +69 -0
- data/app/assets/javascripts/Core/buildModuleUrl.js +77 -0
- data/app/assets/javascripts/Core/clone.js +21 -0
- data/app/assets/javascripts/Core/combine.js +81 -0
- data/app/assets/javascripts/Core/computeSunPosition.js +116 -0
- data/app/assets/javascripts/Core/createGuid.js +25 -0
- data/app/assets/javascripts/Core/defaultValue.js +22 -0
- data/app/assets/javascripts/Core/destroyObject.js +61 -0
- data/app/assets/javascripts/Core/freezeObject.js +20 -0
- data/app/assets/javascripts/Core/getImagePixels.js +46 -0
- data/app/assets/javascripts/Core/isLeapYear.js +30 -0
- data/app/assets/javascripts/Core/jsonp.js +116 -0
- data/app/assets/javascripts/Core/loadArrayBuffer.js +76 -0
- data/app/assets/javascripts/Core/loadImage.js +85 -0
- data/app/assets/javascripts/Core/loadJson.js +54 -0
- data/app/assets/javascripts/Core/loadText.js +78 -0
- data/app/assets/javascripts/Core/loadXML.js +76 -0
- data/app/assets/javascripts/Core/package.json +6 -0
- data/app/assets/javascripts/Core/pointInsideTriangle2D.js +41 -0
- data/app/assets/javascripts/Core/requestAnimationFrame.js +61 -0
- data/app/assets/javascripts/Core/throttleRequestByServer.js +74 -0
- data/app/assets/javascripts/Core/writeTextToCanvas.js +92 -0
- data/app/assets/javascripts/DynamicScene/CompositeDynamicObjectCollection.js +254 -0
- data/app/assets/javascripts/DynamicScene/CzmlBoolean.js +57 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian2.js +96 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartographic.js +125 -0
- data/app/assets/javascripts/DynamicScene/CzmlColor.js +127 -0
- data/app/assets/javascripts/DynamicScene/CzmlDefaults.js +135 -0
- data/app/assets/javascripts/DynamicScene/CzmlHorizontalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlImage.js +61 -0
- data/app/assets/javascripts/DynamicScene/CzmlLabelStyle.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlNumber.js +82 -0
- data/app/assets/javascripts/DynamicScene/CzmlString.js +56 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitQuaternion.js +172 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitSpherical.js +98 -0
- data/app/assets/javascripts/DynamicScene/CzmlVerticalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +245 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +347 -0
- data/app/assets/javascripts/DynamicScene/DynamicColorMaterial.js +78 -0
- data/app/assets/javascripts/DynamicScene/DynamicCone.js +291 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizer.js +350 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +389 -0
- data/app/assets/javascripts/DynamicScene/DynamicDirectionsProperty.js +163 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoid.js +158 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoidVisualizer.js +277 -0
- data/app/assets/javascripts/DynamicScene/DynamicImageMaterial.js +136 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabel.js +286 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +341 -0
- data/app/assets/javascripts/DynamicScene/DynamicMaterialProperty.js +125 -0
- data/app/assets/javascripts/DynamicScene/DynamicObject.js +364 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectCollection.js +137 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +299 -0
- data/app/assets/javascripts/DynamicScene/DynamicPath.js +214 -0
- data/app/assets/javascripts/DynamicScene/DynamicPathVisualizer.js +402 -0
- data/app/assets/javascripts/DynamicScene/DynamicPoint.js +184 -0
- data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +323 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygon.js +138 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygonVisualizer.js +251 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +183 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +268 -0
- data/app/assets/javascripts/DynamicScene/DynamicPositionProperty.js +525 -0
- data/app/assets/javascripts/DynamicScene/DynamicProperty.js +352 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramid.js +204 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramidVisualizer.js +302 -0
- data/app/assets/javascripts/DynamicScene/DynamicScene.profile.js +8 -0
- data/app/assets/javascripts/DynamicScene/DynamicVertexPositionsProperty.js +199 -0
- data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +155 -0
- data/app/assets/javascripts/DynamicScene/VisualizerCollection.js +181 -0
- data/app/assets/javascripts/DynamicScene/package.json +6 -0
- data/app/assets/javascripts/DynamicScene/processCzml.js +77 -0
- data/app/assets/javascripts/Renderer/BlendEquation.js +52 -0
- data/app/assets/javascripts/Renderer/BlendFunction.js +158 -0
- data/app/assets/javascripts/Renderer/BlendingState.js +64 -0
- data/app/assets/javascripts/Renderer/Buffer.js +141 -0
- data/app/assets/javascripts/Renderer/BufferUsage.js +48 -0
- data/app/assets/javascripts/Renderer/ClearCommand.js +40 -0
- data/app/assets/javascripts/Renderer/CommandLists.js +42 -0
- data/app/assets/javascripts/Renderer/Context.js +2805 -0
- data/app/assets/javascripts/Renderer/CubeMap.js +358 -0
- data/app/assets/javascripts/Renderer/CubeMapFace.js +202 -0
- data/app/assets/javascripts/Renderer/CullFace.js +50 -0
- data/app/assets/javascripts/Renderer/DepthFunction.js +95 -0
- data/app/assets/javascripts/Renderer/DrawCommand.js +96 -0
- data/app/assets/javascripts/Renderer/Framebuffer.js +435 -0
- data/app/assets/javascripts/Renderer/MipmapHint.js +50 -0
- data/app/assets/javascripts/Renderer/PickFramebuffer.js +178 -0
- data/app/assets/javascripts/Renderer/PixelDatatype.js +86 -0
- data/app/assets/javascripts/Renderer/PixelFormat.js +113 -0
- data/app/assets/javascripts/Renderer/Renderbuffer.js +102 -0
- data/app/assets/javascripts/Renderer/RenderbufferFormat.js +77 -0
- data/app/assets/javascripts/Renderer/Renderer.profile.js +8 -0
- data/app/assets/javascripts/Renderer/ShaderCache.js +121 -0
- data/app/assets/javascripts/Renderer/ShaderProgram.js +2402 -0
- data/app/assets/javascripts/Renderer/StencilFunction.js +95 -0
- data/app/assets/javascripts/Renderer/StencilOperation.js +95 -0
- data/app/assets/javascripts/Renderer/Texture.js +395 -0
- data/app/assets/javascripts/Renderer/TextureAtlas.js +472 -0
- data/app/assets/javascripts/Renderer/TextureAtlasBuilder.js +133 -0
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +41 -0
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +77 -0
- data/app/assets/javascripts/Renderer/TextureWrap.js +50 -0
- data/app/assets/javascripts/Renderer/UniformDatatype.js +218 -0
- data/app/assets/javascripts/Renderer/UniformState.js +799 -0
- data/app/assets/javascripts/Renderer/VertexArray.js +365 -0
- data/app/assets/javascripts/Renderer/VertexArrayFacade.js +574 -0
- data/app/assets/javascripts/Renderer/VertexLayout.js +49 -0
- data/app/assets/javascripts/Renderer/loadCubeMap.js +92 -0
- data/app/assets/javascripts/Renderer/package.json +6 -0
- data/app/assets/javascripts/Scene/AnimationCollection.js +249 -0
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +384 -0
- data/app/assets/javascripts/Scene/Billboard.js +680 -0
- data/app/assets/javascripts/Scene/BillboardCollection.js +1209 -0
- data/app/assets/javascripts/Scene/BingMapsImageryProvider.js +460 -0
- data/app/assets/javascripts/Scene/BingMapsStyle.js +55 -0
- data/app/assets/javascripts/Scene/Camera.js +358 -0
- data/app/assets/javascripts/Scene/CameraColumbusViewMode.js +30 -0
- data/app/assets/javascripts/Scene/CameraController.js +1258 -0
- data/app/assets/javascripts/Scene/CameraEventAggregator.js +270 -0
- data/app/assets/javascripts/Scene/CameraEventType.js +53 -0
- data/app/assets/javascripts/Scene/CameraFlightPath.js +495 -0
- data/app/assets/javascripts/Scene/CentralBody.js +817 -0
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1120 -0
- data/app/assets/javascripts/Scene/CentralBodySurfaceShaderSet.js +107 -0
- data/app/assets/javascripts/Scene/ComplexConicSensorVolume.js +511 -0
- data/app/assets/javascripts/Scene/CompositePrimitive.js +454 -0
- data/app/assets/javascripts/Scene/CullingVolume.js +59 -0
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +440 -0
- data/app/assets/javascripts/Scene/DiscardMissingTileImagePolicy.js +134 -0
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +412 -0
- data/app/assets/javascripts/Scene/EllipsoidTerrainProvider.js +182 -0
- data/app/assets/javascripts/Scene/FrameState.js +86 -0
- data/app/assets/javascripts/Scene/FrustumCommands.js +32 -0
- data/app/assets/javascripts/Scene/GeographicTilingScheme.js +265 -0
- data/app/assets/javascripts/Scene/HorizontalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/Imagery.js +85 -0
- data/app/assets/javascripts/Scene/ImageryLayer.js +876 -0
- data/app/assets/javascripts/Scene/ImageryLayerCollection.js +403 -0
- data/app/assets/javascripts/Scene/ImageryProvider.js +185 -0
- data/app/assets/javascripts/Scene/ImageryProviderError.js +149 -0
- data/app/assets/javascripts/Scene/ImageryState.js +20 -0
- data/app/assets/javascripts/Scene/Label.js +706 -0
- data/app/assets/javascripts/Scene/LabelCollection.js +697 -0
- data/app/assets/javascripts/Scene/LabelStyle.js +39 -0
- data/app/assets/javascripts/Scene/Material.js +1177 -0
- data/app/assets/javascripts/Scene/NeverTileDiscardPolicy.js +38 -0
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +282 -0
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +345 -0
- data/app/assets/javascripts/Scene/PerformanceDisplay.js +183 -0
- data/app/assets/javascripts/Scene/PerspectiveFrustum.js +239 -0
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +394 -0
- data/app/assets/javascripts/Scene/Polygon.js +886 -0
- data/app/assets/javascripts/Scene/Polyline.js +441 -0
- data/app/assets/javascripts/Scene/PolylineCollection.js +1532 -0
- data/app/assets/javascripts/Scene/Projections.js +93 -0
- data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +224 -0
- data/app/assets/javascripts/Scene/Scene.js +632 -0
- data/app/assets/javascripts/Scene/Scene.profile.js +8 -0
- data/app/assets/javascripts/Scene/SceneMode.js +51 -0
- data/app/assets/javascripts/Scene/SceneTransitioner.js +776 -0
- data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1063 -0
- data/app/assets/javascripts/Scene/SensorVolumeCollection.js +192 -0
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +295 -0
- data/app/assets/javascripts/Scene/SkyAtmosphere.js +239 -0
- data/app/assets/javascripts/Scene/SkyBox.js +231 -0
- data/app/assets/javascripts/Scene/TerrainProvider.js +229 -0
- data/app/assets/javascripts/Scene/TexturePool.js +154 -0
- data/app/assets/javascripts/Scene/Tile.js +322 -0
- data/app/assets/javascripts/Scene/TileDiscardPolicy.js +42 -0
- data/app/assets/javascripts/Scene/TileImagery.js +36 -0
- data/app/assets/javascripts/Scene/TileLoadQueue.js +123 -0
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +337 -0
- data/app/assets/javascripts/Scene/TileReplacementQueue.js +139 -0
- data/app/assets/javascripts/Scene/TileState.js +19 -0
- data/app/assets/javascripts/Scene/TilingScheme.js +213 -0
- data/app/assets/javascripts/Scene/VerticalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/ViewportQuad.js +256 -0
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +374 -0
- data/app/assets/javascripts/Scene/WebMercatorTilingScheme.js +291 -0
- data/app/assets/javascripts/Scene/package.json +6 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.glsl +30 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.js +31 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +68 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +54 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.glsl +927 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.js +322 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.glsl +106 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.js +82 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.glsl +20 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.js +22 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.glsl +29 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.js +28 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.glsl +88 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.js +69 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.glsl +9 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.js +13 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.glsl +12 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.js +15 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.glsl +448 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.js +361 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.glsl +19 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.js +20 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.glsl +886 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.js +586 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.glsl +126 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.js +95 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.glsl +14 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.js +18 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +40 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.js +38 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.glsl +26 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.glsl +25 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.js +23 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.glsl +42 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.js +36 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.js +27 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.js +20 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.glsl +38 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.js +32 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.js +18 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.glsl +23 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.js +24 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.glsl +12 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.js +15 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.glsl +28 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.js +21 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.glsl +13 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.glsl +14 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.js +17 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/Water.glsl +91 -0
- data/app/assets/javascripts/Shaders/Materials/Water.js +60 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.glsl +36 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.js +31 -0
- data/app/assets/javascripts/Shaders/Noise.glsl +453 -0
- data/app/assets/javascripts/Shaders/Noise.js +242 -0
- data/app/assets/javascripts/Shaders/PolygonFS.glsl +27 -0
- data/app/assets/javascripts/Shaders/PolygonFS.js +23 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.js +11 -0
- data/app/assets/javascripts/Shaders/PolygonVS.glsl +38 -0
- data/app/assets/javascripts/Shaders/PolygonVS.js +39 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.glsl +30 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.js +32 -0
- data/app/assets/javascripts/Shaders/PolylineFS.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolylineFS.js +11 -0
- data/app/assets/javascripts/Shaders/PolylineVS.glsl +34 -0
- data/app/assets/javascripts/Shaders/PolylineVS.js +35 -0
- data/app/assets/javascripts/Shaders/Ray.glsl +532 -0
- data/app/assets/javascripts/Shaders/Ray.js +357 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.glsl +26 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.js +22 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.glsl +11 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.js +14 -0
- data/app/assets/javascripts/Shaders/SensorVolume.glsl +43 -0
- data/app/assets/javascripts/Shaders/SensorVolume.js +31 -0
- data/app/assets/javascripts/Shaders/Shaders.profile.js +8 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.glsl +70 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.js +62 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.glsl +131 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.js +115 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.js +14 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.js +14 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.glsl +16 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.js +17 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.js +14 -0
- data/app/assets/javascripts/Shaders/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/ThirdParty.profile.js +8 -0
- data/app/assets/javascripts/ThirdParty/Tween.js +678 -0
- data/app/assets/javascripts/ThirdParty/Uri.js +277 -0
- data/app/assets/javascripts/ThirdParty/measureText.js +197 -0
- data/app/assets/javascripts/ThirdParty/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/sprintf.js +319 -0
- data/app/assets/javascripts/ThirdParty/when.js +748 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.css +175 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.html +52 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.js +1237 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.html +4 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.js +349 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.css +1 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.js +47 -0
- data/app/assets/javascripts/Widgets/Dojo/checkForChromeFrame.js +71 -0
- data/app/assets/javascripts/Widgets/Images/Bing_Logo_51x19_White.png +0 -0
- data/app/assets/javascripts/Widgets/Images/Cesium_Logo_overlay.png +0 -0
- data/app/assets/javascripts/Widgets/Images/TimelineIcons.png +0 -0
- data/app/assets/javascripts/Widgets/Images/ajax-loader.gif +0 -0
- data/app/assets/javascripts/Widgets/Images/animationBar.png +0 -0
- data/app/assets/javascripts/Widgets/Images/viewControlBar.png +0 -0
- data/app/assets/javascripts/Widgets/Timeline.css +113 -0
- data/app/assets/javascripts/Widgets/Timeline.js +629 -0
- data/app/assets/javascripts/Widgets/TimelineHighlightRange.js +51 -0
- data/app/assets/javascripts/Widgets/TimelineTrack.js +54 -0
- data/app/assets/javascripts/Widgets/Widgets.profile.js +8 -0
- data/app/assets/javascripts/Widgets/package.json +6 -0
- data/app/assets/javascripts/Workers/Workers.profile.js +8 -0
- data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +2015 -0
- data/app/assets/javascripts/Workers/createTaskProcessorWorker.js +55 -0
- data/app/assets/javascripts/Workers/createVerticesFromExtent.js +24 -0
- data/app/assets/javascripts/Workers/package.json +6 -0
- data/app/assets/javascripts/copyrightHeader.js +22 -0
- data/app/assets/javascripts/main.js +10 -0
- data/app/assets/stylesheets/cesium.css +4 -0
- data/app/controllers/cesium_controller.rb +4 -0
- data/app/helpers/cesium_helper.rb +2 -0
- data/app/views/cesium/index.html.erb +3 -0
- data/config/routes.rb +3 -0
- data/lib/cesium.rb +4 -0
- data/lib/cesium/engine.rb +4 -0
- data/lib/cesium/version.rb +3 -0
- data/lib/tasks/cesium_tasks.rake +4 -0
- data/test/cesium_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/adapters/jquery-adapter.js.coffee +4 -0
- data/test/dummy/app/assets/javascripts/app.js.coffee +11 -0
- data/test/dummy/app/assets/javascripts/application.js.coffee +73 -0
- data/test/dummy/app/assets/stylesheets/application.css +12 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +21 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/requirejs.yml +10 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/functional/cesium_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/cesium_helper_test.rb +4 -0
- metadata +641 -0
@@ -0,0 +1,947 @@
|
|
1
|
+
/*global define*/
|
2
|
+
define([
|
3
|
+
'./Cartesian3',
|
4
|
+
'./defaultValue',
|
5
|
+
'./DeveloperError',
|
6
|
+
'./freezeObject',
|
7
|
+
'./Math',
|
8
|
+
'./Matrix3'
|
9
|
+
], function(
|
10
|
+
Cartesian3,
|
11
|
+
defaultValue,
|
12
|
+
DeveloperError,
|
13
|
+
freezeObject,
|
14
|
+
CesiumMath,
|
15
|
+
Matrix3) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
/**
|
19
|
+
* A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
|
20
|
+
* @alias Quaternion
|
21
|
+
* @constructor
|
22
|
+
*
|
23
|
+
* @param {Number} [x=0.0] The X component.
|
24
|
+
* @param {Number} [y=0.0] The Y component.
|
25
|
+
* @param {Number} [z=0.0] The Z component.
|
26
|
+
* @param {Number} [w=0.0] The W component.
|
27
|
+
*/
|
28
|
+
var Quaternion = function(x, y, z, w) {
|
29
|
+
/**
|
30
|
+
* The X component.
|
31
|
+
* @type Number
|
32
|
+
*/
|
33
|
+
this.x = defaultValue(x, 0.0);
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The Y component.
|
37
|
+
* @type Number
|
38
|
+
*/
|
39
|
+
this.y = defaultValue(y, 0.0);
|
40
|
+
|
41
|
+
/**
|
42
|
+
* The Z component.
|
43
|
+
* @type Number
|
44
|
+
*/
|
45
|
+
this.z = defaultValue(z, 0.0);
|
46
|
+
|
47
|
+
/**
|
48
|
+
* The W component.
|
49
|
+
* @type Number
|
50
|
+
*/
|
51
|
+
this.w = defaultValue(w, 0.0);
|
52
|
+
};
|
53
|
+
|
54
|
+
var fromAxisAngleScratch;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Computes a quaternion representing a rotation around an axis.
|
58
|
+
* @memberof Quaternion
|
59
|
+
*
|
60
|
+
* @param {Cartesian3} axis The axis of rotation.
|
61
|
+
* @param {Number} angle The angle in radians to rotate around the axis.
|
62
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
63
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
64
|
+
*
|
65
|
+
* @exception {DeveloperError} axis is required.
|
66
|
+
* @exception {DeveloperError} angle is required and must be a number.
|
67
|
+
*/
|
68
|
+
Quaternion.fromAxisAngle = function(axis, angle, result) {
|
69
|
+
if (typeof axis === 'undefined') {
|
70
|
+
throw new DeveloperError('axis is required.');
|
71
|
+
}
|
72
|
+
if (typeof angle !== 'number') {
|
73
|
+
throw new DeveloperError('angle is required and must be a number.');
|
74
|
+
}
|
75
|
+
|
76
|
+
var halfAngle = angle / 2.0;
|
77
|
+
var s = Math.sin(halfAngle);
|
78
|
+
fromAxisAngleScratch = Cartesian3.normalize(axis, fromAxisAngleScratch);
|
79
|
+
|
80
|
+
var x = fromAxisAngleScratch.x * s;
|
81
|
+
var y = fromAxisAngleScratch.y * s;
|
82
|
+
var z = fromAxisAngleScratch.z * s;
|
83
|
+
var w = Math.cos(halfAngle);
|
84
|
+
if (typeof result === 'undefined') {
|
85
|
+
return new Quaternion(x, y, z, w);
|
86
|
+
}
|
87
|
+
result.x = x;
|
88
|
+
result.y = y;
|
89
|
+
result.z = z;
|
90
|
+
result.w = w;
|
91
|
+
return result;
|
92
|
+
};
|
93
|
+
|
94
|
+
var fromRotationMatrixNext = [1, 2, 0];
|
95
|
+
var fromRotationMatrixQuat = new Array(3);
|
96
|
+
/**
|
97
|
+
* Computes a Quaternion from the provided Matrix3 instance.
|
98
|
+
* @memberof Quaternion
|
99
|
+
*
|
100
|
+
* @param {Matrix3} matrix The rotation matrix.
|
101
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
102
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
103
|
+
*
|
104
|
+
* @exception {DeveloperError} matrix is required.
|
105
|
+
*
|
106
|
+
* @see Matrix3.fromQuaternion
|
107
|
+
*/
|
108
|
+
Quaternion.fromRotationMatrix = function(matrix, result) {
|
109
|
+
if (typeof matrix === 'undefined') {
|
110
|
+
throw new DeveloperError('matrix is required.');
|
111
|
+
}
|
112
|
+
|
113
|
+
var root;
|
114
|
+
var x;
|
115
|
+
var y;
|
116
|
+
var z;
|
117
|
+
var w;
|
118
|
+
|
119
|
+
var m00 = matrix[Matrix3.COLUMN0ROW0];
|
120
|
+
var m11 = matrix[Matrix3.COLUMN1ROW1];
|
121
|
+
var m22 = matrix[Matrix3.COLUMN2ROW2];
|
122
|
+
var trace = m00 + m11 + m22;
|
123
|
+
|
124
|
+
if (trace > 0.0) {
|
125
|
+
// |w| > 1/2, may as well choose w > 1/2
|
126
|
+
root = Math.sqrt(trace + 1.0); // 2w
|
127
|
+
w = 0.5 * root;
|
128
|
+
root = 0.5 / root; // 1/(4w)
|
129
|
+
|
130
|
+
x = (matrix[Matrix3.COLUMN2ROW1] - matrix[Matrix3.COLUMN1ROW2]) * root;
|
131
|
+
y = (matrix[Matrix3.COLUMN0ROW2] - matrix[Matrix3.COLUMN2ROW0]) * root;
|
132
|
+
z = (matrix[Matrix3.COLUMN1ROW0] - matrix[Matrix3.COLUMN0ROW1]) * root;
|
133
|
+
} else {
|
134
|
+
// |w| <= 1/2
|
135
|
+
var next = fromRotationMatrixNext;
|
136
|
+
|
137
|
+
var i = 0;
|
138
|
+
if (m11 > m00) {
|
139
|
+
i = 1;
|
140
|
+
}
|
141
|
+
if (m22 > m00 && m22 > m11) {
|
142
|
+
i = 2;
|
143
|
+
}
|
144
|
+
var j = next[i];
|
145
|
+
var k = next[j];
|
146
|
+
|
147
|
+
root = Math.sqrt(matrix[Matrix3.getElementIndex(i, i)] - matrix[Matrix3.getElementIndex(j, j)] - matrix[Matrix3.getElementIndex(k, k)] + 1.0);
|
148
|
+
|
149
|
+
var quat = fromRotationMatrixQuat;
|
150
|
+
quat[i] = 0.5 * root;
|
151
|
+
root = 0.5 / root;
|
152
|
+
w = (matrix[Matrix3.getElementIndex(k, j)] - matrix[Matrix3.getElementIndex(j, k)]) * root;
|
153
|
+
quat[j] = (matrix[Matrix3.getElementIndex(j, i)] + matrix[Matrix3.getElementIndex(i, j)]) * root;
|
154
|
+
quat[k] = (matrix[Matrix3.getElementIndex(k, i)] + matrix[Matrix3.getElementIndex(i, k)]) * root;
|
155
|
+
|
156
|
+
x = quat[0];
|
157
|
+
y = quat[1];
|
158
|
+
z = quat[2];
|
159
|
+
}
|
160
|
+
|
161
|
+
if (typeof result === 'undefined') {
|
162
|
+
return new Quaternion(x, y, z, w);
|
163
|
+
}
|
164
|
+
result.x = x;
|
165
|
+
result.y = y;
|
166
|
+
result.z = z;
|
167
|
+
result.w = w;
|
168
|
+
return result;
|
169
|
+
};
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Duplicates a Quaternion instance.
|
173
|
+
* @memberof Quaternion
|
174
|
+
*
|
175
|
+
* @param {Quaternion} quaternion The quaternion to duplicate.
|
176
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
177
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
178
|
+
*
|
179
|
+
* @exception {DeveloperError} quaternion is required.
|
180
|
+
*/
|
181
|
+
Quaternion.clone = function(quaternion, result) {
|
182
|
+
if (typeof quaternion === 'undefined') {
|
183
|
+
throw new DeveloperError('quaternion is required');
|
184
|
+
}
|
185
|
+
|
186
|
+
if (typeof result === 'undefined') {
|
187
|
+
return new Quaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
|
188
|
+
}
|
189
|
+
|
190
|
+
result.x = quaternion.x;
|
191
|
+
result.y = quaternion.y;
|
192
|
+
result.z = quaternion.z;
|
193
|
+
result.w = quaternion.w;
|
194
|
+
return result;
|
195
|
+
};
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Computes the conjugate of the provided quaternion.
|
199
|
+
* @memberof Quaternion
|
200
|
+
*
|
201
|
+
* @param {Quaternion} quaternion The quaternion to conjugate.
|
202
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
203
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
204
|
+
*
|
205
|
+
* @exception {DeveloperError} quaternion is required.
|
206
|
+
*/
|
207
|
+
Quaternion.conjugate = function(quaternion, result) {
|
208
|
+
if (typeof quaternion === 'undefined') {
|
209
|
+
throw new DeveloperError('quaternion is required');
|
210
|
+
}
|
211
|
+
if (typeof result === 'undefined') {
|
212
|
+
return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w);
|
213
|
+
}
|
214
|
+
result.x = -quaternion.x;
|
215
|
+
result.y = -quaternion.y;
|
216
|
+
result.z = -quaternion.z;
|
217
|
+
result.w = quaternion.w;
|
218
|
+
return result;
|
219
|
+
};
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Computes magnitude squared for the provided quaternion.
|
223
|
+
* @memberof Quaternion
|
224
|
+
*
|
225
|
+
* @param {Quaternion} quaternion The quaternion to conjugate.
|
226
|
+
* @return {Number} The magnitude squared.
|
227
|
+
*
|
228
|
+
* @exception {DeveloperError} quaternion is required.
|
229
|
+
*/
|
230
|
+
Quaternion.magnitudeSquared = function(quaternion) {
|
231
|
+
if (typeof quaternion === 'undefined') {
|
232
|
+
throw new DeveloperError('quaternion is required');
|
233
|
+
}
|
234
|
+
return quaternion.x * quaternion.x + quaternion.y * quaternion.y + quaternion.z * quaternion.z + quaternion.w * quaternion.w;
|
235
|
+
};
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Computes magnitude for the provided quaternion.
|
239
|
+
* @memberof Quaternion
|
240
|
+
*
|
241
|
+
* @param {Quaternion} quaternion The quaternion to conjugate.
|
242
|
+
* @return {Number} The magnitude.
|
243
|
+
*
|
244
|
+
* @exception {DeveloperError} quaternion is required.
|
245
|
+
*/
|
246
|
+
Quaternion.magnitude = function(quaternion) {
|
247
|
+
if (typeof quaternion === 'undefined') {
|
248
|
+
throw new DeveloperError('quaternion is required');
|
249
|
+
}
|
250
|
+
return Math.sqrt(Quaternion.magnitudeSquared(quaternion));
|
251
|
+
};
|
252
|
+
|
253
|
+
/**
|
254
|
+
* Computes the normalized form of the provided quaternion.
|
255
|
+
* @memberof Quaternion
|
256
|
+
*
|
257
|
+
* @param {Quaternion} quaternion The quaternion to normalize.
|
258
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
259
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
260
|
+
*
|
261
|
+
* @exception {DeveloperError} quaternion is required.
|
262
|
+
*/
|
263
|
+
Quaternion.normalize = function(quaternion, result) {
|
264
|
+
var inverseMagnitude = 1.0 / Quaternion.magnitude(quaternion);
|
265
|
+
var x = quaternion.x * inverseMagnitude;
|
266
|
+
var y = quaternion.y * inverseMagnitude;
|
267
|
+
var z = quaternion.z * inverseMagnitude;
|
268
|
+
var w = quaternion.w * inverseMagnitude;
|
269
|
+
|
270
|
+
if (typeof result === 'undefined') {
|
271
|
+
return new Quaternion(x, y, z, w);
|
272
|
+
}
|
273
|
+
result.x = x;
|
274
|
+
result.y = y;
|
275
|
+
result.z = z;
|
276
|
+
result.w = w;
|
277
|
+
return result;
|
278
|
+
};
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Computes the inverse of the provided quaternion.
|
282
|
+
* @memberof Quaternion
|
283
|
+
*
|
284
|
+
* @param {Quaternion} quaternion The quaternion to normalize.
|
285
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
286
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
287
|
+
*
|
288
|
+
* @exception {DeveloperError} quaternion is required.
|
289
|
+
*/
|
290
|
+
Quaternion.inverse = function(quaternion, result) {
|
291
|
+
var magnitudeSquared = Quaternion.magnitudeSquared(quaternion);
|
292
|
+
result = Quaternion.conjugate(quaternion, result);
|
293
|
+
return Quaternion.multiplyByScalar(result, 1.0 / magnitudeSquared, result);
|
294
|
+
};
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Computes the componentwise sum of two quaternions.
|
298
|
+
* @memberof Quaternion
|
299
|
+
*
|
300
|
+
* @param {Quaternion} left The first quaternion.
|
301
|
+
* @param {Quaternion} right The second quaternion.
|
302
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
303
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
304
|
+
*
|
305
|
+
* @exception {DeveloperError} left is required.
|
306
|
+
* @exception {DeveloperError} right is required.
|
307
|
+
*/
|
308
|
+
Quaternion.add = function(left, right, result) {
|
309
|
+
if (typeof left === 'undefined') {
|
310
|
+
throw new DeveloperError('left is required');
|
311
|
+
}
|
312
|
+
if (typeof right === 'undefined') {
|
313
|
+
throw new DeveloperError('right is required');
|
314
|
+
}
|
315
|
+
if (typeof result === 'undefined') {
|
316
|
+
return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
|
317
|
+
}
|
318
|
+
result.x = left.x + right.x;
|
319
|
+
result.y = left.y + right.y;
|
320
|
+
result.z = left.z + right.z;
|
321
|
+
result.w = left.w + right.w;
|
322
|
+
return result;
|
323
|
+
};
|
324
|
+
|
325
|
+
/**
|
326
|
+
* Computes the componentwise difference of two quaternions.
|
327
|
+
* @memberof Quaternion
|
328
|
+
*
|
329
|
+
* @param {Quaternion} left The first quaternion.
|
330
|
+
* @param {Quaternion} right The second quaternion.
|
331
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
332
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
333
|
+
*
|
334
|
+
* @exception {DeveloperError} left is required.
|
335
|
+
* @exception {DeveloperError} right is required.
|
336
|
+
*/
|
337
|
+
Quaternion.subtract = function(left, right, result) {
|
338
|
+
if (typeof left === 'undefined') {
|
339
|
+
throw new DeveloperError('left is required');
|
340
|
+
}
|
341
|
+
if (typeof right === 'undefined') {
|
342
|
+
throw new DeveloperError('right is required');
|
343
|
+
}
|
344
|
+
if (typeof result === 'undefined') {
|
345
|
+
return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
|
346
|
+
}
|
347
|
+
result.x = left.x - right.x;
|
348
|
+
result.y = left.y - right.y;
|
349
|
+
result.z = left.z - right.z;
|
350
|
+
result.w = left.w - right.w;
|
351
|
+
return result;
|
352
|
+
};
|
353
|
+
|
354
|
+
/**
|
355
|
+
* Negates the provided quaternion.
|
356
|
+
* @memberof Quaternion
|
357
|
+
*
|
358
|
+
* @param {Quaternion} quaternion The quaternion to be negated.
|
359
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
360
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
361
|
+
*
|
362
|
+
* @exception {DeveloperError} quaternion is required.
|
363
|
+
*/
|
364
|
+
Quaternion.negate = function(quaternion, result) {
|
365
|
+
if (typeof quaternion === 'undefined') {
|
366
|
+
throw new DeveloperError('quaternion is required');
|
367
|
+
}
|
368
|
+
if (typeof result === 'undefined') {
|
369
|
+
return new Quaternion(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
|
370
|
+
}
|
371
|
+
result.x = -quaternion.x;
|
372
|
+
result.y = -quaternion.y;
|
373
|
+
result.z = -quaternion.z;
|
374
|
+
result.w = -quaternion.w;
|
375
|
+
return result;
|
376
|
+
};
|
377
|
+
|
378
|
+
/**
|
379
|
+
* Computes the dot (scalar) product of two quaternions.
|
380
|
+
* @memberof Quaternion
|
381
|
+
*
|
382
|
+
* @param {Quaternion} left The first quaternion.
|
383
|
+
* @param {Quaternion} right The second quaternion.
|
384
|
+
* @return {Number} The dot product.
|
385
|
+
*
|
386
|
+
* @exception {DeveloperError} left is required.
|
387
|
+
* @exception {DeveloperError} right is required.
|
388
|
+
*/
|
389
|
+
Quaternion.dot = function(left, right) {
|
390
|
+
if (typeof left === 'undefined') {
|
391
|
+
throw new DeveloperError('left is required');
|
392
|
+
}
|
393
|
+
if (typeof right === 'undefined') {
|
394
|
+
throw new DeveloperError('right is required');
|
395
|
+
}
|
396
|
+
return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
|
397
|
+
};
|
398
|
+
|
399
|
+
|
400
|
+
/**
|
401
|
+
* Computes the product of two quaternions.
|
402
|
+
* @memberof Quaternion
|
403
|
+
*
|
404
|
+
* @param {Quaternion} left The first quaternion.
|
405
|
+
* @param {Quaternion} right The second quaternion.
|
406
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
407
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
408
|
+
*
|
409
|
+
* @exception {DeveloperError} left is required.
|
410
|
+
* @exception {DeveloperError} right is required.
|
411
|
+
*/
|
412
|
+
Quaternion.multiply = function(left, right, result) {
|
413
|
+
if (typeof left === 'undefined') {
|
414
|
+
throw new DeveloperError('left is required');
|
415
|
+
}
|
416
|
+
if (typeof right === 'undefined') {
|
417
|
+
throw new DeveloperError('right is required');
|
418
|
+
}
|
419
|
+
var leftX = left.x;
|
420
|
+
var leftY = left.y;
|
421
|
+
var leftZ = left.z;
|
422
|
+
var leftW = left.w;
|
423
|
+
|
424
|
+
var rightX = right.x;
|
425
|
+
var rightY = right.y;
|
426
|
+
var rightZ = right.z;
|
427
|
+
var rightW = right.w;
|
428
|
+
|
429
|
+
var x = leftW * rightX + leftX * rightW + leftY * rightZ - leftZ * rightY;
|
430
|
+
var y = leftW * rightY - leftX * rightZ + leftY * rightW + leftZ * rightX;
|
431
|
+
var z = leftW * rightZ + leftX * rightY - leftY * rightX + leftZ * rightW;
|
432
|
+
var w = leftW * rightW - leftX * rightX - leftY * rightY - leftZ * rightZ;
|
433
|
+
|
434
|
+
if (typeof result === 'undefined') {
|
435
|
+
return new Quaternion(x, y, z, w);
|
436
|
+
}
|
437
|
+
result.x = x;
|
438
|
+
result.y = y;
|
439
|
+
result.z = z;
|
440
|
+
result.w = w;
|
441
|
+
return result;
|
442
|
+
};
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Multiplies the provided quaternion componentwise by the provided scalar.
|
446
|
+
* @memberof Quaternion
|
447
|
+
*
|
448
|
+
* @param {Quaternion} quaternion The quaternion to be scaled.
|
449
|
+
* @param {Number} scalar The scalar to multiply with.
|
450
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
451
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
452
|
+
*
|
453
|
+
* @exception {DeveloperError} quaternion is required.
|
454
|
+
* @exception {DeveloperError} scalar is required and must be a number.
|
455
|
+
*/
|
456
|
+
Quaternion.multiplyByScalar = function(quaternion, scalar, result) {
|
457
|
+
if (typeof quaternion === 'undefined') {
|
458
|
+
throw new DeveloperError('quaternion is required');
|
459
|
+
}
|
460
|
+
if (typeof scalar !== 'number') {
|
461
|
+
throw new DeveloperError('scalar is required and must be a number.');
|
462
|
+
}
|
463
|
+
if (typeof result === 'undefined') {
|
464
|
+
return new Quaternion(quaternion.x * scalar, quaternion.y * scalar, quaternion.z * scalar, quaternion.w * scalar);
|
465
|
+
}
|
466
|
+
result.x = quaternion.x * scalar;
|
467
|
+
result.y = quaternion.y * scalar;
|
468
|
+
result.z = quaternion.z * scalar;
|
469
|
+
result.w = quaternion.w * scalar;
|
470
|
+
return result;
|
471
|
+
};
|
472
|
+
|
473
|
+
/**
|
474
|
+
* Divides the provided quaternion componentwise by the provided scalar.
|
475
|
+
* @memberof Quaternion
|
476
|
+
*
|
477
|
+
* @param {Quaternion} quaternion The quaternion to be divided.
|
478
|
+
* @param {Number} scalar The scalar to divide by.
|
479
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
480
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
481
|
+
*
|
482
|
+
* @exception {DeveloperError} quaternion is required.
|
483
|
+
* @exception {DeveloperError} scalar is required and must be a number.
|
484
|
+
*/
|
485
|
+
Quaternion.divideByScalar = function(quaternion, scalar, result) {
|
486
|
+
if (typeof quaternion === 'undefined') {
|
487
|
+
throw new DeveloperError('quaternion is required');
|
488
|
+
}
|
489
|
+
if (typeof scalar !== 'number') {
|
490
|
+
throw new DeveloperError('scalar is required and must be a number.');
|
491
|
+
}
|
492
|
+
if (typeof result === 'undefined') {
|
493
|
+
return new Quaternion(quaternion.x / scalar, quaternion.y / scalar, quaternion.z / scalar, quaternion.w / scalar);
|
494
|
+
}
|
495
|
+
result.x = quaternion.x / scalar;
|
496
|
+
result.y = quaternion.y / scalar;
|
497
|
+
result.z = quaternion.z / scalar;
|
498
|
+
result.w = quaternion.w / scalar;
|
499
|
+
return result;
|
500
|
+
};
|
501
|
+
|
502
|
+
/**
|
503
|
+
* Computes the axis of rotation of the provided quaternion.
|
504
|
+
* @memberof Quaternion
|
505
|
+
*
|
506
|
+
* @param {Quaternion} quaternion The quaternion to use.
|
507
|
+
* @param {Cartesian3} [result] The object onto which to store the result.
|
508
|
+
* @return {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
509
|
+
*
|
510
|
+
* @exception {DeveloperError} quaternion is required.
|
511
|
+
*/
|
512
|
+
Quaternion.getAxis = function(quaternion, result) {
|
513
|
+
if (typeof quaternion === 'undefined') {
|
514
|
+
throw new DeveloperError('quaternion is required');
|
515
|
+
}
|
516
|
+
|
517
|
+
var w = quaternion.w;
|
518
|
+
if (Math.abs(w - 1.0) < CesiumMath.EPSILON6) {
|
519
|
+
if (typeof result === 'undefined') {
|
520
|
+
return new Cartesian3(0.0, 0.0, 0.0);
|
521
|
+
}
|
522
|
+
result.x = result.y = result.z = 0;
|
523
|
+
return result;
|
524
|
+
}
|
525
|
+
|
526
|
+
var scalar = 1.0 / Math.sqrt(1.0 - (w * w));
|
527
|
+
if (typeof result === 'undefined') {
|
528
|
+
return new Cartesian3(quaternion.x * scalar, quaternion.y * scalar, quaternion.z * scalar);
|
529
|
+
}
|
530
|
+
result.x = quaternion.x * scalar;
|
531
|
+
result.y = quaternion.y * scalar;
|
532
|
+
result.z = quaternion.z * scalar;
|
533
|
+
return result;
|
534
|
+
};
|
535
|
+
|
536
|
+
/**
|
537
|
+
* Computes the angle of rotation of the provided quaternion.
|
538
|
+
* @memberof Quaternion
|
539
|
+
*
|
540
|
+
* @param {Quaternion} quaternion The quaternion to use.
|
541
|
+
* @return {Number} The angle of rotation.
|
542
|
+
*
|
543
|
+
* @exception {DeveloperError} quaternion is required.
|
544
|
+
*/
|
545
|
+
Quaternion.getAngle = function(quaternion) {
|
546
|
+
if (typeof quaternion === 'undefined') {
|
547
|
+
throw new DeveloperError('quaternion is required');
|
548
|
+
}
|
549
|
+
|
550
|
+
if (Math.abs(quaternion.w - 1.0) < CesiumMath.EPSILON6) {
|
551
|
+
return 0.0;
|
552
|
+
}
|
553
|
+
return 2.0 * Math.acos(quaternion.w);
|
554
|
+
};
|
555
|
+
|
556
|
+
var lerpScratch;
|
557
|
+
/**
|
558
|
+
* Computes the linear interpolation or extrapolation at t using the provided quaternions.
|
559
|
+
* @memberof Quaternion
|
560
|
+
*
|
561
|
+
* @param start The value corresponding to t at 0.0.
|
562
|
+
* @param end The value corresponding to t at 1.0.
|
563
|
+
* @param t The point along t at which to interpolate.
|
564
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
565
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
566
|
+
*
|
567
|
+
* @exception {DeveloperError} start is required.
|
568
|
+
* @exception {DeveloperError} end is required.
|
569
|
+
* @exception {DeveloperError} t is required and must be a number.
|
570
|
+
*/
|
571
|
+
Quaternion.lerp = function(start, end, t, result) {
|
572
|
+
if (typeof start === 'undefined') {
|
573
|
+
throw new DeveloperError('start is required.');
|
574
|
+
}
|
575
|
+
if (typeof end === 'undefined') {
|
576
|
+
throw new DeveloperError('end is required.');
|
577
|
+
}
|
578
|
+
if (typeof t !== 'number') {
|
579
|
+
throw new DeveloperError('t is required and must be a number.');
|
580
|
+
}
|
581
|
+
lerpScratch = Quaternion.multiplyByScalar(end, t, lerpScratch);
|
582
|
+
result = Quaternion.multiplyByScalar(start, 1.0 - t, result);
|
583
|
+
return Quaternion.add(lerpScratch, result, result);
|
584
|
+
};
|
585
|
+
|
586
|
+
var slerpEndNegated;
|
587
|
+
var slerpScaledP;
|
588
|
+
var slerpScaledR;
|
589
|
+
/**
|
590
|
+
* Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
|
591
|
+
* @memberof Quaternion
|
592
|
+
*
|
593
|
+
* @param start The value corresponding to t at 0.0.
|
594
|
+
* @param end The value corresponding to t at 1.0.
|
595
|
+
* @param t The point along t at which to interpolate.
|
596
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
597
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
598
|
+
*
|
599
|
+
* @exception {DeveloperError} start is required.
|
600
|
+
* @exception {DeveloperError} end is required.
|
601
|
+
* @exception {DeveloperError} t is required and must be a number.
|
602
|
+
*/
|
603
|
+
Quaternion.slerp = function(start, end, t, result) {
|
604
|
+
if (typeof start === 'undefined') {
|
605
|
+
throw new DeveloperError('start is required.');
|
606
|
+
}
|
607
|
+
if (typeof end === 'undefined') {
|
608
|
+
throw new DeveloperError('end is required.');
|
609
|
+
}
|
610
|
+
if (typeof t !== 'number') {
|
611
|
+
throw new DeveloperError('t is required and must be a number.');
|
612
|
+
}
|
613
|
+
|
614
|
+
var dot = Quaternion.dot(start, end);
|
615
|
+
|
616
|
+
// The angle between start must be acute. Since q and -q represent
|
617
|
+
// the same rotation, negate q to get the acute angle.
|
618
|
+
var r = end;
|
619
|
+
if (dot < 0.0) {
|
620
|
+
dot = -dot;
|
621
|
+
r = slerpEndNegated = Quaternion.negate(end, slerpEndNegated);
|
622
|
+
}
|
623
|
+
|
624
|
+
// dot > 0, as the dot product approaches 1, the angle between the
|
625
|
+
// quaternions vanishes. use linear interpolation.
|
626
|
+
if (1.0 - dot < CesiumMath.EPSILON6) {
|
627
|
+
return Quaternion.lerp(start, r, t);
|
628
|
+
}
|
629
|
+
|
630
|
+
var theta = Math.acos(dot);
|
631
|
+
slerpScaledP = Quaternion.multiplyByScalar(start, Math.sin((1 - t) * theta), slerpScaledP);
|
632
|
+
slerpScaledR = Quaternion.multiplyByScalar(r, Math.sin(t * theta), slerpScaledR);
|
633
|
+
result = Quaternion.add(slerpScaledP, slerpScaledR, result);
|
634
|
+
return Quaternion.multiplyByScalar(result, 1.0 / Math.sin(theta), result);
|
635
|
+
};
|
636
|
+
|
637
|
+
/**
|
638
|
+
* Compares the provided quaternions componentwise and returns
|
639
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
640
|
+
* @memberof Quaternion
|
641
|
+
*
|
642
|
+
* @param {Quaternion} [left] The first quaternion.
|
643
|
+
* @param {Quaternion} [right] The second quaternion.
|
644
|
+
* @return {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
645
|
+
*/
|
646
|
+
Quaternion.equals = function(left, right) {
|
647
|
+
return (left === right) ||
|
648
|
+
((typeof left !== 'undefined') &&
|
649
|
+
(typeof right !== 'undefined') &&
|
650
|
+
(left.x === right.x) &&
|
651
|
+
(left.y === right.y) &&
|
652
|
+
(left.z === right.z) &&
|
653
|
+
(left.w === right.w));
|
654
|
+
};
|
655
|
+
|
656
|
+
/**
|
657
|
+
* Compares the provided quaternions componentwise and returns
|
658
|
+
* <code>true</code> if they are within the provided epsilon,
|
659
|
+
* <code>false</code> otherwise.
|
660
|
+
* @memberof Quaternion
|
661
|
+
*
|
662
|
+
* @param {Quaternion} [left] The first quaternion.
|
663
|
+
* @param {Quaternion} [right] The second quaternion.
|
664
|
+
* @param {Number} epsilon The epsilon to use for equality testing.
|
665
|
+
* @return {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
666
|
+
*
|
667
|
+
* @exception {DeveloperError} epsilon is required and must be a number.
|
668
|
+
*/
|
669
|
+
Quaternion.equalsEpsilon = function(left, right, epsilon) {
|
670
|
+
if (typeof epsilon !== 'number') {
|
671
|
+
throw new DeveloperError('epsilon is required and must be a number.');
|
672
|
+
}
|
673
|
+
return (left === right) ||
|
674
|
+
((typeof left !== 'undefined') &&
|
675
|
+
(typeof right !== 'undefined') &&
|
676
|
+
(Math.abs(left.x - right.x) <= epsilon) &&
|
677
|
+
(Math.abs(left.y - right.y) <= epsilon) &&
|
678
|
+
(Math.abs(left.z - right.z) <= epsilon) &&
|
679
|
+
(Math.abs(left.w - right.w) <= epsilon));
|
680
|
+
};
|
681
|
+
|
682
|
+
/**
|
683
|
+
* An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).
|
684
|
+
* @memberof Quaternion
|
685
|
+
*/
|
686
|
+
Quaternion.ZERO = freezeObject(new Quaternion(0.0, 0.0, 0.0, 0.0));
|
687
|
+
|
688
|
+
/**
|
689
|
+
* An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 1.0).
|
690
|
+
* @memberof Quaternion
|
691
|
+
*/
|
692
|
+
Quaternion.IDENTITY = freezeObject(new Quaternion(0.0, 0.0, 0.0, 1.0));
|
693
|
+
|
694
|
+
/**
|
695
|
+
* Duplicates this Quaternion instance.
|
696
|
+
* @memberof Quaternion
|
697
|
+
*
|
698
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
699
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
700
|
+
*/
|
701
|
+
Quaternion.prototype.clone = function(result) {
|
702
|
+
return Quaternion.clone(this, result);
|
703
|
+
};
|
704
|
+
|
705
|
+
/**
|
706
|
+
* Computes the conjugate of this quaternion.
|
707
|
+
* @memberof Quaternion
|
708
|
+
*
|
709
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
710
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
711
|
+
*/
|
712
|
+
Quaternion.prototype.conjugate = function(result) {
|
713
|
+
return Quaternion.conjugate(this, result);
|
714
|
+
};
|
715
|
+
|
716
|
+
/**
|
717
|
+
* Computes magnitude squared for this quaternion.
|
718
|
+
* @memberof Quaternion
|
719
|
+
*
|
720
|
+
* @return {Number} The magnitude squared.
|
721
|
+
*/
|
722
|
+
Quaternion.prototype.magnitudeSquared = function() {
|
723
|
+
return Quaternion.magnitudeSquared(this);
|
724
|
+
};
|
725
|
+
|
726
|
+
/**
|
727
|
+
* Computes magnitude for this quaternion.
|
728
|
+
* @memberof Quaternion
|
729
|
+
*
|
730
|
+
* @return {Number} The magnitude.
|
731
|
+
*/
|
732
|
+
Quaternion.prototype.magnitude = function() {
|
733
|
+
return Quaternion.magnitude(this);
|
734
|
+
};
|
735
|
+
|
736
|
+
/**
|
737
|
+
* Computes the normalized form of this quaternion.
|
738
|
+
* @memberof Quaternion
|
739
|
+
*
|
740
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
741
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
742
|
+
*/
|
743
|
+
Quaternion.prototype.normalize = function(result) {
|
744
|
+
return Quaternion.normalize(this, result);
|
745
|
+
};
|
746
|
+
|
747
|
+
/**
|
748
|
+
* Computes the inverse of the provided quaternion.
|
749
|
+
* @memberof Quaternion
|
750
|
+
*
|
751
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
752
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
753
|
+
*/
|
754
|
+
Quaternion.prototype.inverse = function(result) {
|
755
|
+
return Quaternion.inverse(this, result);
|
756
|
+
};
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Computes the componentwise sum of this and the provided quaternion.
|
760
|
+
* @memberof Quaternion
|
761
|
+
*
|
762
|
+
* @param {Quaternion} right The right hand side quaternion.
|
763
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
764
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
765
|
+
*
|
766
|
+
* @exception {DeveloperError} right is required.
|
767
|
+
*/
|
768
|
+
Quaternion.prototype.add = function(right, result) {
|
769
|
+
return Quaternion.add(this, right, result);
|
770
|
+
};
|
771
|
+
|
772
|
+
/**
|
773
|
+
* Computes the componentwise difference of this and the provided quaternion.
|
774
|
+
* @memberof Quaternion
|
775
|
+
*
|
776
|
+
* @param {Quaternion} right The right hand side quaternion.
|
777
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
778
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
779
|
+
|
780
|
+
* @exception {DeveloperError} right is required.
|
781
|
+
*/
|
782
|
+
Quaternion.prototype.subtract = function(right, result) {
|
783
|
+
return Quaternion.subtract(this, right, result);
|
784
|
+
};
|
785
|
+
|
786
|
+
/**
|
787
|
+
* Negates this quaternion.
|
788
|
+
* @memberof Quaternion
|
789
|
+
*
|
790
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
791
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
792
|
+
*/
|
793
|
+
Quaternion.prototype.negate = function(result) {
|
794
|
+
return Quaternion.negate(this, result);
|
795
|
+
};
|
796
|
+
|
797
|
+
/**
|
798
|
+
* Computes the dot (scalar) product of this and the provided quaternion.
|
799
|
+
* @memberof Quaternion
|
800
|
+
*
|
801
|
+
* @param {Quaternion} right The right hand side quaternion.
|
802
|
+
* @return {Number} The dot product.
|
803
|
+
*
|
804
|
+
* @exception {DeveloperError} right is required.
|
805
|
+
*/
|
806
|
+
Quaternion.prototype.dot = function(right) {
|
807
|
+
return Quaternion.dot(this, right);
|
808
|
+
};
|
809
|
+
|
810
|
+
|
811
|
+
/**
|
812
|
+
* Computes the product of this and the provided quaternion.
|
813
|
+
* @memberof Quaternion
|
814
|
+
*
|
815
|
+
* @param {Quaternion} right The right hande side quaternion.
|
816
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
817
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
818
|
+
*
|
819
|
+
* @exception {DeveloperError} right is required.
|
820
|
+
*/
|
821
|
+
Quaternion.prototype.multiply = function(right, result) {
|
822
|
+
return Quaternion.multiply(this, right, result);
|
823
|
+
};
|
824
|
+
|
825
|
+
/**
|
826
|
+
* Multiplies this quaternion componentwise by the provided scalar.
|
827
|
+
* @memberof Quaternion
|
828
|
+
*
|
829
|
+
* @param {Number} scalar The scalar to multiply with.
|
830
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
831
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
832
|
+
*
|
833
|
+
* @exception {DeveloperError} scalar is required and must be a number.
|
834
|
+
*/
|
835
|
+
Quaternion.prototype.multiplyByScalar = function(scalar, result) {
|
836
|
+
return Quaternion.multiplyByScalar(this, scalar, result);
|
837
|
+
};
|
838
|
+
|
839
|
+
/**
|
840
|
+
* Divides this quaternion componentwise by the provided scalar.
|
841
|
+
* @memberof Quaternion
|
842
|
+
*
|
843
|
+
* @param {Number} scalar The scalar to divide by.
|
844
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
845
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
846
|
+
*
|
847
|
+
* @exception {DeveloperError} scalar is required and must be a number.
|
848
|
+
*/
|
849
|
+
Quaternion.prototype.divideByScalar = function(scalar, result) {
|
850
|
+
return Quaternion.divideByScalar(this, scalar, result);
|
851
|
+
};
|
852
|
+
|
853
|
+
/**
|
854
|
+
* Computes the axis of rotation of this quaternion.
|
855
|
+
* @memberof Quaternion
|
856
|
+
*
|
857
|
+
* @param {Cartesian3} [result] The object onto which to store the result.
|
858
|
+
* @return {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
|
859
|
+
*/
|
860
|
+
Quaternion.prototype.getAxis = function(result) {
|
861
|
+
return Quaternion.getAxis(this, result);
|
862
|
+
};
|
863
|
+
|
864
|
+
/**
|
865
|
+
* Computes the angle of rotation of this quaternion.
|
866
|
+
* @memberof Quaternion
|
867
|
+
*
|
868
|
+
* @return {Number} The angle of rotation.
|
869
|
+
*/
|
870
|
+
Quaternion.prototype.getAngle = function() {
|
871
|
+
return Quaternion.getAngle(this);
|
872
|
+
};
|
873
|
+
|
874
|
+
/**
|
875
|
+
* Computes the linear interpolation or extrapolation at t using the provided quaternions.
|
876
|
+
* This quaternion is assumed to be t at 0.0.
|
877
|
+
* @memberof Quaternion
|
878
|
+
*
|
879
|
+
* @param end The value corresponding to t at 1.0.
|
880
|
+
* @param t The point along t at which to interpolate.
|
881
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
882
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
883
|
+
*
|
884
|
+
* @exception {DeveloperError} end is required.
|
885
|
+
* @exception {DeveloperError} t is required and must be a number.
|
886
|
+
*/
|
887
|
+
Quaternion.prototype.lerp = function(end, t, result) {
|
888
|
+
return Quaternion.lerp(this, end, t, result);
|
889
|
+
};
|
890
|
+
|
891
|
+
/**
|
892
|
+
* Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
|
893
|
+
* This quaternion is assumed to be t at 0.0.
|
894
|
+
* @memberof Quaternion
|
895
|
+
*
|
896
|
+
* @param end The value corresponding to t at 1.0.
|
897
|
+
* @param t The point along t at which to interpolate.
|
898
|
+
* @param {Quaternion} [result] The object onto which to store the result.
|
899
|
+
* @return {Quaternion} The modified result parameter or a new Quaternion instance if one was not provided.
|
900
|
+
*
|
901
|
+
* @exception {DeveloperError} end is required.
|
902
|
+
* @exception {DeveloperError} t is required and must be a number.
|
903
|
+
*/
|
904
|
+
Quaternion.prototype.slerp = function(end, t, result) {
|
905
|
+
return Quaternion.slerp(this, end, t, result);
|
906
|
+
};
|
907
|
+
|
908
|
+
/**
|
909
|
+
* Compares this and the provided quaternion componentwise and returns
|
910
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
911
|
+
* @memberof Quaternion
|
912
|
+
*
|
913
|
+
* @param {Quaternion} [right] The right hand side quaternion.
|
914
|
+
* @return {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
915
|
+
*/
|
916
|
+
Quaternion.prototype.equals = function(right) {
|
917
|
+
return Quaternion.equals(this, right);
|
918
|
+
};
|
919
|
+
|
920
|
+
/**
|
921
|
+
* Compares this and the provided quaternion componentwise and returns
|
922
|
+
* <code>true</code> if they are within the provided epsilon,
|
923
|
+
* <code>false</code> otherwise.
|
924
|
+
* @memberof Quaternion
|
925
|
+
*
|
926
|
+
* @param {Quaternion} [right] The right hand side quaternion.
|
927
|
+
* @param {Number} epsilon The epsilon to use for equality testing.
|
928
|
+
* @return {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
|
929
|
+
*
|
930
|
+
* @exception {DeveloperError} epsilon is required and must be a number.
|
931
|
+
*/
|
932
|
+
Quaternion.prototype.equalsEpsilon = function(right, epsilon) {
|
933
|
+
return Quaternion.equalsEpsilon(this, right, epsilon);
|
934
|
+
};
|
935
|
+
|
936
|
+
/**
|
937
|
+
* Returns a string representing this quaternion in the format (x, y, z, w).
|
938
|
+
* @memberof Quaternion
|
939
|
+
*
|
940
|
+
* @return {String} A string representing this Quaternion.
|
941
|
+
*/
|
942
|
+
Quaternion.prototype.toString = function() {
|
943
|
+
return '(' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
|
944
|
+
};
|
945
|
+
|
946
|
+
return Quaternion;
|
947
|
+
});
|