cesium 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/Cesium.js +5 -2
- data/app/assets/javascripts/Core/Cartesian2.js +58 -0
- data/app/assets/javascripts/Core/Cartesian3.js +67 -7
- data/app/assets/javascripts/Core/Cartesian4.js +63 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +183 -163
- data/app/assets/javascripts/Core/CorridorGeometry.js +2 -2
- data/app/assets/javascripts/Core/Ellipsoid.js +16 -0
- data/app/assets/javascripts/Core/ExtentGeometry.js +9 -2
- data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +2 -2
- data/app/assets/javascripts/Core/GeometryPipeline.js +23 -23
- data/app/assets/javascripts/Core/HermiteSpline.js +260 -155
- data/app/assets/javascripts/Core/IndexDatatype.js +43 -34
- data/app/assets/javascripts/Core/LinearSpline.js +118 -0
- data/app/assets/javascripts/Core/Math.js +34 -3
- data/app/assets/javascripts/Core/Matrix2.js +26 -0
- data/app/assets/javascripts/Core/Matrix3.js +98 -0
- data/app/assets/javascripts/Core/Matrix4.js +42 -0
- data/app/assets/javascripts/Core/ObjectOrientedBoundingBox.js +396 -0
- data/app/assets/javascripts/Core/PolygonGeometry.js +87 -47
- data/app/assets/javascripts/Core/PolygonGeometryLibrary.js +20 -17
- data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +68 -40
- data/app/assets/javascripts/Core/PolygonPipeline.js +19 -9
- data/app/assets/javascripts/Core/PrimitiveType.js +33 -36
- data/app/assets/javascripts/Core/Quaternion.js +147 -1
- data/app/assets/javascripts/Core/QuaternionSpline.js +160 -0
- data/app/assets/javascripts/Core/Spline.js +121 -0
- data/app/assets/javascripts/Core/Transforms.js +0 -2
- data/app/assets/javascripts/Core/loadArrayBuffer.js +5 -1
- data/app/assets/javascripts/Core/loadBlob.js +5 -1
- data/app/assets/javascripts/Core/loadText.js +4 -1
- data/app/assets/javascripts/Core/loadWithXhr.js +30 -14
- data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +2 -2
- data/app/assets/javascripts/Renderer/AutomaticUniforms.js +41 -41
- data/app/assets/javascripts/Renderer/Context.js +171 -201
- data/app/assets/javascripts/Renderer/CubeMapFace.js +2 -2
- data/app/assets/javascripts/Renderer/DrawCommand.js +2 -2
- data/app/assets/javascripts/Renderer/PixelFormat.js +22 -28
- data/app/assets/javascripts/Renderer/ShaderProgram.js +65 -46
- data/app/assets/javascripts/Renderer/Texture.js +1 -1
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +7 -9
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +19 -25
- data/app/assets/javascripts/Renderer/TextureWrap.js +11 -13
- data/app/assets/javascripts/Renderer/UniformDatatype.js +29 -29
- data/app/assets/javascripts/Renderer/VertexArray.js +43 -35
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/BillboardCollection.js +10 -1
- data/app/assets/javascripts/Scene/CameraFlightPath.js +58 -101
- data/app/assets/javascripts/Scene/CentralBody.js +1 -4
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -2
- data/app/assets/javascripts/Scene/CesiumTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -3
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +20 -5
- data/app/assets/javascripts/Scene/EllipsoidSurfaceAppearance.js +1 -2
- data/app/assets/javascripts/Scene/FrameState.js +1 -3
- data/app/assets/javascripts/Scene/GoogleEarthImageryProvider.js +2 -5
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +1 -2
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +1 -2
- data/app/assets/javascripts/Scene/Polygon.js +1 -3
- data/app/assets/javascripts/Scene/Polyline.js +5 -2
- data/app/assets/javascripts/Scene/PolylineCollection.js +4 -6
- data/app/assets/javascripts/Scene/Primitive.js +19 -13
- data/app/assets/javascripts/Scene/PrimitivePipeline.js +1 -1
- data/app/assets/javascripts/Scene/Scene.js +7 -10
- data/app/assets/javascripts/Scene/SceneTransforms.js +1 -3
- data/app/assets/javascripts/Scene/SceneTransitioner.js +11 -11
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/TexturePool.js +1 -1
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/VRTheWorldTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/ViewportQuad.js +1 -3
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/ThirdParty/knockout-3.0.0.js +6 -3
- data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +4 -3
- data/app/assets/javascripts/Widgets/SceneModePicker/SceneModePickerViewModel.js +1 -1
- data/app/assets/javascripts/Widgets/Viewer/Viewer.js +5 -5
- data/app/assets/javascripts/Widgets/Viewer/viewerDragDropMixin.js +13 -13
- data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +6 -6
- data/app/assets/javascripts/Widgets/widgets.css +1 -1
- data/lib/cesium/version.rb +1 -1
- metadata +6 -3
- data/app/assets/javascripts/Core/OrientationInterpolator.js +0 -106
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/*global define*/
|
|
2
|
+
define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Cartesian3', 'Core/Intersect', 'Core/Matrix3', 'Core/BoundingRectangle'], function(
|
|
3
|
+
defaultValue,
|
|
4
|
+
defined,
|
|
5
|
+
DeveloperError,
|
|
6
|
+
Cartesian3,
|
|
7
|
+
Intersect,
|
|
8
|
+
Matrix3,
|
|
9
|
+
BoundingRectangle) {
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of an ObjectOrientedBoundingBox.
|
|
14
|
+
* An ObjectOrientedBoundingBox model of an object or set of objects, is a closed volume (a cuboid), which completely contains the object or the set of objects.
|
|
15
|
+
* It is oriented, so it can provide an optimum fit, it can bound more tightly.
|
|
16
|
+
* @alias ObjectOrientedBoundingBox
|
|
17
|
+
* @constructor
|
|
18
|
+
*
|
|
19
|
+
* @param {Matrix3} [rotation=Matrix3.IDENTITY] The transformation matrix, to rotate the box to the right position.
|
|
20
|
+
* @param {Cartesian3} [translation=Cartesian3.ZERO] The position of the box.
|
|
21
|
+
* @param {Cartesian3} [scale=Cartesian3.ZERO] The scale of the box.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Create an ObjectOrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
|
|
25
|
+
* var rotation = Matrix3.clone(Matrix3.IDENTITY);
|
|
26
|
+
* var translation = new Cartesian3(1,0,0);
|
|
27
|
+
* var scale = new Cartesian3(0,5,0);
|
|
28
|
+
*
|
|
29
|
+
* var oobb = new ObjectOrientedBoundingBox(rotation, translation, scale);
|
|
30
|
+
*
|
|
31
|
+
* @see ObjectOrientedBoundingBox.fromPoints
|
|
32
|
+
* @see ObjectOrientedBoundingBox.fromBoundingRectangle
|
|
33
|
+
* @see BoundingSphere
|
|
34
|
+
*/
|
|
35
|
+
var ObjectOrientedBoundingBox = function(rotation, translation, scale) {
|
|
36
|
+
/**
|
|
37
|
+
* The transformation matrix, to rotate the box to the right position.
|
|
38
|
+
* @type {Matrix3}
|
|
39
|
+
* @default {@link Matrix3.IDENTITY}
|
|
40
|
+
*/
|
|
41
|
+
this.rotation = Matrix3.clone(defaultValue(rotation, Matrix3.IDENTITY));
|
|
42
|
+
/**
|
|
43
|
+
* The position of the box.
|
|
44
|
+
* @type {Cartesian3}
|
|
45
|
+
* @default {@link Cartesian3.ZERO}
|
|
46
|
+
*/
|
|
47
|
+
this.translation = Cartesian3.clone(defaultValue(translation, Cartesian3.ZERO));
|
|
48
|
+
/**
|
|
49
|
+
* The scale of the box.
|
|
50
|
+
* @type {Cartesian3}
|
|
51
|
+
* @default {@link Cartesian3.ZERO}
|
|
52
|
+
*/
|
|
53
|
+
this.scale = Cartesian3.clone(defaultValue(scale, Cartesian3.ZERO));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var scratchCartesian1 = new Cartesian3();
|
|
57
|
+
var scratchCartesian2 = new Cartesian3();
|
|
58
|
+
var scratchCartesian3 = new Cartesian3();
|
|
59
|
+
var scratchCartesian4 = new Cartesian3();
|
|
60
|
+
var scratchCartesian5 = new Cartesian3();
|
|
61
|
+
var scratchCartesian6 = new Cartesian3();
|
|
62
|
+
var scratchCovarianceResult = new Matrix3();
|
|
63
|
+
var scratchEigenResult = {
|
|
64
|
+
unitary : new Matrix3(),
|
|
65
|
+
diagonal : new Matrix3()
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Computes an instance of an ObjectOrientedBoundingBox of the given positions.
|
|
70
|
+
* This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).
|
|
71
|
+
* Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf
|
|
72
|
+
* @memberof ObjectOrientedBoundingBox
|
|
73
|
+
*
|
|
74
|
+
* @param {Array} positions List of {@link Cartesian3} points that the bounding box will enclose.
|
|
75
|
+
* @param {ObjectOrientedBoundingBox} [result] The object onto which to store the result.
|
|
76
|
+
* @return {ObjectOrientedBoundingBox} The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Compute an object oriented bounding box enclosing two points.
|
|
80
|
+
* var box = ObjectOrientedBoundingBox.fromPoints([new Cartesian3(2, 0, 0), new Cartesian3(-2, 0, 0)]);
|
|
81
|
+
*/
|
|
82
|
+
ObjectOrientedBoundingBox.fromPoints = function(positions, result) {
|
|
83
|
+
if (!defined(result)) {
|
|
84
|
+
result = new ObjectOrientedBoundingBox();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!defined(positions) || positions.length === 0) {
|
|
88
|
+
result.tranformMatrix = Matrix3.IDENTITY;
|
|
89
|
+
result.translation = Cartesian3.ZERO;
|
|
90
|
+
result.scale = Cartesian3.ZERO;
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var i;
|
|
95
|
+
var length = positions.length;
|
|
96
|
+
|
|
97
|
+
var meanPoint = Cartesian3.clone(positions[0], scratchCartesian1);
|
|
98
|
+
for (i = 1; i < length; i++) {
|
|
99
|
+
Cartesian3.add(meanPoint, positions[i], meanPoint);
|
|
100
|
+
}
|
|
101
|
+
var invLength = 1.0 / length;
|
|
102
|
+
Cartesian3.multiplyByScalar(meanPoint, invLength, meanPoint);
|
|
103
|
+
|
|
104
|
+
var exx = 0.0;
|
|
105
|
+
var exy = 0.0;
|
|
106
|
+
var exz = 0.0;
|
|
107
|
+
var eyy = 0.0;
|
|
108
|
+
var eyz = 0.0;
|
|
109
|
+
var ezz = 0.0;
|
|
110
|
+
var p;
|
|
111
|
+
|
|
112
|
+
for (i = 0; i < length; i++) {
|
|
113
|
+
p = Cartesian3.subtract(positions[i], meanPoint, scratchCartesian2);
|
|
114
|
+
exx += p.x * p.x;
|
|
115
|
+
exy += p.x * p.y;
|
|
116
|
+
exz += p.x * p.z;
|
|
117
|
+
eyy += p.y * p.y;
|
|
118
|
+
eyz += p.y * p.z;
|
|
119
|
+
ezz += p.z * p.z;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exx *= invLength;
|
|
123
|
+
exy *= invLength;
|
|
124
|
+
exz *= invLength;
|
|
125
|
+
eyy *= invLength;
|
|
126
|
+
eyz *= invLength;
|
|
127
|
+
ezz *= invLength;
|
|
128
|
+
|
|
129
|
+
var covarianceMatrix = scratchCovarianceResult;
|
|
130
|
+
covarianceMatrix[0] = exx;
|
|
131
|
+
covarianceMatrix[1] = exy;
|
|
132
|
+
covarianceMatrix[2] = exz;
|
|
133
|
+
covarianceMatrix[3] = exy;
|
|
134
|
+
covarianceMatrix[4] = eyy;
|
|
135
|
+
covarianceMatrix[5] = eyz;
|
|
136
|
+
covarianceMatrix[6] = exz;
|
|
137
|
+
covarianceMatrix[7] = eyz;
|
|
138
|
+
covarianceMatrix[8] = ezz;
|
|
139
|
+
|
|
140
|
+
var eigenDecomposition = Matrix3.getEigenDecomposition(covarianceMatrix, scratchEigenResult);
|
|
141
|
+
var rotation = Matrix3.transpose(eigenDecomposition.unitary, result.rotation);
|
|
142
|
+
|
|
143
|
+
p = Cartesian3.subtract(positions[0], meanPoint, scratchCartesian2);
|
|
144
|
+
var tempPoint = Matrix3.multiplyByVector(rotation, p, scratchCartesian3);
|
|
145
|
+
var maxPoint = Cartesian3.clone(tempPoint, scratchCartesian4);
|
|
146
|
+
var minPoint = Cartesian3.clone(tempPoint, scratchCartesian5);
|
|
147
|
+
|
|
148
|
+
for (i = 1; i < length; i++) {
|
|
149
|
+
p = Cartesian3.subtract(positions[i], meanPoint, p);
|
|
150
|
+
Matrix3.multiplyByVector(rotation, p, tempPoint);
|
|
151
|
+
Cartesian3.getMinimumByComponent(minPoint, tempPoint, minPoint);
|
|
152
|
+
Cartesian3.getMaximumByComponent(maxPoint, tempPoint, maxPoint);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
var center = Cartesian3.add(minPoint, maxPoint, scratchCartesian3);
|
|
156
|
+
Cartesian3.multiplyByScalar(center, 0.5, center);
|
|
157
|
+
Matrix3.multiplyByVector(rotation, center, center);
|
|
158
|
+
Cartesian3.add(meanPoint, center, result.translation);
|
|
159
|
+
|
|
160
|
+
var scale = Cartesian3.subtract(maxPoint, minPoint, scratchCartesian3);
|
|
161
|
+
Cartesian3.multiplyByScalar(scale, 0.5, result.scale);
|
|
162
|
+
|
|
163
|
+
return result;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Computes an ObjectOrientedBoundingBox from a BoundingRectangle.
|
|
168
|
+
* The BoundingRectangle is placed on the XY plane.
|
|
169
|
+
* @memberof ObjectOrientedBoundingBox
|
|
170
|
+
*
|
|
171
|
+
* @param {BoundingRectangle} boundingRectangle A bounding rectangle.
|
|
172
|
+
* @param {Number} [rotation=0.0] The rotation of the bounding box in radians.
|
|
173
|
+
* @return {ObjectOrientedBoundingBox} The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.
|
|
174
|
+
*
|
|
175
|
+
* @exception {DeveloperError} boundingRectangle is required.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* // Compute an object oriented bounding box enclosing two points.
|
|
179
|
+
* var box = ObjectOrientedBoundingBox.fromBoundingRectangle(boundingRectangle, 0.0);
|
|
180
|
+
*/
|
|
181
|
+
ObjectOrientedBoundingBox.fromBoundingRectangle = function(boundingRectangle, rotation, result) {
|
|
182
|
+
if (!defined(boundingRectangle)) {
|
|
183
|
+
throw new DeveloperError('boundingRectangle is required');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!defined(result)) {
|
|
187
|
+
result = new ObjectOrientedBoundingBox();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (defined(rotation)) {
|
|
191
|
+
Matrix3.fromRotationZ(rotation, result.rotation);
|
|
192
|
+
} else {
|
|
193
|
+
Matrix3.clone(Matrix3.IDENTITY, result.rotation);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
var scale = result.scale;
|
|
197
|
+
scale.x = boundingRectangle.width * 0.5;
|
|
198
|
+
scale.y = boundingRectangle.height * 0.5;
|
|
199
|
+
scale.z = 0.0;
|
|
200
|
+
|
|
201
|
+
var translation = Matrix3.multiplyByVector(result.rotation, scale, result.translation);
|
|
202
|
+
translation.x += boundingRectangle.x;
|
|
203
|
+
translation.y += boundingRectangle.y;
|
|
204
|
+
|
|
205
|
+
return result;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Duplicates a ObjectOrientedBoundingBox instance.
|
|
210
|
+
* @memberof ObjectOrientedBoundingBox
|
|
211
|
+
*
|
|
212
|
+
* @param {ObjectOrientedBoundingBox} box The bounding box to duplicate.
|
|
213
|
+
* @param {ObjectOrientedBoundingBox} [result] The object onto which to store the result.
|
|
214
|
+
* @return {ObjectOrientedBoundingBox} The modified result parameter or a new ObjectOrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined)
|
|
215
|
+
*/
|
|
216
|
+
ObjectOrientedBoundingBox.clone = function(box, result) {
|
|
217
|
+
if (!defined(box)) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!defined(result)) {
|
|
222
|
+
return new ObjectOrientedBoundingBox(box.rotation, box.translation, box.scale);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
Matrix3.clone(box.rotation, result.rotation);
|
|
226
|
+
Cartesian3.clone(box.translation, result.translation);
|
|
227
|
+
Cartesian3.clone(box.scale, result.scale);
|
|
228
|
+
|
|
229
|
+
return result;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
var scratchIntersectMatrix1 = new Matrix3();
|
|
233
|
+
var scratchIntersectMatrix2 = new Matrix3();
|
|
234
|
+
var scratchTCartesian = new Cartesian3();
|
|
235
|
+
var scratchTArray = new Array(3);
|
|
236
|
+
var scratchAArray = new Array(3);
|
|
237
|
+
var scratchBArray = new Array(3);
|
|
238
|
+
|
|
239
|
+
function testCase1(k, a, b, B, T) {
|
|
240
|
+
var right = a[k] + b[0] * B[Matrix3.getElementIndex(0, k)] + b[1] * B[Matrix3.getElementIndex(1, k)] + b[2] * B[Matrix3.getElementIndex(2, k)];
|
|
241
|
+
|
|
242
|
+
if (Math.abs(T[k]) > right) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function testCase2(k, a, b, B, T) {
|
|
249
|
+
var left = T[0] * B[Matrix3.getElementIndex(0, k)] + T[1] * B[Matrix3.getElementIndex(1, k)] + T[2] * B[Matrix3.getElementIndex(2, k)];
|
|
250
|
+
var right = b[k] + a[0] * B[Matrix3.getElementIndex(0, k)] + a[1] * B[Matrix3.getElementIndex(1, k)] + a[2] * B[Matrix3.getElementIndex(2, k)];
|
|
251
|
+
|
|
252
|
+
if (Math.abs(left) > right) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function testCase3(i, j, a, b, B, T) {
|
|
259
|
+
var left = T[(i + 2) % 3] * B[Matrix3.getElementIndex((i + 1) % 3, j)] - T[(i + 1) % 3] * B[Matrix3.getElementIndex((i + 2) % 3, j)];
|
|
260
|
+
var right = a[(i + 1) % 3] * B[Matrix3.getElementIndex((i + 2) % 3, j)] + a[(i + 2) % 3] * B[Matrix3.getElementIndex((i + 1) % 3, j)];
|
|
261
|
+
right += b[(j + 1) % 3] * B[Matrix3.getElementIndex(i, (j + 2) % 3)] + b[(j + 2) % 3] * B[Matrix3.getElementIndex(i, (j + 1) % 3)];
|
|
262
|
+
|
|
263
|
+
if (Math.abs(left) > right) {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Checks if two ObjectOrientedBoundingBoxes intersect.
|
|
271
|
+
* This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).
|
|
272
|
+
* @memberof ObjectOrientedBoundingBox
|
|
273
|
+
*
|
|
274
|
+
* @param {ObjectOrientedBoundingBox} left The first ObjectOrientedBoundingBox.
|
|
275
|
+
* @param {ObjectOrientedBoundingBox} right The second ObjectOrientedBoundingBox.
|
|
276
|
+
* @return {Boolean} <code>true</code> if they intersects each other <code>false</code> otherwise.
|
|
277
|
+
*
|
|
278
|
+
* @exception {DeveloperError} left is required.
|
|
279
|
+
* @exception {DeveloperError} right is required.
|
|
280
|
+
*/
|
|
281
|
+
ObjectOrientedBoundingBox.intersect = function(left, right) {
|
|
282
|
+
if (!defined(left)) {
|
|
283
|
+
throw new DeveloperError('left is required');
|
|
284
|
+
}
|
|
285
|
+
if (!defined(right)) {
|
|
286
|
+
throw new DeveloperError('right is required');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
var leftTransformTransposed = Matrix3.transpose(left.rotation, scratchIntersectMatrix1);
|
|
290
|
+
var B = Matrix3.multiply(leftTransformTransposed, right.rotation, scratchIntersectMatrix2);
|
|
291
|
+
Matrix3.abs(B, B);
|
|
292
|
+
|
|
293
|
+
var T = scratchTArray;
|
|
294
|
+
var a = scratchAArray;
|
|
295
|
+
var b = scratchBArray;
|
|
296
|
+
|
|
297
|
+
Cartesian3.subtract(left.translation, right.translation, scratchTCartesian);
|
|
298
|
+
Matrix3.multiplyByVector(leftTransformTransposed, scratchTCartesian, scratchTCartesian);
|
|
299
|
+
Cartesian3.pack(scratchTCartesian, T);
|
|
300
|
+
Cartesian3.pack(left.scale, a);
|
|
301
|
+
Cartesian3.pack(right.scale, b);
|
|
302
|
+
|
|
303
|
+
if (testCase1(0, a, b, B, T)) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
if (testCase1(1, a, b, B, T)) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
if (testCase1(2, a, b, B, T)) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (testCase2(0, a, b, B, T)) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
if (testCase2(1, a, b, B, T)) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
if (testCase2(2, a, b, B, T)) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (testCase3(0, 0, a, b, B, T)) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
if (testCase3(1, 0, a, b, B, T)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
if (testCase3(2, 0, a, b, B, T)) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
if (testCase3(0, 1, a, b, B, T)) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
if (testCase3(1, 1, a, b, B, T)) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
if (testCase3(2, 1, a, b, B, T)) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
if (testCase3(0, 2, a, b, B, T)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
if (testCase3(1, 2, a, b, B, T)) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
if (testCase3(2, 2, a, b, B, T)) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return true;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Compares the provided ObjectOrientedBoundingBox componentwise and returns
|
|
356
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
357
|
+
* @memberof ObjectOrientedBoundingBox
|
|
358
|
+
*
|
|
359
|
+
* @param {ObjectOrientedBoundingBox} left The first ObjectOrientedBoundingBox.
|
|
360
|
+
* @param {ObjectOrientedBoundingBox} right The second ObjectOrientedBoundingBox.
|
|
361
|
+
* @return {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
362
|
+
*/
|
|
363
|
+
ObjectOrientedBoundingBox.equals = function(left, right) {
|
|
364
|
+
return (left === right) ||
|
|
365
|
+
((defined(left)) &&
|
|
366
|
+
(defined(right)) &&
|
|
367
|
+
Cartesian3.equals(left.transformedPosition, right.transformedPosition) &&
|
|
368
|
+
Matrix3.equals(left.transformMatrix, right.transformMatrix) &&
|
|
369
|
+
Cartesian3.equals(left.extent, right.extent));
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Duplicates this ObjectOrientedBoundingBox instance.
|
|
374
|
+
* @memberof ObjectOrientedBoundingBox
|
|
375
|
+
*
|
|
376
|
+
* @param {ObjectOrientedBoundingBox} [result] The object onto which to store the result.
|
|
377
|
+
* @return {ObjectOrientedBoundingBox} The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.
|
|
378
|
+
*/
|
|
379
|
+
ObjectOrientedBoundingBox.prototype.clone = function(result) {
|
|
380
|
+
return ObjectOrientedBoundingBox.clone(this, result);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Compares this ObjectOrientedBoundingBox against the provided ObjectOrientedBoundingBox componentwise and returns
|
|
385
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
386
|
+
* @memberof ObjectOrientedBoundingBox
|
|
387
|
+
*
|
|
388
|
+
* @param {ObjectOrientedBoundingBox} [right] The right hand side ObjectOrientedBoundingBox.
|
|
389
|
+
* @return {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
390
|
+
*/
|
|
391
|
+
ObjectOrientedBoundingBox.prototype.equals = function(right) {
|
|
392
|
+
return ObjectOrientedBoundingBox.equals(this, right);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
return ObjectOrientedBoundingBox;
|
|
396
|
+
});
|
|
@@ -65,7 +65,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
65
65
|
|
|
66
66
|
var createGeometryFromPositionsPositions = [];
|
|
67
67
|
|
|
68
|
-
function createGeometryFromPositions(ellipsoid, positions, granularity) {
|
|
68
|
+
function createGeometryFromPositions(ellipsoid, positions, granularity, perPositionHeight) {
|
|
69
69
|
var tangentPlane = EllipsoidTangentPlane.fromPoints(positions, ellipsoid);
|
|
70
70
|
var positions2D = tangentPlane.projectPointsOntoPlane(positions, createGeometryFromPositionsPositions);
|
|
71
71
|
|
|
@@ -80,8 +80,35 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
80
80
|
if (indices.length < 3) {
|
|
81
81
|
indices = [0, 1, 2];
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
var geo;
|
|
85
|
+
if (!perPositionHeight) {
|
|
86
|
+
geo = PolygonPipeline.computeSubdivision(positions, indices, granularity);
|
|
87
|
+
} else {
|
|
88
|
+
var length = positions.length;
|
|
89
|
+
var flattenedPositions = new Array(length * 3);
|
|
90
|
+
var index = 0;
|
|
91
|
+
for ( var i = 0; i < length; i++) {
|
|
92
|
+
var p = positions[i];
|
|
93
|
+
flattenedPositions[index++] = p.x;
|
|
94
|
+
flattenedPositions[index++] = p.y;
|
|
95
|
+
flattenedPositions[index++] = p.z;
|
|
96
|
+
}
|
|
97
|
+
geo = new Geometry({
|
|
98
|
+
attributes : {
|
|
99
|
+
position : new GeometryAttribute({
|
|
100
|
+
componentDatatype : ComponentDatatype.DOUBLE,
|
|
101
|
+
componentsPerAttribute : 3,
|
|
102
|
+
values : flattenedPositions
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
indices : indices,
|
|
106
|
+
primitiveType : PrimitiveType.TRIANGLES
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
83
110
|
return new GeometryInstance({
|
|
84
|
-
geometry :
|
|
111
|
+
geometry : geo
|
|
85
112
|
});
|
|
86
113
|
}
|
|
87
114
|
|
|
@@ -137,7 +164,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
137
164
|
length /= 2;
|
|
138
165
|
}
|
|
139
166
|
|
|
140
|
-
for (var i = 0; i < length; i += 3) {
|
|
167
|
+
for ( var i = 0; i < length; i += 3) {
|
|
141
168
|
var position = Cartesian3.fromArray(flatPositions, i, appendTextureCoordinatesCartesian3);
|
|
142
169
|
|
|
143
170
|
if (vertexFormat.st) {
|
|
@@ -145,7 +172,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
145
172
|
var st = tangentPlane.projectPointOntoPlane(p, appendTextureCoordinatesCartesian2);
|
|
146
173
|
Cartesian2.subtract(st, origin, st);
|
|
147
174
|
|
|
148
|
-
if (bottom){
|
|
175
|
+
if (bottom) {
|
|
149
176
|
textureCoordinates[textureCoordIndex + bottomOffset2] = st.x / boundingRectangle.width;
|
|
150
177
|
textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = st.y / boundingRectangle.height;
|
|
151
178
|
}
|
|
@@ -161,7 +188,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
161
188
|
var attrIndex2 = attrIndex + 2;
|
|
162
189
|
|
|
163
190
|
if (wall) {
|
|
164
|
-
if (i+3 < length) {
|
|
191
|
+
if (i + 3 < length) {
|
|
165
192
|
var p1 = Cartesian3.fromArray(flatPositions, i + 3, p1Scratch);
|
|
166
193
|
|
|
167
194
|
if (recomputeNormal) {
|
|
@@ -277,7 +304,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
277
304
|
return geometry;
|
|
278
305
|
}
|
|
279
306
|
|
|
280
|
-
function computeWallIndices(positions, granularity){
|
|
307
|
+
function computeWallIndices(positions, granularity, perPositionHeight){
|
|
281
308
|
var edgePositions = [];
|
|
282
309
|
var subdividedEdge;
|
|
283
310
|
var edgeIndex;
|
|
@@ -287,25 +314,33 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
287
314
|
var length = positions.length;
|
|
288
315
|
var p1;
|
|
289
316
|
var p2;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
317
|
+
if (!perPositionHeight) {
|
|
318
|
+
for (i = 0; i < length; i++) {
|
|
319
|
+
p1 = positions[i];
|
|
320
|
+
p2 = positions[(i + 1) % length];
|
|
321
|
+
subdividedEdge = PolygonGeometryLibrary.subdivideLine(p1, p2, granularity);
|
|
322
|
+
subdividedEdge.push(p2.x, p2.y, p2.z);
|
|
323
|
+
edgePositions = edgePositions.concat(subdividedEdge);
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
for (i = 0; i < length; i++) {
|
|
327
|
+
p1 = positions[i];
|
|
328
|
+
p2 = positions[(i + 1) % length];
|
|
329
|
+
edgePositions.push(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z);
|
|
330
|
+
}
|
|
296
331
|
}
|
|
297
332
|
|
|
298
333
|
edgePositions = edgePositions.concat(edgePositions);
|
|
299
334
|
length = edgePositions.length;
|
|
300
|
-
var indices = IndexDatatype.createTypedArray(length/3, length - positions.length*6);
|
|
335
|
+
var indices = IndexDatatype.createTypedArray(length / 3, length - positions.length * 6);
|
|
301
336
|
edgeIndex = 0;
|
|
302
337
|
length /= 6;
|
|
303
338
|
|
|
304
|
-
for (i = 0
|
|
339
|
+
for (i = 0; i < length; i++) {
|
|
305
340
|
UL = i;
|
|
306
341
|
UR = UL + 1;
|
|
307
|
-
p1 = Cartesian3.fromArray(edgePositions, UL*3, p1Scratch);
|
|
308
|
-
p2 = Cartesian3.fromArray(edgePositions, UR*3, p2Scratch);
|
|
342
|
+
p1 = Cartesian3.fromArray(edgePositions, UL * 3, p1Scratch);
|
|
343
|
+
p2 = Cartesian3.fromArray(edgePositions, UR * 3, p2Scratch);
|
|
309
344
|
if (Cartesian3.equalsEpsilon(p1, p2, CesiumMath.EPSILON6)) {
|
|
310
345
|
continue;
|
|
311
346
|
}
|
|
@@ -332,18 +367,18 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
332
367
|
});
|
|
333
368
|
}
|
|
334
369
|
|
|
335
|
-
function createGeometryFromPositionsExtruded(ellipsoid, positions, granularity, hierarchy) {
|
|
336
|
-
var topGeo = createGeometryFromPositions(ellipsoid, positions, granularity).geometry;
|
|
370
|
+
function createGeometryFromPositionsExtruded(ellipsoid, positions, granularity, hierarchy, perPositionHeight) {
|
|
371
|
+
var topGeo = createGeometryFromPositions(ellipsoid, positions, granularity, perPositionHeight).geometry;
|
|
337
372
|
var edgePoints = topGeo.attributes.position.values;
|
|
338
373
|
var indices = topGeo.indices;
|
|
339
374
|
var topBottomPositions = edgePoints.concat(edgePoints);
|
|
340
|
-
var numPositions = topBottomPositions.length/3;
|
|
341
|
-
var newIndices = IndexDatatype.createTypedArray(numPositions, indices.length*2);
|
|
375
|
+
var numPositions = topBottomPositions.length / 3;
|
|
376
|
+
var newIndices = IndexDatatype.createTypedArray(numPositions, indices.length * 2);
|
|
342
377
|
newIndices.set(indices);
|
|
343
378
|
var ilength = indices.length;
|
|
344
379
|
var i;
|
|
345
380
|
var length = numPositions / 2;
|
|
346
|
-
for (i = 0
|
|
381
|
+
for (i = 0; i < ilength; i += 3) {
|
|
347
382
|
var i0 = newIndices[i] + length;
|
|
348
383
|
var i1 = newIndices[i + 1] + length;
|
|
349
384
|
var i2 = newIndices[i + 2] + length;
|
|
@@ -353,21 +388,21 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
353
388
|
newIndices[i + 2 + ilength] = i0;
|
|
354
389
|
}
|
|
355
390
|
var topAndBottomGeo = new Geometry({
|
|
356
|
-
attributes: new GeometryAttributes({
|
|
357
|
-
position: new GeometryAttribute({
|
|
391
|
+
attributes : new GeometryAttributes({
|
|
392
|
+
position : new GeometryAttribute({
|
|
358
393
|
componentDatatype : ComponentDatatype.DOUBLE,
|
|
359
394
|
componentsPerAttribute : 3,
|
|
360
395
|
values : topBottomPositions
|
|
361
396
|
})
|
|
362
397
|
}),
|
|
363
|
-
indices: newIndices,
|
|
364
|
-
primitiveType: topGeo.primitiveType
|
|
398
|
+
indices : newIndices,
|
|
399
|
+
primitiveType : topGeo.primitiveType
|
|
365
400
|
});
|
|
366
401
|
|
|
367
402
|
var geos = {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
403
|
+
topAndBottom : new GeometryInstance({
|
|
404
|
+
geometry : topAndBottomGeo
|
|
405
|
+
})
|
|
371
406
|
};
|
|
372
407
|
|
|
373
408
|
geos.walls = [];
|
|
@@ -376,9 +411,9 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
376
411
|
if (windingOrder === WindingOrder.CLOCKWISE) {
|
|
377
412
|
outerRing = outerRing.reverse();
|
|
378
413
|
}
|
|
379
|
-
var wallGeo = computeWallIndices(outerRing, granularity);
|
|
414
|
+
var wallGeo = computeWallIndices(outerRing, granularity, perPositionHeight);
|
|
380
415
|
geos.walls.push(new GeometryInstance({
|
|
381
|
-
geometry: wallGeo
|
|
416
|
+
geometry : wallGeo
|
|
382
417
|
}));
|
|
383
418
|
|
|
384
419
|
var holes = hierarchy.holes;
|
|
@@ -390,7 +425,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
390
425
|
}
|
|
391
426
|
wallGeo = computeWallIndices(hole, granularity);
|
|
392
427
|
geos.walls.push(new GeometryInstance({
|
|
393
|
-
geometry: wallGeo
|
|
428
|
+
geometry : wallGeo
|
|
394
429
|
}));
|
|
395
430
|
}
|
|
396
431
|
|
|
@@ -410,6 +445,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
410
445
|
* @param {Number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
|
|
411
446
|
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
|
|
412
447
|
* @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.
|
|
448
|
+
* @param {Boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instaed of using options.height to determine the height.
|
|
413
449
|
*
|
|
414
450
|
* @exception {DeveloperError} polygonHierarchy is required.
|
|
415
451
|
*
|
|
@@ -489,9 +525,10 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
489
525
|
var granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
|
|
490
526
|
var stRotation = defaultValue(options.stRotation, 0.0);
|
|
491
527
|
var height = defaultValue(options.height, 0.0);
|
|
528
|
+
var perPositionHeight = defaultValue(options.perPositionHeight, false);
|
|
492
529
|
|
|
493
|
-
var extrudedHeight =
|
|
494
|
-
var extrude = (defined(extrudedHeight) && !CesiumMath.equalsEpsilon(height, extrudedHeight, CesiumMath.EPSILON6));
|
|
530
|
+
var extrudedHeight = options.extrudedHeight;
|
|
531
|
+
var extrude = (defined(extrudedHeight) && (!CesiumMath.equalsEpsilon(height, extrudedHeight, CesiumMath.EPSILON6) || perPositionHeight));
|
|
495
532
|
if (extrude) {
|
|
496
533
|
var h = extrudedHeight;
|
|
497
534
|
extrudedHeight = Math.min(h, height);
|
|
@@ -511,6 +548,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
511
548
|
this._extrudedHeight = extrudedHeight;
|
|
512
549
|
this._extrude = extrude;
|
|
513
550
|
this._polygonHierarchy = polygonHierarchy;
|
|
551
|
+
this._perPositionHeight = perPositionHeight;
|
|
514
552
|
this._workerName = 'createPolygonGeometry';
|
|
515
553
|
};
|
|
516
554
|
|
|
@@ -526,6 +564,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
526
564
|
* @param {Number} [options.stRotation=0.0] The rotation of the texture coordiantes, in radians. A positive rotation is counter-clockwise.
|
|
527
565
|
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
|
|
528
566
|
* @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.
|
|
567
|
+
* @param {Boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
|
|
529
568
|
*
|
|
530
569
|
* @exception {DeveloperError} options.positions is required.
|
|
531
570
|
*
|
|
@@ -560,7 +599,8 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
560
599
|
vertexFormat : options.vertexFormat,
|
|
561
600
|
stRotation : options.stRotation,
|
|
562
601
|
ellipsoid : options.ellipsoid,
|
|
563
|
-
granularity : options.granularity
|
|
602
|
+
granularity : options.granularity,
|
|
603
|
+
perPositionHeight : options.perPositionHeight
|
|
564
604
|
};
|
|
565
605
|
return new PolygonGeometry(newOptions);
|
|
566
606
|
};
|
|
@@ -584,6 +624,7 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
584
624
|
var extrudedHeight = polygonGeometry._extrudedHeight;
|
|
585
625
|
var extrude = polygonGeometry._extrude;
|
|
586
626
|
var polygonHierarchy = polygonGeometry._polygonHierarchy;
|
|
627
|
+
var perPositionHeight = polygonGeometry._perPositionHeight;
|
|
587
628
|
|
|
588
629
|
var boundingSphere;
|
|
589
630
|
var walls;
|
|
@@ -610,8 +651,8 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
610
651
|
if (numChildren === 0) {
|
|
611
652
|
// The outer polygon is a simple polygon with no nested inner polygon.
|
|
612
653
|
polygonHierarchy.push({
|
|
613
|
-
outerRing: outerRing,
|
|
614
|
-
holes: []
|
|
654
|
+
outerRing : outerRing,
|
|
655
|
+
holes : []
|
|
615
656
|
});
|
|
616
657
|
polygons.push(outerRing);
|
|
617
658
|
} else {
|
|
@@ -630,20 +671,20 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
630
671
|
numGrandchildren = hole.holes.length;
|
|
631
672
|
}
|
|
632
673
|
|
|
633
|
-
for (var j = 0; j < numGrandchildren; j++) {
|
|
674
|
+
for ( var j = 0; j < numGrandchildren; j++) {
|
|
634
675
|
queue.enqueue(hole.holes[j]);
|
|
635
676
|
}
|
|
636
677
|
}
|
|
637
678
|
polygonHierarchy.push({
|
|
638
|
-
outerRing: outerRing,
|
|
639
|
-
holes: polygonHoles
|
|
679
|
+
outerRing : outerRing,
|
|
680
|
+
holes : polygonHoles
|
|
640
681
|
});
|
|
641
682
|
var combinedPolygon = PolygonPipeline.eliminateHoles(outerRing, polygonHoles);
|
|
642
683
|
polygons.push(combinedPolygon);
|
|
643
684
|
}
|
|
644
685
|
}
|
|
645
686
|
|
|
646
|
-
outerPositions =
|
|
687
|
+
outerPositions = polygons[0];
|
|
647
688
|
// The bounding volume is just around the boundary points, so there could be cases for
|
|
648
689
|
// contrived polygons on contrived ellipsoids - very oblate ones - where the bounding
|
|
649
690
|
// volume doesn't cover the polygon.
|
|
@@ -654,17 +695,17 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
654
695
|
|
|
655
696
|
if (extrude) {
|
|
656
697
|
for (i = 0; i < polygons.length; i++) {
|
|
657
|
-
geometry = createGeometryFromPositionsExtruded(ellipsoid, polygons[i], granularity, polygonHierarchy[i]);
|
|
698
|
+
geometry = createGeometryFromPositionsExtruded(ellipsoid, polygons[i], granularity, polygonHierarchy[i], perPositionHeight);
|
|
658
699
|
if (defined(geometry)) {
|
|
659
700
|
topAndBottom = geometry.topAndBottom;
|
|
660
|
-
topAndBottom.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(topAndBottom.geometry, height, extrudedHeight, ellipsoid);
|
|
701
|
+
topAndBottom.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(topAndBottom.geometry, height, extrudedHeight, ellipsoid, perPositionHeight);
|
|
661
702
|
topAndBottom.geometry = computeAttributes(vertexFormat, topAndBottom.geometry, outerPositions, ellipsoid, stRotation, true, false);
|
|
662
703
|
geometries.push(topAndBottom);
|
|
663
704
|
|
|
664
705
|
walls = geometry.walls;
|
|
665
|
-
for (var k = 0; k < walls.length; k++) {
|
|
706
|
+
for ( var k = 0; k < walls.length; k++) {
|
|
666
707
|
var wall = walls[k];
|
|
667
|
-
wall.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(wall.geometry, height, extrudedHeight, ellipsoid);
|
|
708
|
+
wall.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(wall.geometry, height, extrudedHeight, ellipsoid, perPositionHeight);
|
|
668
709
|
wall.geometry = computeAttributes(vertexFormat, wall.geometry, outerPositions, ellipsoid, stRotation, true, true);
|
|
669
710
|
geometries.push(wall);
|
|
670
711
|
}
|
|
@@ -672,16 +713,15 @@ define(['Core/defaultValue', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'C
|
|
|
672
713
|
}
|
|
673
714
|
} else {
|
|
674
715
|
for (i = 0; i < polygons.length; i++) {
|
|
675
|
-
geometry = createGeometryFromPositions(ellipsoid, polygons[i], granularity);
|
|
716
|
+
geometry = createGeometryFromPositions(ellipsoid, polygons[i], granularity, perPositionHeight);
|
|
676
717
|
if (defined(geometry)) {
|
|
677
|
-
geometry.geometry = PolygonPipeline.scaleToGeodeticHeight(geometry.geometry, height, ellipsoid);
|
|
718
|
+
geometry.geometry = PolygonPipeline.scaleToGeodeticHeight(geometry.geometry, height, ellipsoid, !perPositionHeight);
|
|
678
719
|
geometry.geometry = computeAttributes(vertexFormat, geometry.geometry, outerPositions, ellipsoid, stRotation, false, false);
|
|
679
720
|
geometries.push(geometry);
|
|
680
721
|
}
|
|
681
722
|
}
|
|
682
723
|
}
|
|
683
724
|
|
|
684
|
-
|
|
685
725
|
geometry = GeometryPipeline.combine(geometries);
|
|
686
726
|
|
|
687
727
|
var center = boundingSphere.center;
|