cesium 0.21 → 0.21.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2048,196 +2048,6 @@ define(['Core/Cartesian3', 'Core/Cartesian4', 'Core/defaultValue', 'Core/defined
2048
2048
  return Matrix4.clone(this, result);
2049
2049
  };
2050
2050
 
2051
- /**
2052
- * Computes an Array from this Matrix4 instance.
2053
- * @memberof Matrix4
2054
- *
2055
- * @param {Array} [result] The Array onto which to store the result.
2056
- * @returns {Array} The modified Array parameter or a new Array instance if one was not provided.
2057
- */
2058
- Matrix4.prototype.toArray = function(result) {
2059
- return Matrix4.toArray(this, result);
2060
- };
2061
-
2062
- /**
2063
- * Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.
2064
- * @memberof Matrix4
2065
- *
2066
- * @param {Number} index The zero-based index of the column to retrieve.
2067
- * @param {Cartesian4} [result] The object onto which to store the result.
2068
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
2069
- *
2070
- * @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
2071
- *
2072
- * @see Cartesian4
2073
- */
2074
- Matrix4.prototype.getColumn = function(index, result) {
2075
- return Matrix4.getColumn(this, index, result);
2076
- };
2077
-
2078
- /**
2079
- * Computes a new matrix that replaces the specified column in this matrix with the provided Cartesian4 instance.
2080
- * @memberof Matrix4
2081
- *
2082
- * @param {Number} index The zero-based index of the column to set.
2083
- * @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified column.
2084
- *
2085
- * @exception {DeveloperError} cartesian is required.
2086
- * @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
2087
- *
2088
- * @see Cartesian4
2089
- */
2090
- Matrix4.prototype.setColumn = function(index, cartesian, result) {
2091
- return Matrix4.setColumn(this, index, cartesian, result);
2092
- };
2093
-
2094
- /**
2095
- * Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.
2096
- * @memberof Matrix4
2097
- *
2098
- * @param {Number} index The zero-based index of the row to retrieve.
2099
- * @param {Cartesian4} [result] The object onto which to store the result.
2100
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
2101
- *
2102
- * @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
2103
- *
2104
- * @see Cartesian4
2105
- */
2106
- Matrix4.prototype.getRow = function(index, result) {
2107
- return Matrix4.getRow(this, index, result);
2108
- };
2109
-
2110
- /**
2111
- * Computes a new matrix that replaces the specified row in this matrix with the provided Cartesian4 instance.
2112
- * @memberof Matrix4
2113
- *
2114
- * @param {Number} index The zero-based index of the row to set.
2115
- * @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified row.
2116
- *
2117
- * @exception {DeveloperError} cartesian is required.
2118
- * @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
2119
- *
2120
- * @see Cartesian4
2121
- */
2122
- Matrix4.prototype.setRow = function(index, cartesian, result) {
2123
- return Matrix4.setRow(this, index, cartesian, result);
2124
- };
2125
-
2126
- /**
2127
- * Computes the product of this matrix and the provided matrix.
2128
- * @memberof Matrix4
2129
- *
2130
- * @param {Matrix4} right The right hand side matrix.
2131
- * @param {Matrix4} [result] The object onto which to store the result.
2132
- * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
2133
- *
2134
- * @exception {DeveloperError} right is required.
2135
- */
2136
- Matrix4.prototype.multiply = function(right, result) {
2137
- return Matrix4.multiply(this, right, result);
2138
- };
2139
-
2140
- /**
2141
- * Multiplies this matrix, assuming it is a transformation matrix (with a bottom row of
2142
- * <code>[0.0, 0.0, 0.0, 1.0]</code>), by an implicit translation matrix defined by a {@link Cartesian3}.
2143
- *
2144
- * @memberof Matrix4
2145
- *
2146
- * @param {Cartesian3} translation The translation on the right-hand side of the multiplication.
2147
- * @param {Matrix4} [result] The object onto which to store the result.
2148
- *
2149
- * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
2150
- *
2151
- * @exception {DeveloperError} translation is required.
2152
- */
2153
- Matrix4.prototype.multiplyByTranslation = function(translation, result) {
2154
- return Matrix4.multiplyByTranslation(this, translation, result);
2155
- };
2156
-
2157
- /**
2158
- * Multiplies this matrix, assuming it is a transformation matrix (with a bottom row of
2159
- * <code>[0.0, 0.0, 0.0, 1.0]</code>), by an implicit uniform scale matrix.
2160
- *
2161
- * @memberof Matrix4
2162
- *
2163
- * @param {Number} scale The scale on the right-hand side of the multiplication.
2164
- * @param {Matrix4} [result] The object onto which to store the result.
2165
- *
2166
- * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
2167
- *
2168
- * @exception {DeveloperError} scale is required.
2169
- */
2170
- Matrix4.prototype.multiplyByUniformScale = function(scale, result) {
2171
- return Matrix4.multiplyByUniformScale(this, scale, result);
2172
- };
2173
-
2174
- /**
2175
- * Computes the product of this matrix and a column vector.
2176
- * @memberof Matrix4
2177
- *
2178
- * @param {Cartesian4} cartesian The vector.
2179
- * @param {Cartesian4} [result] The object onto which to store the result.
2180
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
2181
- *
2182
- * @exception {DeveloperError} cartesian is required.
2183
- */
2184
- Matrix4.prototype.multiplyByVector = function(cartesian, result) {
2185
- return Matrix4.multiplyByVector(this, cartesian, result);
2186
- };
2187
-
2188
- /**
2189
- * Computes the product of a matrix and a {@link Cartesian3}. This is equivalent to calling {@link Matrix4#multiplyByVector}
2190
- * with a {@link Cartesian4} with a <code>w</code> component of one.
2191
- * @memberof Matrix4
2192
- *
2193
- * @param {Cartesian3} cartesian The point.
2194
- * @param {Cartesian4} [result] The object onto which to store the result.
2195
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
2196
- *
2197
- * @exception {DeveloperError} cartesian is required.
2198
- */
2199
- Matrix4.prototype.multiplyByPoint = function(cartesian, result) {
2200
- return Matrix4.multiplyByPoint(this, cartesian, result);
2201
- };
2202
-
2203
- /**
2204
- * Computes the product of this matrix and a scalar.
2205
- * @memberof Matrix4
2206
- *
2207
- * @param {Number} scalar The number to multiply by.
2208
- * @param {Matrix4} [result] The object onto which to store the result.
2209
- * @returns {Matrix4} The modified result parameter or a new Cartesian4 instance if one was not provided.
2210
- *
2211
- * @exception {DeveloperError} scalar is required and must be a number.
2212
- */
2213
- Matrix4.prototype.multiplyByScalar = function(scalar, result) {
2214
- return Matrix4.multiplyByScalar(this, scalar, result);
2215
- };
2216
- /**
2217
- * Computes a negated copy of this matrix.
2218
- * @memberof Matrix4
2219
- *
2220
- * @param {Matrix4} matrix The matrix to negate.
2221
- * @param {Matrix4} [result] The object onto which to store the result.
2222
- * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
2223
- *
2224
- * @exception {DeveloperError} matrix is required.
2225
- */
2226
- Matrix4.prototype.negate = function(result) {
2227
- return Matrix4.negate(this, result);
2228
- };
2229
-
2230
- /**
2231
- * Computes the transpose of this matrix.
2232
- * @memberof Matrix4
2233
- *
2234
- * @param {Matrix4} [result] The object onto which to store the result.
2235
- * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
2236
- */
2237
- Matrix4.prototype.transpose = function(result) {
2238
- return Matrix4.transpose(this, result);
2239
- };
2240
-
2241
2051
  /**
2242
2052
  * Compares this matrix to the provided matrix componentwise and returns
2243
2053
  * <code>true</code> if they are equal, <code>false</code> otherwise.
@@ -2280,64 +2090,5 @@ define(['Core/Cartesian3', 'Core/Cartesian4', 'Core/defaultValue', 'Core/defined
2280
2090
  '(' + this[3] + ', ' + this[7] + ', ' + this[11] + ', ' + this[15] +')';
2281
2091
  };
2282
2092
 
2283
- /**
2284
- * Gets the translation portion of this matrix, assuming the matrix is a affine transformation matrix.
2285
- * @memberof Matrix4
2286
- *
2287
- * @param {Cartesian3} [result] The object onto which to store the result.
2288
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
2289
- *
2290
- * @see Cartesian3
2291
- */
2292
- Matrix4.prototype.getTranslation = function(result) {
2293
- return Matrix4.getTranslation(this, result);
2294
- };
2295
-
2296
- /**
2297
- * Gets the upper left 3x3 rotation matrix of this matrix, assuming the matrix is a affine transformation matrix.
2298
- * @memberof Matrix4
2299
- *
2300
- * @param {Matrix3} [result] The object onto which to store the result.
2301
- * @returns {Matrix3} The modified result parameter or a new Cartesian3 instance if one was not provided.
2302
- *
2303
- * @see Matrix3
2304
- */
2305
- Matrix4.prototype.getRotation = function(result) {
2306
- return Matrix4.getRotation(this, result);
2307
- };
2308
-
2309
- /**
2310
- * Computes the inverse of this matrix using Cramers Rule.
2311
- * If the determinant is zero, the matrix can not be inverted, and an exception is thrown.
2312
- * If the matrix is an affine transformation matrix, it is more efficient
2313
- * to invert it with {@link #inverseTransformation}.
2314
- * @memberof Matrix4
2315
- *
2316
- * @param {Matrix4} [result] The object onto which to store the result.
2317
- * @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
2318
- *
2319
- * @exception {RuntimeError} matrix is not invertible because its determinate is zero.
2320
- */
2321
- Matrix4.prototype.inverse = function(result) {
2322
- return Matrix4.inverse(this, result);
2323
- };
2324
-
2325
- /**
2326
- * Computes the inverse of this matrix assuming it is
2327
- * an affine transformation matrix, where the upper left 3x3 elements
2328
- * are a rotation matrix, and the upper three elements in the fourth
2329
- * column are the translation. The bottom row is assumed to be [0, 0, 0, 1].
2330
- * The matrix is not verified to be in the proper form.
2331
- * This method is faster than computing the inverse for a general 4x4
2332
- * matrix using {@link #inverse}.
2333
- * @memberof Matrix4
2334
- *
2335
- * @param {Matrix4} [result] The object onto which to store the result.
2336
- * @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
2337
- */
2338
- Matrix4.prototype.inverseTransformation = function(result) {
2339
- return Matrix4.inverseTransformation(this, result);
2340
- };
2341
-
2342
2093
  return Matrix4;
2343
2094
  });
@@ -161,5 +161,18 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError'], function(
161
161
  return NearFarScalar.clone(this, result);
162
162
  };
163
163
 
164
+ /**
165
+ * Compares this instance to the provided NearFarScalar and returns <code>true</code> if they are equal,
166
+ * <code>false</code> otherwise.
167
+ * @memberof NearFarScalar
168
+ *
169
+ * @param {NearFarScalar} [right] The right hand side NearFarScalar.
170
+ *
171
+ * @returns {Boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>.
172
+ */
173
+ NearFarScalar.prototype.equals = function(right) {
174
+ return NearFarScalar.equals(this, right);
175
+ };
176
+
164
177
  return NearFarScalar;
165
178
  });
@@ -690,7 +690,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
690
690
  center = Cartesian3.add(center, scratchPosition, center);
691
691
 
692
692
  if (extrude) {
693
- scratchBoundingSphere = boundingSphere.clone(scratchBoundingSphere);
693
+ scratchBoundingSphere = BoundingSphere.clone(boundingSphere, scratchBoundingSphere);
694
694
  center = scratchBoundingSphere.center;
695
695
  scratchPosition = Cartesian3.multiplyByScalar(scratchNormal, extrudedHeight, scratchPosition);
696
696
  center = Cartesian3.add(ellipsoid.scaleToGeodeticSurface(center, center), scratchPosition, center);
@@ -387,7 +387,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
387
387
  center = Cartesian3.add(center, scratchPosition, center);
388
388
 
389
389
  if (extrude) {
390
- scratchBoundingSphere = boundingSphere.clone(scratchBoundingSphere);
390
+ scratchBoundingSphere = BoundingSphere.clone(boundingSphere, scratchBoundingSphere);
391
391
  center = scratchBoundingSphere.center;
392
392
  scratchPosition = Cartesian3.multiplyByScalar(scratchNormal, extrudedHeight, scratchPosition);
393
393
  center = Cartesian3.add(center, scratchPosition, center);
@@ -403,4 +403,4 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
403
403
  };
404
404
 
405
405
  return PolygonOutlineGeometry;
406
- });
406
+ });
@@ -371,7 +371,7 @@ define(['Core/DeveloperError', 'Core/Math', 'Core/Cartesian2', 'Core/Cartesian3'
371
371
  var after = getNextVertex(a1i, pArray, AFTER);
372
372
 
373
373
  var s1 = Cartesian2.subtract(pArray[before].position, a1.position);
374
- var s2 = Cartesian2.subtract(pArray[after].position, a1.position);
374
+ var s2 = Cartesian2.subtract(pArray[after].position, a1.position);
375
375
  var cut = Cartesian2.subtract(a2.position, a1.position);
376
376
 
377
377
  // Convert to 3-dimensional so we can use cross product
@@ -499,7 +499,7 @@ define(['Core/DeveloperError', 'Core/Math', 'Core/Cartesian2', 'Core/Cartesian3'
499
499
  }
500
500
 
501
501
  var s1 = Cartesian2.subtract(pArray[before].position, pArray[index].position);
502
- var s2 = Cartesian2.subtract(pArray[after].position, pArray[index].position);
502
+ var s2 = Cartesian2.subtract(pArray[after].position, pArray[index].position);
503
503
 
504
504
  // Convert to 3-dimensional so we can use cross product
505
505
  s1 = new Cartesian3(s1.x, s1.y, 0.0);
@@ -33,16 +33,20 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Cartog
33
33
  var carto1 = new Cartographic();
34
34
  var carto2 = new Cartographic();
35
35
  var cartesian = new Cartesian3();
36
+ var scaleFirst = new Cartesian3();
37
+ var scaleLast = new Cartesian3();
36
38
  var ellipsoidGeodesic = new EllipsoidGeodesic();
37
39
  //Returns subdivided line scaled to ellipsoid surface starting at p1 and ending at p2.
38
40
  //Result includes p1, but not include p2. This function is called for a sequence of line segments,
39
41
  //and this prevents duplication of end point.
40
42
  function generateCartesianArc(p1, p2, granularity, ellipsoid) {
41
- var separationAngle = Cartesian3.angleBetween(p1, p2);
43
+ var first = ellipsoid.scaleToGeodeticSurface(p1, scaleFirst);
44
+ var last = ellipsoid.scaleToGeodeticSurface(p2, scaleLast);
45
+ var separationAngle = Cartesian3.angleBetween(first, last);
42
46
  var numPoints = Math.ceil(separationAngle/granularity);
43
47
  var result = new Array(numPoints*3);
44
- var start = ellipsoid.cartesianToCartographic(p1, carto1);
45
- var end = ellipsoid.cartesianToCartographic(p2, carto2);
48
+ var start = ellipsoid.cartesianToCartographic(first, carto1);
49
+ var end = ellipsoid.cartesianToCartographic(last, carto2);
46
50
 
47
51
  ellipsoidGeodesic.setEndPoints(start, end);
48
52
  var surfaceDistanceBetweenPoints = ellipsoidGeodesic.getSurfaceDistance() / (numPoints);
@@ -0,0 +1,239 @@
1
+ /*global define*/
2
+ define(['Core/defined', 'Core/DeveloperError', 'Core/Cartesian3', 'Core/CornerType', 'Core/ComponentDatatype', 'Core/Ellipsoid', 'Core/Geometry', 'Core/GeometryPipeline', 'Core/IndexDatatype', 'Core/Math', 'Core/PolygonPipeline', 'Core/PolylineVolumeGeometryLibrary', 'Core/PrimitiveType', 'Core/defaultValue', 'Core/BoundingSphere', 'Core/BoundingRectangle', 'Core/GeometryAttribute', 'Core/GeometryAttributes', 'Core/VertexFormat', 'Core/WindingOrder'], function(
3
+ defined,
4
+ DeveloperError,
5
+ Cartesian3,
6
+ CornerType,
7
+ ComponentDatatype,
8
+ Ellipsoid,
9
+ Geometry,
10
+ GeometryPipeline,
11
+ IndexDatatype,
12
+ CesiumMath,
13
+ PolygonPipeline,
14
+ PolylineVolumeGeometryLibrary,
15
+ PrimitiveType,
16
+ defaultValue,
17
+ BoundingSphere,
18
+ BoundingRectangle,
19
+ GeometryAttribute,
20
+ GeometryAttributes,
21
+ VertexFormat,
22
+ WindingOrder) {
23
+ "use strict";
24
+
25
+ function computeAttributes(combinedPositions, shape, boundingRectangle, vertexFormat, ellipsoid) {
26
+ var attributes = new GeometryAttributes();
27
+ if (vertexFormat.position) {
28
+ attributes.position = new GeometryAttribute({
29
+ componentDatatype : ComponentDatatype.DOUBLE,
30
+ componentsPerAttribute : 3,
31
+ values : combinedPositions
32
+ });
33
+ }
34
+ var shapeLength = shape.length;
35
+ var vertexCount = combinedPositions.length / 3;
36
+ var length = (vertexCount - shapeLength * 2) / (shapeLength * 2);
37
+ var firstEndIndices = PolygonPipeline.triangulate(shape);
38
+
39
+ var indicesCount = (length - 1) * (shapeLength) * 6 + firstEndIndices.length * 2;
40
+ var indices = IndexDatatype.createTypedArray(vertexCount, indicesCount);
41
+ var i, j;
42
+ var ll, ul, ur, lr;
43
+ var offset = shapeLength * 2;
44
+ var index = 0;
45
+ for (i = 0; i < length - 1; i++) {
46
+ for (j = 0; j < shapeLength - 1; j++) {
47
+ ll = j * 2 + i * shapeLength * 2;
48
+ lr = ll + offset;
49
+ ul = ll + 1;
50
+ ur = ul + offset;
51
+
52
+ indices[index++] = ul;
53
+ indices[index++] = ll;
54
+ indices[index++] = ur;
55
+ indices[index++] = ur;
56
+ indices[index++] = ll;
57
+ indices[index++] = lr;
58
+ }
59
+ ll = shapeLength * 2 - 2 + i * shapeLength * 2;
60
+ ul = ll + 1;
61
+ ur = ul + offset;
62
+ lr = ll + offset;
63
+
64
+ indices[index++] = ul;
65
+ indices[index++] = ll;
66
+ indices[index++] = ur;
67
+ indices[index++] = ur;
68
+ indices[index++] = ll;
69
+ indices[index++] = lr;
70
+ }
71
+
72
+ if (vertexFormat.st || vertexFormat.tangent || vertexFormat.binormal) { // st required for tangent/binormal calculation
73
+ var st = new Float32Array(vertexCount * 2);
74
+ var lengthSt = 1 / (length - 1);
75
+ var heightSt = 1 / (boundingRectangle.height);
76
+ var heightOffset = boundingRectangle.height / 2;
77
+ var s, t;
78
+ var stindex = 0;
79
+ for (i = 0; i < length; i++) {
80
+ s = i * lengthSt;
81
+ t = heightSt * (shape[0].y + heightOffset);
82
+ st[stindex++] = s;
83
+ st[stindex++] = t;
84
+ for (j = 1; j < shapeLength; j++) {
85
+ t = heightSt * (shape[j].y + heightOffset);
86
+ st[stindex++] = s;
87
+ st[stindex++] = t;
88
+ st[stindex++] = s;
89
+ st[stindex++] = t;
90
+ }
91
+ t = heightSt * (shape[0].y + heightOffset);
92
+ st[stindex++] = s;
93
+ st[stindex++] = t;
94
+ }
95
+ for (j = 0; j < shapeLength; j++) {
96
+ s = 0;
97
+ t = heightSt * (shape[j].y + heightOffset);
98
+ st[stindex++] = s;
99
+ st[stindex++] = t;
100
+ }
101
+ for (j = 0; j < shapeLength; j++) {
102
+ s = (length - 1) * lengthSt;
103
+ t = heightSt * (shape[j].y + heightOffset);
104
+ st[stindex++] = s;
105
+ st[stindex++] = t;
106
+ }
107
+
108
+ attributes.st = new GeometryAttribute({
109
+ componentDatatype : ComponentDatatype.FLOAT,
110
+ componentsPerAttribute : 2,
111
+ values : new Float32Array(st)
112
+ });
113
+ }
114
+
115
+ var endOffset = vertexCount - shapeLength * 2;
116
+ for (i = 0; i < firstEndIndices.length; i += 3) {
117
+ var v0 = firstEndIndices[i] + endOffset;
118
+ var v1 = firstEndIndices[i + 1] + endOffset;
119
+ var v2 = firstEndIndices[i + 2] + endOffset;
120
+
121
+ indices[index++] = v0;
122
+ indices[index++] = v1;
123
+ indices[index++] = v2;
124
+ indices[index++] = v2 + shapeLength;
125
+ indices[index++] = v1 + shapeLength;
126
+ indices[index++] = v0 + shapeLength;
127
+ }
128
+
129
+ var geometry = new Geometry({
130
+ attributes : attributes,
131
+ indices : indices,
132
+ boundingSphere : BoundingSphere.fromVertices(combinedPositions),
133
+ primitiveType : PrimitiveType.TRIANGLES
134
+ });
135
+
136
+ if (vertexFormat.normal) {
137
+ geometry = GeometryPipeline.computeNormal(geometry);
138
+ }
139
+
140
+ if (vertexFormat.tangent || vertexFormat.binormal) {
141
+ geometry = GeometryPipeline.computeBinormalAndTangent(geometry);
142
+ if (!vertexFormat.tangent) {
143
+ geometry.attributes.tangent = undefined;
144
+ }
145
+ if (!vertexFormat.binormal) {
146
+ geometry.attributes.binormal = undefined;
147
+ }
148
+ if (!vertexFormat.st) {
149
+ geometry.attributes.st = undefined;
150
+ }
151
+ }
152
+
153
+ return geometry;
154
+ }
155
+
156
+ /**
157
+ * A description of a polyline with a volume (a 2D shape extruded along a polyline).
158
+ *
159
+ * @alias PolylineVolumeGeometry
160
+ * @constructor
161
+ *
162
+ * @param {Array} options.polylinePositions An array of {@link Cartesain3} positions that define the center of the polyline volume.
163
+ * @param {Number} options.shapePositions An array of {@link Cartesian2} positions that define the shape to be extruded along the polyline
164
+ * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
165
+ * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
166
+ * @param {Number} [options.height=0] The distance between the ellipsoid surface and the positions.
167
+ * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
168
+ * @param {Boolean} [options.cornerType = CornerType.ROUNDED] Determines the style of the corners.
169
+ *
170
+ * @exception {DeveloperError} options.polylinePositions is required.
171
+ * @exception {DeveloperError} options.shapePositions is required.
172
+ *
173
+ * @see PolylineVolumeGeometry#createGeometry
174
+ *
175
+ * @example
176
+ * var volume = new PolylineVolumeGeometry({
177
+ * vertexFormat : VertexFormat.POSITION_ONLY,
178
+ * polylinePositions : ellipsoid.cartographicArrayToCartesianArray([
179
+ * Cartographic.fromDegrees(-72.0, 40.0),
180
+ * Cartographic.fromDegrees(-70.0, 35.0)
181
+ * ]),
182
+ * shapePositions : Shapes.compute2DCircle(100000.0)
183
+ * });
184
+ */
185
+ var PolylineVolumeGeometry = function(options) {
186
+ options = defaultValue(options, defaultValue.EMPTY_OBJECT);
187
+ var positions = options.polylinePositions;
188
+ if (!defined(positions)) {
189
+ throw new DeveloperError('options.polylinePositions is required.');
190
+ }
191
+ var shape = options.shapePositions;
192
+ if (!defined(shape)) {
193
+ throw new DeveloperError('options.shapePositions is required.');
194
+ }
195
+
196
+ this._positions = positions;
197
+ this._shape = shape;
198
+ this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
199
+ this._height = defaultValue(options.height, 0.0);
200
+ this._cornerType = defaultValue(options.cornerType, CornerType.ROUNDED);
201
+ this._vertexFormat = defaultValue(options.vertexFormat, VertexFormat.DEFAULT);
202
+ this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
203
+ this._workerName = 'createPolylineVolumeGeometry';
204
+ };
205
+
206
+ /**
207
+ * Computes the geometric representation of a polyline with a volume, including its vertices, indices, and a bounding sphere.
208
+ * @memberof PolylineVolumeGeometry
209
+ *
210
+ * @param {PolylineVolumeGeometry} polylineVolumeGeometry A description of the polyline volume.
211
+ *
212
+ * @returns {Geometry} The computed vertices and indices.
213
+ *
214
+ * @exception {DeveloperError} Count of unique polyline positions must be greater than 1.
215
+ * @exception {DeveloperError} Count of unique shape positions must be at least 3.
216
+ */
217
+ var brScratch = new BoundingRectangle();
218
+ PolylineVolumeGeometry.createGeometry = function(polylineVolumeGeometry) {
219
+ var positions = polylineVolumeGeometry._positions;
220
+ var cleanPositions = PolylineVolumeGeometryLibrary.removeDuplicatesFromPositions(positions, polylineVolumeGeometry._ellipsoid);
221
+ if (cleanPositions.length < 2) {
222
+ throw new DeveloperError('Count of unique polyline positions must be greater than 1.');
223
+ }
224
+ var shape2D = polylineVolumeGeometry._shape;
225
+ shape2D = PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(shape2D);
226
+ if (shape2D.length < 3) {
227
+ throw new DeveloperError('Count of unique shape positions must be at least 3.');
228
+ }
229
+ if (PolygonPipeline.computeWindingOrder2D(shape2D).value === WindingOrder.CLOCKWISE.value) {
230
+ shape2D.reverse();
231
+ }
232
+ var boundingRectangle = BoundingRectangle.fromPoints(shape2D, brScratch);
233
+
234
+ var computedPositions = PolylineVolumeGeometryLibrary.computePositions(cleanPositions, shape2D, boundingRectangle, polylineVolumeGeometry, true);
235
+ return computeAttributes(computedPositions, shape2D, boundingRectangle, polylineVolumeGeometry._vertexFormat, polylineVolumeGeometry._ellipsoid);
236
+ };
237
+
238
+ return PolylineVolumeGeometry;
239
+ });