cesium 0.21 → 0.21.1

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/Assets/Textures/moonSmall.jpg +0 -0
  3. data/app/assets/javascripts/Cesium.js +10 -1
  4. data/app/assets/javascripts/Core/Cartesian2.js +28 -0
  5. data/app/assets/javascripts/Core/Cartesian3.js +28 -0
  6. data/app/assets/javascripts/Core/Cartesian4.js +28 -0
  7. data/app/assets/javascripts/Core/CatmullRomSpline.js +3 -3
  8. data/app/assets/javascripts/Core/Clock.js +7 -7
  9. data/app/assets/javascripts/Core/Color.js +1 -1
  10. data/app/assets/javascripts/Core/ComponentDatatype.js +11 -7
  11. data/app/assets/javascripts/Core/CorridorGeometryLibrary.js +23 -29
  12. data/app/assets/javascripts/Core/Ellipsoid.js +6 -0
  13. data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +5 -4
  14. data/app/assets/javascripts/Core/Event.js +2 -1
  15. data/app/assets/javascripts/Core/ExtentGeometry.js +1 -1
  16. data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +1 -1
  17. data/app/assets/javascripts/Core/GeometryAttributes.js +1 -1
  18. data/app/assets/javascripts/Core/GeometryInstance.js +2 -2
  19. data/app/assets/javascripts/Core/GeometryPipeline.js +10 -7
  20. data/app/assets/javascripts/Core/HermiteSpline.js +1 -1
  21. data/app/assets/javascripts/Core/Iau2000Orientation.js +132 -0
  22. data/app/assets/javascripts/Core/IauOrientationAxes.js +98 -0
  23. data/app/assets/javascripts/Core/IauOrientationParameters.js +48 -0
  24. data/app/assets/javascripts/Core/IntersectionTests.js +5 -5
  25. data/app/assets/javascripts/Core/JulianDate.js +27 -5
  26. data/app/assets/javascripts/Core/Math.js +9 -0
  27. data/app/assets/javascripts/Core/Matrix2.js +1 -142
  28. data/app/assets/javascripts/Core/Matrix3.js +168 -153
  29. data/app/assets/javascripts/Core/Matrix4.js +0 -249
  30. data/app/assets/javascripts/Core/NearFarScalar.js +13 -0
  31. data/app/assets/javascripts/Core/PolygonGeometry.js +1 -1
  32. data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +2 -2
  33. data/app/assets/javascripts/Core/PolygonPipeline.js +2 -2
  34. data/app/assets/javascripts/Core/PolylinePipeline.js +7 -3
  35. data/app/assets/javascripts/Core/PolylineVolumeGeometry.js +239 -0
  36. data/app/assets/javascripts/Core/PolylineVolumeGeometryLibrary.js +404 -0
  37. data/app/assets/javascripts/Core/PolylineVolumeOutlineGeometry.js +154 -0
  38. data/app/assets/javascripts/Core/Quaternion.js +37 -10
  39. data/app/assets/javascripts/Core/Shapes.js +26 -2
  40. data/app/assets/javascripts/Core/Simon1994PlanetaryPositions.js +3 -3
  41. data/app/assets/javascripts/Core/TimeInterval.js +28 -17
  42. data/app/assets/javascripts/Core/TimeIntervalCollection.js +30 -0
  43. data/app/assets/javascripts/Core/Transforms.js +5 -5
  44. data/app/assets/javascripts/Core/WallGeometryLibrary.js +2 -2
  45. data/app/assets/javascripts/Core/getFilenameFromUri.js +37 -0
  46. data/app/assets/javascripts/DynamicScene/ColorMaterialProperty.js +2 -2
  47. data/app/assets/javascripts/DynamicScene/CzmlDataSource.js +96 -18
  48. data/app/assets/javascripts/DynamicScene/DataSource.js +8 -0
  49. data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +15 -3
  50. data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +6 -1
  51. data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +1 -1
  52. data/app/assets/javascripts/DynamicScene/DynamicLabel.js +12 -1
  53. data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +5 -0
  54. data/app/assets/javascripts/DynamicScene/DynamicObject.js +44 -17
  55. data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +3 -3
  56. data/app/assets/javascripts/DynamicScene/DynamicPoint.js +12 -1
  57. data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +11 -2
  58. data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +10 -30
  59. data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +5 -20
  60. data/app/assets/javascripts/DynamicScene/GeoJsonDataSource.js +26 -8
  61. data/app/assets/javascripts/DynamicScene/GridMaterialProperty.js +2 -2
  62. data/app/assets/javascripts/DynamicScene/ImageMaterialProperty.js +2 -2
  63. data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +66 -0
  64. data/app/assets/javascripts/DynamicScene/PositionProperty.js +3 -3
  65. data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +1 -1
  66. data/app/assets/javascripts/DynamicScene/SampledProperty.js +14 -8
  67. data/app/assets/javascripts/Renderer/AutomaticUniforms.js +4 -3
  68. data/app/assets/javascripts/Renderer/Context.js +16 -2
  69. data/app/assets/javascripts/Renderer/UniformState.js +14 -14
  70. data/app/assets/javascripts/Scene/Billboard.js +102 -26
  71. data/app/assets/javascripts/Scene/BillboardCollection.js +69 -16
  72. data/app/assets/javascripts/Scene/Camera.js +7 -7
  73. data/app/assets/javascripts/Scene/CameraController.js +23 -12
  74. data/app/assets/javascripts/Scene/CameraFlightPath.js +11 -11
  75. data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -1
  76. data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -2
  77. data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +79 -24
  78. data/app/assets/javascripts/Scene/ExtentPrimitive.js +17 -1
  79. data/app/assets/javascripts/Scene/Label.js +94 -18
  80. data/app/assets/javascripts/Scene/LabelCollection.js +6 -2
  81. data/app/assets/javascripts/Scene/Moon.js +150 -0
  82. data/app/assets/javascripts/Scene/Polygon.js +18 -1
  83. data/app/assets/javascripts/Scene/Polyline.js +32 -13
  84. data/app/assets/javascripts/Scene/PolylineCollection.js +7 -6
  85. data/app/assets/javascripts/Scene/Primitive.js +2 -2
  86. data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +12 -0
  87. data/app/assets/javascripts/Scene/Scene.js +122 -14
  88. data/app/assets/javascripts/Scene/SceneTransforms.js +2 -2
  89. data/app/assets/javascripts/Scene/SceneTransitioner.js +4 -4
  90. data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1 -1
  91. data/app/assets/javascripts/Scene/SkyBox.js +53 -48
  92. data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +2 -2
  93. data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +36 -14
  94. data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +27 -9
  95. data/app/assets/javascripts/Shaders/Builtin/Functions/phong.glsl +13 -0
  96. data/app/assets/javascripts/Shaders/Builtin/Functions/phong.js +10 -0
  97. data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +24 -0
  98. data/app/assets/javascripts/Shaders/EllipsoidFS.js +21 -1
  99. data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +30 -9
  100. data/app/assets/javascripts/Widgets/HomeButton/HomeButtonViewModel.js +6 -5
  101. data/app/assets/javascripts/Widgets/Viewer/Viewer.js +13 -0
  102. data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +46 -4
  103. data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +16 -8
  104. data/app/assets/javascripts/Workers/createPolylineVolumeGeometry.js +23 -0
  105. data/app/assets/javascripts/Workers/createPolylineVolumeOutlineGeometry.js +23 -0
  106. data/lib/cesium/version.rb +1 -1
  107. metadata +15 -5
  108. data/test/dummy/tmp/pids/server.pid +0 -1
@@ -119,7 +119,8 @@ define(['Core/DeveloperError'], function(
119
119
  Event.prototype.raiseEvent = function() {
120
120
  var listeners = this._listeners;
121
121
  var scopes = this._scopes;
122
- for ( var i = listeners.length - 1; i > -1; i--) {
122
+ var length = listeners.length;
123
+ for (var i = 0; i < length; i++) {
123
124
  listeners[i].apply(scopes[i], arguments);
124
125
  }
125
126
  };
@@ -718,7 +718,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
718
718
 
719
719
  Cartesian3.subtract(nw, center, nw);
720
720
  Matrix2.fromRotation(rotation, rotationMatrix);
721
- rotationMatrix.multiplyByVector(nw, nw);
721
+ Matrix2.multiplyByVector(rotationMatrix, nw, nw);
722
722
  Cartesian3.add(nw, center, nw);
723
723
  proj.unproject(nw, nwCartographic);
724
724
 
@@ -343,7 +343,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
343
343
 
344
344
  Cartesian3.subtract(nw, center, nw);
345
345
  Matrix2.fromRotation(rotation, rotationMatrix);
346
- rotationMatrix.multiplyByVector(nw, nw);
346
+ Matrix2.multiplyByVector(rotationMatrix, nw, nw);
347
347
  Cartesian3.add(nw, center, nw);
348
348
  proj.unproject(nw, nwCartographic);
349
349
 
@@ -11,7 +11,7 @@ define(['Core/defaultValue'], function(defaultValue) {
11
11
  * into the vertex buffer for better rendering performance.
12
12
  * </p>
13
13
  *
14
- * @alias VertexFormat
14
+ * @alias GeometryAttributes
15
15
  * @constructor
16
16
  */
17
17
  var GeometryAttributes = function(options) {
@@ -19,7 +19,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Matrix
19
19
  *
20
20
  * @param {Geometry} options.geometry The geometry to instance.
21
21
  * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates.
22
- * @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Context#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
22
+ * @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
23
23
  * @param {Object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below.
24
24
  *
25
25
  * @exception {DeveloperError} options.geometry is required.
@@ -88,7 +88,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Matrix
88
88
  *
89
89
  * @default undefined
90
90
  *
91
- * @see Context#pick
91
+ * @see Scene#pick
92
92
  * @see Primitive#getGeometryInstanceAttributes
93
93
  */
94
94
  this.id = options.id;
@@ -351,11 +351,13 @@ define(['Core/barycentricCoordinates', 'Core/defaultValue', 'Core/defined', 'Cor
351
351
  var elementsIn = attribute.values;
352
352
  var intoElementsIn = 0;
353
353
  var numComponents = attribute.componentsPerAttribute;
354
- var elementsOut = ComponentDatatype.createTypedArray(attribute.componentDatatype, elementsIn.length);
354
+ var elementsOut = ComponentDatatype.createTypedArray(attribute.componentDatatype, nextIndex * numComponents);
355
355
  while (intoElementsIn < numVertices) {
356
356
  var temp = indexCrossReferenceOldToNew[intoElementsIn];
357
- for (i = 0; i < numComponents; i++) {
358
- elementsOut[numComponents * temp + i] = elementsIn[numComponents * intoElementsIn + i];
357
+ if (temp !== -1) {
358
+ for (i = 0; i < numComponents; i++) {
359
+ elementsOut[numComponents * temp + i] = elementsIn[numComponents * intoElementsIn + i];
360
+ }
359
361
  }
360
362
  ++intoElementsIn;
361
363
  }
@@ -571,6 +573,7 @@ define(['Core/barycentricCoordinates', 'Core/defaultValue', 'Core/defined', 'Cor
571
573
  * @exception {DeveloperError} attributeName2D is required.
572
574
  * @exception {DeveloperError} geometry must have attribute matching the attributeName argument.
573
575
  * @exception {DeveloperError} The attribute componentDatatype must be ComponentDatatype.DOUBLE.
576
+ * @exception {DeveloperError} Could not project a point to 2D.
574
577
  *
575
578
  * @example
576
579
  * geometry = GeometryPipeline.projectTo2D(geometry, 'position', 'position3D', 'position2D');
@@ -612,11 +615,11 @@ define(['Core/barycentricCoordinates', 'Core/defaultValue', 'Core/defined', 'Cor
612
615
  for ( var i = 0; i < values3D.length; i += 3) {
613
616
  var value = Cartesian3.fromArray(values3D, i, scratchProjectTo2DCartesian3);
614
617
 
615
- if (Cartesian3.equals(value, Cartesian3.ZERO)) {
616
- continue;
618
+ var lonLat = ellipsoid.cartesianToCartographic(value, scratchProjectTo2DCartographic);
619
+ if (!defined(lonLat)) {
620
+ throw new DeveloperError('Could not project point (' + value.x + ', ' + value.y + ', ' + value.z + ') to 2D.');
617
621
  }
618
622
 
619
- var lonLat = ellipsoid.cartesianToCartographic(value, scratchProjectTo2DCartographic);
620
623
  var projectedLonLat = projection.project(lonLat, scratchProjectTo2DCartesian3);
621
624
 
622
625
  projectedValues[index++] = projectedLonLat.x;
@@ -812,7 +815,7 @@ define(['Core/barycentricCoordinates', 'Core/defaultValue', 'Core/defined', 'Cor
812
815
  instance.geometry.boundingSphere = BoundingSphere.transform(boundingSphere, modelMatrix, boundingSphere);
813
816
  }
814
817
 
815
- instance.modelMatrix = Matrix4.IDENTITY.clone();
818
+ instance.modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
816
819
 
817
820
  return instance;
818
821
  };
@@ -218,7 +218,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Cartes
218
218
  var timeVec = new Cartesian4(0.0, u * u, u);
219
219
  timeVec.x = timeVec.y * u;
220
220
 
221
- var coefs = HermiteSpline.hermiteCoefficientMatrix.multiplyByPoint(timeVec);
221
+ var coefs = Matrix4.multiplyByPoint(HermiteSpline.hermiteCoefficientMatrix, timeVec);
222
222
  var p0 = Cartesian3.multiplyByScalar(this._points[i].point, coefs.x);
223
223
  var p1 = Cartesian3.multiplyByScalar(this._points[i + 1].point, coefs.y);
224
224
  var p2 = Cartesian3.multiplyByScalar(this._points[i].tangent, coefs.z);
@@ -0,0 +1,132 @@
1
+ /*global define*/
2
+ define(['Core/defined', 'Core/IauOrientationParameters', 'Core/JulianDate', 'Core/Math', 'Core/TimeConstants'], function(
3
+ defined,
4
+ IauOrientationParameters,
5
+ JulianDate,
6
+ CesiumMath,
7
+ TimeConstants) {
8
+ "use strict";
9
+
10
+ /**
11
+ * This is a collection of the orientation information available for central bodies.
12
+ * The data comes from the Report of the IAU/IAG Working Group on Cartographic
13
+ * Coordinates and Rotational Elements: 2000.
14
+ * @exports Iau2000Orientation
15
+ *
16
+ * @private
17
+ */
18
+ var Iau2000Orientation = {};
19
+
20
+ var TdtMinusTai = 32.184;
21
+ var J2000d = 2451545.0;
22
+
23
+ var c1 = -0.0529921;
24
+ var c2 = -0.1059842;
25
+ var c3 = 13.0120009;
26
+ var c4 = 13.3407154;
27
+ var c5 = 0.9856003;
28
+ var c6 = 26.4057084;
29
+ var c7 = 13.0649930;
30
+ var c8 = 0.3287146;
31
+ var c9 = 1.7484877;
32
+ var c10 = -0.1589763;
33
+ var c11 = 0.0036096;
34
+ var c12 = 0.1643573;
35
+ var c13 = 12.9590088;
36
+
37
+ /**
38
+ * Compute the orientation parameters for the Moon.
39
+ *
40
+ * @param {JulianDate} [date=new JulianDate()] The date to evaluate the parameters.
41
+ * @param {IauOrientationParameters} [result] The object onto which to store the result.
42
+ *
43
+ * @returns {IauOrientationParameters} The modified result parameter or a new instance representing the orientation of the Earth's Moon.
44
+ */
45
+ Iau2000Orientation.ComputeMoon = function(date, result) {
46
+ if (!defined(date)) {
47
+ date = new JulianDate();
48
+ }
49
+
50
+ var dateTT = date.addSeconds(TdtMinusTai);
51
+ var d = dateTT.getTotalDays() - J2000d;
52
+ var T = d / TimeConstants.DAYS_PER_JULIAN_CENTURY;
53
+
54
+ var E1 = (125.045 + c1 * d) * CesiumMath.RADIANS_PER_DEGREE;
55
+ var E2 = (250.089 + c2 * d) * CesiumMath.RADIANS_PER_DEGREE;
56
+ var E3 = (260.008 + c3 * d) * CesiumMath.RADIANS_PER_DEGREE;
57
+ var E4 = (176.625 + c4 * d) * CesiumMath.RADIANS_PER_DEGREE;
58
+ var E5 = (357.529 + c5 * d) * CesiumMath.RADIANS_PER_DEGREE;
59
+ var E6 = (311.589 + c6 * d) * CesiumMath.RADIANS_PER_DEGREE;
60
+ var E7 = (134.963 + c7 * d) * CesiumMath.RADIANS_PER_DEGREE;
61
+ var E8 = (276.617 + c8 * d) * CesiumMath.RADIANS_PER_DEGREE;
62
+ var E9 = (34.226 + c9 * d) * CesiumMath.RADIANS_PER_DEGREE;
63
+ var E10 = (15.134 + c10 * d) * CesiumMath.RADIANS_PER_DEGREE;
64
+ var E11 = (119.743 + c11 * d) * CesiumMath.RADIANS_PER_DEGREE;
65
+ var E12 = (239.961 + c12 * d) * CesiumMath.RADIANS_PER_DEGREE;
66
+ var E13 = (25.053 + c13 * d) * CesiumMath.RADIANS_PER_DEGREE;
67
+
68
+ var sinE1 = Math.sin(E1);
69
+ var sinE2 = Math.sin(E2);
70
+ var sinE3 = Math.sin(E3);
71
+ var sinE4 = Math.sin(E4);
72
+ var sinE5 = Math.sin(E5);
73
+ var sinE6 = Math.sin(E6);
74
+ var sinE7 = Math.sin(E7);
75
+ var sinE8 = Math.sin(E8);
76
+ var sinE9 = Math.sin(E9);
77
+ var sinE10 = Math.sin(E10);
78
+ var sinE11 = Math.sin(E11);
79
+ var sinE12 = Math.sin(E12);
80
+ var sinE13 = Math.sin(E13);
81
+
82
+ var cosE1 = Math.cos(E1);
83
+ var cosE2 = Math.cos(E2);
84
+ var cosE3 = Math.cos(E3);
85
+ var cosE4 = Math.cos(E4);
86
+ var cosE5 = Math.cos(E5);
87
+ var cosE6 = Math.cos(E6);
88
+ var cosE7 = Math.cos(E7);
89
+ var cosE8 = Math.cos(E8);
90
+ var cosE9 = Math.cos(E9);
91
+ var cosE10 = Math.cos(E10);
92
+ var cosE11 = Math.cos(E11);
93
+ var cosE12 = Math.cos(E12);
94
+ var cosE13 = Math.cos(E13);
95
+
96
+ var rightAscension = (269.9949 + 0.0031 * T - 3.8787 * sinE1 - 0.1204 * sinE2 +
97
+ 0.0700 * sinE3 - 0.0172 * sinE4 + 0.0072 * sinE6 -
98
+ 0.0052 * sinE10 + 0.0043 * sinE13) *
99
+ CesiumMath.RADIANS_PER_DEGREE;
100
+ var declination = (66.5392 + 0.013 * T + 1.5419 * cosE1 + 0.0239 * cosE2 -
101
+ 0.0278 * cosE3 + 0.0068 * cosE4 - 0.0029 * cosE6 +
102
+ 0.0009 * cosE7 + 0.0008 * cosE10 - 0.0009 * cosE13) *
103
+ CesiumMath.RADIANS_PER_DEGREE;
104
+ var rotation = (38.3213 + 13.17635815 * d - 1.4e-12 * d * d + 3.5610 * sinE1 +
105
+ 0.1208 * sinE2 - 0.0642 * sinE3 + 0.0158 * sinE4 +
106
+ 0.0252 * sinE5 - 0.0066 * sinE6 - 0.0047 * sinE7 -
107
+ 0.0046 * sinE8 + 0.0028 * sinE9 + 0.0052 * sinE10 +
108
+ 0.004 * sinE11 + 0.0019 * sinE12 - 0.0044 * sinE13) *
109
+ CesiumMath.RADIANS_PER_DEGREE;
110
+
111
+ var rotationRate = ((13.17635815 - 1.4e-12 * (2.0 * d)) +
112
+ 3.5610 * cosE1 * c1 +
113
+ 0.1208 * cosE2*c2 - 0.0642 * cosE3*c3 + 0.0158 * cosE4*c4 +
114
+ 0.0252 * cosE5*c5 - 0.0066 * cosE6*c6 - 0.0047 * cosE7*c7 -
115
+ 0.0046 * cosE8*c8 + 0.0028 * cosE9*c9 + 0.0052 * cosE10*c10 +
116
+ 0.004 * cosE11*c11 + 0.0019 * cosE12*c12 - 0.0044 * cosE13*c13) /
117
+ 86400.0 * CesiumMath.RADIANS_PER_DEGREE;
118
+
119
+ if (!defined(result)) {
120
+ result = new IauOrientationParameters();
121
+ }
122
+
123
+ result.rightAscension = rightAscension;
124
+ result.declination = declination;
125
+ result.rotation = rotation;
126
+ result.rotationRate = rotationRate;
127
+
128
+ return result;
129
+ };
130
+
131
+ return Iau2000Orientation;
132
+ });
@@ -0,0 +1,98 @@
1
+ /*global define*/
2
+ define(['Core/Cartesian3', 'Core/defined', 'Core/DeveloperError', 'Core/Iau2000Orientation', 'Core/JulianDate', 'Core/Math', 'Core/Matrix3', 'Core/Quaternion'], function(
3
+ Cartesian3,
4
+ defined,
5
+ DeveloperError,
6
+ Iau2000Orientation,
7
+ JulianDate,
8
+ CesiumMath,
9
+ Matrix3,
10
+ Quaternion) {
11
+ "use strict";
12
+
13
+ /**
14
+ * The Axes representing the orientation of a Central Body as represented by the data
15
+ * from the IAU/IAG Working Group reports on rotational elements.
16
+ * @alias IauOrientationAxes
17
+ * @constructor
18
+ *
19
+ * @param {Function} [computeFunction] The function that computes the {@link IauOrientationParameters} given a {@link JulianDate}.
20
+ *
21
+ * @exception {DeveloperError} computeFunction is required.
22
+ *
23
+ * @see Iau2000Orientation
24
+ */
25
+ var IauOrientationAxes = function (computeFunction) {
26
+ if (!defined(computeFunction) || typeof computeFunction !== 'function') {
27
+ computeFunction = Iau2000Orientation.ComputeMoon;
28
+ }
29
+
30
+ this._computeFunction = computeFunction;
31
+ };
32
+
33
+ var xAxisScratch = new Cartesian3();
34
+ var yAxisScratch = new Cartesian3();
35
+ var zAxisScratch = new Cartesian3();
36
+
37
+ function computeRotationMatrix(alpha, delta, result) {
38
+ var xAxis = xAxisScratch;
39
+ xAxis.x = Math.cos(alpha + CesiumMath.PI_OVER_TWO);
40
+ xAxis.y = Math.sin(alpha + CesiumMath.PI_OVER_TWO);
41
+ xAxis.z = 0.0;
42
+
43
+ var cosDec = Math.cos(delta);
44
+
45
+ var zAxis = zAxisScratch;
46
+ zAxis.x = cosDec * Math.cos(alpha);
47
+ zAxis.y = cosDec * Math.sin(alpha);
48
+ zAxis.z = Math.sin(delta);
49
+
50
+ var yAxis = Cartesian3.cross(zAxis, xAxis, yAxisScratch);
51
+
52
+ if (!defined(result)) {
53
+ result = new Matrix3();
54
+ }
55
+
56
+ result[0] = xAxis.x;
57
+ result[1] = yAxis.x;
58
+ result[2] = zAxis.x;
59
+ result[3] = xAxis.y;
60
+ result[4] = yAxis.y;
61
+ result[5] = zAxis.y;
62
+ result[6] = xAxis.z;
63
+ result[7] = yAxis.z;
64
+ result[8] = zAxis.z;
65
+
66
+ return result;
67
+ }
68
+
69
+ var rotMtxScratch = new Matrix3();
70
+ var quatScratch = new Quaternion();
71
+
72
+ /**
73
+ * Computes a rotation from ICRF to a Central Body's Fixed axes.
74
+ * @memberof IauOrientationAxes
75
+ *
76
+ * @param {JulianDate} date The date to evaluate the matrix.
77
+ * @param {Matrix3} result The object onto which to store the result.
78
+ *
79
+ * @returns {Matrix} The modified result parameter or a new instance of the rotation from ICRF to Fixed.
80
+ */
81
+ IauOrientationAxes.prototype.evaluate = function(date, result) {
82
+ if (!defined(date)) {
83
+ date = new JulianDate();
84
+ }
85
+
86
+ var alphaDeltaW = this._computeFunction(date);
87
+ var precMtx = computeRotationMatrix(alphaDeltaW.rightAscension, alphaDeltaW.declination, result);
88
+
89
+ var rot = CesiumMath.zeroToTwoPi(alphaDeltaW.rotation);
90
+ var quat = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, rot, quatScratch);
91
+ var rotMtx = Matrix3.fromQuaternion(Quaternion.conjugate(quat, quat), rotMtxScratch);
92
+
93
+ var cbi2cbf = Matrix3.multiply(rotMtx, precMtx, precMtx);
94
+ return cbi2cbf;
95
+ };
96
+
97
+ return IauOrientationAxes;
98
+ });
@@ -0,0 +1,48 @@
1
+ /*global define*/
2
+ define(['Core/defined', 'Core/DeveloperError'], function(
3
+ defined,
4
+ DeveloperError) {
5
+ "use strict";
6
+
7
+ /**
8
+ * A structure containing the orientation data computed at a particular time. The data
9
+ * represents the direction of the pole of rotation and the rotation about that pole.
10
+ * <p>
11
+ * These parameters correspond to the parameters in the Report from the IAU/IAG Working Group
12
+ * except that they are expressed in radians.
13
+ * </p>
14
+ * @exports IauOrientationParameters
15
+ *
16
+ * @private
17
+ */
18
+ var IauOrientationParameters = function(rightAscension, declination, rotation, rotationRate) {
19
+ /**
20
+ * The right ascension of the north pole of the body with respect to
21
+ * the International Celestial Reference Frame, in radians.
22
+ * @type {Number}
23
+ */
24
+ this.rightAscension = rightAscension;
25
+
26
+ /**
27
+ * The declination of the north pole of the body with respect to
28
+ * the International Celestial Reference Frame, in radians.
29
+ * @type {Number}
30
+ */
31
+ this.declination = declination;
32
+
33
+ /**
34
+ * The rotation about the north pole used to align a set of axes with
35
+ * the meridian defined by the IAU report, in radians.
36
+ * @type {Number}
37
+ */
38
+ this.rotation = rotation;
39
+
40
+ /**
41
+ * The instantaneous rotation rate about the north pole, in radians per second.
42
+ * @type {Number}
43
+ */
44
+ this.rotationRate = rotationRate;
45
+ };
46
+
47
+ return IauOrientationParameters;
48
+ });
@@ -298,7 +298,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Math', 'Core/Cartesian3', '
298
298
  var B = new Matrix3(firstAxis.x, secondAxis.x, thirdAxis.x,
299
299
  firstAxis.y, secondAxis.y, thirdAxis.y,
300
300
  firstAxis.z, secondAxis.z, thirdAxis.z);
301
- var B_T = B.transpose();
301
+ var B_T = Matrix3.transpose(B);
302
302
 
303
303
  // Get the scaling matrix and its inverse.
304
304
  var D_I = Matrix3.fromScale(ellipsoid.getRadii());
@@ -308,9 +308,9 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Math', 'Core/Cartesian3', '
308
308
  -direction.z, 0.0, direction.x,
309
309
  direction.y, -direction.x, 0.0);
310
310
 
311
- var temp = B_T.multiply(D).multiply(C);
312
- var A = temp.multiply(D_I).multiply(B);
313
- var b = temp.multiplyByVector(position);
311
+ var temp = Matrix3.multiply(Matrix3.multiply(B_T, D), C);
312
+ var A = Matrix3.multiply(Matrix3.multiply(temp, D_I), B);
313
+ var b = Matrix3.multiplyByVector(temp, position);
314
314
 
315
315
  // Solve for the solutions to the expression in standard form:
316
316
  var solutions = quadraticVectorExpression(A, Cartesian3.negate(b), 0.0, 0.0, 1.0);
@@ -323,7 +323,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Math', 'Core/Cartesian3', '
323
323
  var maximumValue = Number.NEGATIVE_INFINITY;
324
324
 
325
325
  for ( var i = 0; i < length; ++i) {
326
- s = D_I.multiplyByVector(B.multiplyByVector(solutions[i]));
326
+ s = Matrix3.multiplyByVector(D_I, Matrix3.multiplyByVector(B, solutions[i]));
327
327
  var v = Cartesian3.normalize(Cartesian3.subtract(s, position));
328
328
  var dotProduct = Cartesian3.dot(v, direction);
329
329
 
@@ -669,6 +669,31 @@ define(['Core/DeveloperError', 'Core/binarySearch', 'Core/defined', 'Core/TimeCo
669
669
  left._secondsOfDay === right._secondsOfDay);
670
670
  };
671
671
 
672
+ /**
673
+ * Returns <code>true</code> if the provided dates are within <code>epsilon</code> seconds of
674
+ * each other. That is, in order for the dates to be considered equal (and for
675
+ * this function to return <code>true</code>), the absolute value of the difference between them, in
676
+ * seconds, must be less than <code>epsilon</code>.
677
+ *
678
+ * @memberof JulianDate
679
+ *
680
+ * @param {JulianDate} left The first JulianDate to be compared.
681
+ * @param {JulianDate} right The second JulianDate to be compared.
682
+ * @param {Number} epsilon The number of seconds that should separate the two JulianDates
683
+ *
684
+ * @returns {Boolean} <code>true</code> if the two JulianDates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
685
+ *
686
+ * @exception {DeveloperError} epsilon is required and must be a number.
687
+ *
688
+ * @see JulianDate#equals
689
+ */
690
+ JulianDate.equalsEpsilon = function(left, right, epsilon) {
691
+ if (epsilon === null || isNaN(epsilon)) {
692
+ throw new DeveloperError('epsilon is required and must be a number.');
693
+ }
694
+ return Math.abs(left.getSecondsDifference(right)) <= epsilon;
695
+ };
696
+
672
697
  /**
673
698
  * Duplicates this JulianDate.
674
699
  * @memberof JulianDate
@@ -1201,7 +1226,7 @@ define(['Core/DeveloperError', 'Core/binarySearch', 'Core/defined', 'Core/TimeCo
1201
1226
  *
1202
1227
  * @returns {Boolean} <code>true</code> if the two JulianDates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
1203
1228
  *
1204
- * @exception {DeveloperError} epsilon is required and must be number.
1229
+ * @exception {DeveloperError} epsilon is required and must be a number.
1205
1230
  *
1206
1231
  * @see JulianDate#equals
1207
1232
  *
@@ -1211,10 +1236,7 @@ define(['Core/DeveloperError', 'Core/binarySearch', 'Core/defined', 'Core/TimeCo
1211
1236
  * original.equalsEpsilon(clone, 2); // true
1212
1237
  */
1213
1238
  JulianDate.prototype.equalsEpsilon = function(other, epsilon) {
1214
- if (epsilon === null || isNaN(epsilon)) {
1215
- throw new DeveloperError('epsilon is required and must be number.');
1216
- }
1217
- return Math.abs(this.getSecondsDifference(other)) <= epsilon;
1239
+ return JulianDate.equalsEpsilon(this, other, epsilon);
1218
1240
  };
1219
1241
 
1220
1242
  //To avoid circular dependencies, we load the default list of leap seconds