cesium 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,20 +1,12 @@
|
|
1
1
|
/*global define*/
|
2
|
-
define(['Core/
|
3
|
-
Enumeration,
|
2
|
+
define(['Core/defined', 'Core/DeveloperError', 'Core/Math'], function(
|
4
3
|
defined,
|
5
4
|
DeveloperError,
|
6
|
-
FeatureDetection,
|
7
5
|
CesiumMath) {
|
8
6
|
"use strict";
|
9
7
|
|
10
|
-
// Bail out if the browser doesn't support typed arrays, to prevent the setup function
|
11
|
-
// from failing, since we won't be able to create a WebGL context anyway.
|
12
|
-
if (!FeatureDetection.supportsTypedArrays()) {
|
13
|
-
return {};
|
14
|
-
}
|
15
|
-
|
16
8
|
/**
|
17
|
-
*
|
9
|
+
* Constants for WebGL index datatypes. These corresponds to the
|
18
10
|
* <code>type</code> parameter of <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml">drawElements</a>.
|
19
11
|
*
|
20
12
|
* @alias IndexDatatype
|
@@ -22,40 +14,57 @@ define(['Core/Enumeration', 'Core/defined', 'Core/DeveloperError', 'Core/Feature
|
|
22
14
|
*/
|
23
15
|
var IndexDatatype = {
|
24
16
|
/**
|
25
|
-
* 8-bit unsigned byte
|
17
|
+
* 0x1401. 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
|
26
18
|
* of an element in <code>Uint8Array</code>.
|
27
19
|
*
|
28
|
-
* @type {
|
20
|
+
* @type {Number}
|
29
21
|
* @constant
|
30
|
-
* @default 0x1401
|
31
22
|
*/
|
32
|
-
UNSIGNED_BYTE :
|
33
|
-
sizeInBytes : Uint8Array.BYTES_PER_ELEMENT
|
34
|
-
}),
|
23
|
+
UNSIGNED_BYTE : 0x1401,
|
35
24
|
|
36
25
|
/**
|
37
|
-
* 16-bit unsigned short
|
26
|
+
* 0x1403. 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
|
38
27
|
* of an element in <code>Uint16Array</code>.
|
39
28
|
*
|
40
|
-
* @type {
|
29
|
+
* @type {Number}
|
41
30
|
* @constant
|
42
|
-
* @default 0x1403
|
43
31
|
*/
|
44
|
-
UNSIGNED_SHORT :
|
45
|
-
sizeInBytes : Uint16Array.BYTES_PER_ELEMENT
|
46
|
-
}),
|
32
|
+
UNSIGNED_SHORT : 0x1403,
|
47
33
|
|
48
34
|
/**
|
49
|
-
* 32-bit unsigned int
|
35
|
+
* 0x1405. 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
|
50
36
|
* of an element in <code>Uint32Array</code>.
|
51
37
|
*
|
52
|
-
* @type {
|
38
|
+
* @type {Number}
|
53
39
|
* @constant
|
54
|
-
* @default 0x1405
|
55
40
|
*/
|
56
|
-
UNSIGNED_INT :
|
57
|
-
|
58
|
-
|
41
|
+
UNSIGNED_INT : 0x1405
|
42
|
+
};
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Returns the size, in bytes, of the corresponding datatype.
|
46
|
+
*
|
47
|
+
* @param {IndexDatatype} indexDatatype The index datatype to get the size of.
|
48
|
+
*
|
49
|
+
* @returns {Number} The size in bytes.
|
50
|
+
*
|
51
|
+
* @exception {DeveloperError} indexDatatype is required and must be a valid IndexDatatype constant.
|
52
|
+
*
|
53
|
+
* @example
|
54
|
+
* // Returns 2
|
55
|
+
* var size = IndexDatatype.getSizeInBytes(IndexDatatype.UNSIGNED_SHORT);
|
56
|
+
*/
|
57
|
+
IndexDatatype.getSizeInBytes = function(indexDatatype) {
|
58
|
+
switch(indexDatatype) {
|
59
|
+
case IndexDatatype.UNSIGNED_BYTE:
|
60
|
+
return Uint8Array.BYTES_PER_ELEMENT;
|
61
|
+
case IndexDatatype.UNSIGNED_SHORT:
|
62
|
+
return Uint16Array.BYTES_PER_ELEMENT;
|
63
|
+
case IndexDatatype.UNSIGNED_INT:
|
64
|
+
return Uint32Array.BYTES_PER_ELEMENT;
|
65
|
+
}
|
66
|
+
|
67
|
+
throw new DeveloperError('indexDatatype is required and must be a valid IndexDatatype constant.');
|
59
68
|
};
|
60
69
|
|
61
70
|
/**
|
@@ -63,18 +72,18 @@ define(['Core/Enumeration', 'Core/defined', 'Core/DeveloperError', 'Core/Feature
|
|
63
72
|
*
|
64
73
|
* @param {IndexDatatype} indexDatatype The index datatype to validate.
|
65
74
|
*
|
66
|
-
* @returns {Boolean} <code>true</code> if the provided index datatype is a valid
|
75
|
+
* @returns {Boolean} <code>true</code> if the provided index datatype is a valid value; otherwise, <code>false</code>.
|
67
76
|
*
|
68
77
|
* @example
|
69
78
|
* if (!IndexDatatype.validate(indexDatatype)) {
|
70
|
-
* throw new DeveloperError('indexDatatype must be a valid
|
79
|
+
* throw new DeveloperError('indexDatatype must be a valid value.');
|
71
80
|
* }
|
72
81
|
*/
|
73
82
|
IndexDatatype.validate = function(indexDatatype) {
|
74
|
-
return defined(indexDatatype) &&
|
75
|
-
(indexDatatype
|
76
|
-
indexDatatype
|
77
|
-
indexDatatype
|
83
|
+
return defined(indexDatatype) &&
|
84
|
+
(indexDatatype === IndexDatatype.UNSIGNED_BYTE ||
|
85
|
+
indexDatatype === IndexDatatype.UNSIGNED_SHORT ||
|
86
|
+
indexDatatype === IndexDatatype.UNSIGNED_INT);
|
78
87
|
};
|
79
88
|
|
80
89
|
/**
|
@@ -0,0 +1,118 @@
|
|
1
|
+
/*global define*/
|
2
|
+
define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Spline', 'Core/Cartesian3'], function(
|
3
|
+
defaultValue,
|
4
|
+
defined,
|
5
|
+
DeveloperError,
|
6
|
+
Spline,
|
7
|
+
Cartesian3) {
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* A spline that uses piecewise linear interpolation to create a curve.
|
12
|
+
*
|
13
|
+
* @alias LinearSpline
|
14
|
+
* @constructor
|
15
|
+
*
|
16
|
+
* @param {Array} options.times The array of control point times.
|
17
|
+
* @param {Array} options.points The array of control points.
|
18
|
+
*
|
19
|
+
* @exception {DeveloperError} points is required.
|
20
|
+
* @exception {DeveloperError} points.length must be greater than or equal to 2.
|
21
|
+
* @exception {DeveloperError} times is required.
|
22
|
+
* @exception {DeveloperError} times.length must be equal to points.length.
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* var spline = new LinearSpline({
|
26
|
+
* times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
|
27
|
+
* points : [
|
28
|
+
* new Cartesian3(1235398.0, -4810983.0, 4146266.0),
|
29
|
+
* new Cartesian3(1372574.0, -5345182.0, 4606657.0),
|
30
|
+
* new Cartesian3(-757983.0, -5542796.0, 4514323.0),
|
31
|
+
* new Cartesian3(-2821260.0, -5248423.0, 4021290.0),
|
32
|
+
* new Cartesian3(-2539788.0, -4724797.0, 3620093.0)
|
33
|
+
* ]
|
34
|
+
* });
|
35
|
+
*/
|
36
|
+
var LinearSpline = function(options) {
|
37
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
38
|
+
|
39
|
+
var points = options.points;
|
40
|
+
var times = options.times;
|
41
|
+
|
42
|
+
if (!defined(points)) {
|
43
|
+
throw new DeveloperError('points is required.');
|
44
|
+
}
|
45
|
+
|
46
|
+
if (points.length < 2) {
|
47
|
+
throw new DeveloperError('points.length must be greater than or equal to 2.');
|
48
|
+
}
|
49
|
+
|
50
|
+
if (!defined(times)) {
|
51
|
+
throw new DeveloperError('times is required.');
|
52
|
+
}
|
53
|
+
|
54
|
+
if (times.length !== points.length) {
|
55
|
+
throw new DeveloperError('times.length must be equal to points.length.');
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* An array of times for the control points.
|
60
|
+
* @type {Array}
|
61
|
+
* @readonly
|
62
|
+
*/
|
63
|
+
this.times = times;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* An array of {@link Cartesian3} control points.
|
67
|
+
* @type {Array}
|
68
|
+
* @readonly
|
69
|
+
*/
|
70
|
+
this.points = points;
|
71
|
+
|
72
|
+
this._lastTimeIndex = 0;
|
73
|
+
};
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Finds an index <code>i</code> in <code>times</code> such that the parameter
|
77
|
+
* <code>time</code> is in the interval <code>[times[i], times[i + 1]]</code>.
|
78
|
+
* @memberof QuaternionSpline
|
79
|
+
*
|
80
|
+
* @param {Number} time The time.
|
81
|
+
* @returns {Number} The index for the element at the start of the interval.
|
82
|
+
*
|
83
|
+
* @exception {DeveloperError} time is required.
|
84
|
+
* @exception {DeveloperError} time must be in the range <code>[t<sub>0</sub>, t<sub>n</sub>]</code>, where <code>t<sub>0</sub></code>
|
85
|
+
* is the first element in the array <code>times</code> and <code>t<sub>n</sub></code> is the last element
|
86
|
+
* in the array <code>times</code>.
|
87
|
+
*/
|
88
|
+
LinearSpline.prototype.findTimeInterval = Spline.prototype.findTimeInterval;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Evaluates the curve at a given time.
|
92
|
+
* @memberof LinearSpline
|
93
|
+
*
|
94
|
+
* @param {Number} time The time at which to evaluate the curve.
|
95
|
+
* @param {Cartesian3} [result] The object onto which to store the result.
|
96
|
+
* @returns {Cartesian3} The modified result parameter or a new instance of the point on the curve at the given time.
|
97
|
+
*
|
98
|
+
* @exception {DeveloperError} time is required.
|
99
|
+
* @exception {DeveloperError} time must be in the range <code>[t<sub>0</sub>, t<sub>n</sub>]</code>, where <code>t<sub>0</sub></code>
|
100
|
+
* is the first element in the array <code>times</code> and <code>t<sub>n</sub></code> is the last element
|
101
|
+
* in the array <code>times</code>.
|
102
|
+
*/
|
103
|
+
LinearSpline.prototype.evaluate = function(time, result) {
|
104
|
+
var points = this.points;
|
105
|
+
var times = this.times;
|
106
|
+
|
107
|
+
var i = this._lastTimeIndex = this.findTimeInterval(time, this._lastTimeIndex);
|
108
|
+
var u = (time - times[i]) / (times[i + 1] - times[i]);
|
109
|
+
|
110
|
+
if (!defined(result)) {
|
111
|
+
result = new Cartesian3();
|
112
|
+
}
|
113
|
+
|
114
|
+
return Cartesian3.lerp(points[i], points[i + 1], u, result);
|
115
|
+
};
|
116
|
+
|
117
|
+
return LinearSpline;
|
118
|
+
});
|
@@ -535,19 +535,50 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'ThirdParty/
|
|
535
535
|
*
|
536
536
|
* @returns {Boolean} <code>true</code> if the number if a power of two; otherwise, <code>false</code>.
|
537
537
|
*
|
538
|
+
* @exception {DeveloperError} A number greater than or equal to 0 is required.
|
539
|
+
*
|
538
540
|
* @example
|
539
541
|
* var t = CesiumMath.isPowerOfTwo(16); // true
|
540
542
|
* var f = CesiumMath.isPowerOfTwo(20); // false
|
543
|
+
*/
|
544
|
+
CesiumMath.isPowerOfTwo = function(n) {
|
545
|
+
if (typeof n !== 'number' || n < 0) {
|
546
|
+
throw new DeveloperError('A number greater than or equal to 0 is required.');
|
547
|
+
}
|
548
|
+
|
549
|
+
return (n !== 0) && ((n & (n - 1)) === 0);
|
550
|
+
};
|
551
|
+
|
552
|
+
/**
|
553
|
+
* Computes the next power-of-two integer greater than or equal to the provided positive integer.
|
554
|
+
*
|
555
|
+
* @memberof CesiumMath
|
556
|
+
*
|
557
|
+
* @param {Number} n The positive integer to test.
|
558
|
+
*
|
559
|
+
* @returns {Number} The next power-of-two integer.
|
541
560
|
*
|
542
561
|
* @exception {DeveloperError} A number greater than or equal to 0 is required.
|
562
|
+
*
|
563
|
+
* @example
|
564
|
+
* var n = CesiumMath.nextPowerOfTwo(29); // 32
|
565
|
+
* var m = CesiumMath.nextPowerOfTwo(32); // 32
|
543
566
|
*/
|
544
|
-
CesiumMath.
|
567
|
+
CesiumMath.nextPowerOfTwo = function(n) {
|
545
568
|
if (typeof n !== 'number' || n < 0) {
|
546
569
|
throw new DeveloperError('A number greater than or equal to 0 is required.');
|
547
570
|
}
|
548
571
|
|
549
|
-
|
550
|
-
|
572
|
+
// From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
573
|
+
--n;
|
574
|
+
n |= n >> 1;
|
575
|
+
n |= n >> 2;
|
576
|
+
n |= n >> 4;
|
577
|
+
n |= n >> 8;
|
578
|
+
n |= n >> 16;
|
579
|
+
++n;
|
580
|
+
|
581
|
+
return n;
|
551
582
|
};
|
552
583
|
|
553
584
|
/**
|
@@ -543,6 +543,32 @@ define(['Core/Cartesian2', 'Core/defaultValue', 'Core/defined', 'Core/DeveloperE
|
|
543
543
|
return result;
|
544
544
|
};
|
545
545
|
|
546
|
+
/**
|
547
|
+
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
548
|
+
* @memberof Matrix2
|
549
|
+
*
|
550
|
+
* @param {Matrix2} matrix The matrix with signed elements.
|
551
|
+
* @param {Matrix2} [result] The object onto which to store the result.
|
552
|
+
* @returns {Matrix2} The modified result parameter or a new Matrix2 instance if one was not provided.
|
553
|
+
*
|
554
|
+
* @exception {DeveloperError} matrix is required.
|
555
|
+
*/
|
556
|
+
Matrix2.abs = function(matrix, result) {
|
557
|
+
if (!defined(matrix)) {
|
558
|
+
throw new DeveloperError('matrix is required');
|
559
|
+
}
|
560
|
+
if (!defined(result)) {
|
561
|
+
return new Matrix2(Math.abs(matrix[0]), Math.abs(matrix[2]),
|
562
|
+
Math.abs(matrix[1]), Math.abs(matrix[3]));
|
563
|
+
}
|
564
|
+
result[0] = Math.abs(matrix[0]);
|
565
|
+
result[1] = Math.abs(matrix[1]);
|
566
|
+
result[2] = Math.abs(matrix[2]);
|
567
|
+
result[3] = Math.abs(matrix[3]);
|
568
|
+
|
569
|
+
return result;
|
570
|
+
};
|
571
|
+
|
546
572
|
/**
|
547
573
|
* Compares the provided matrices componentwise and returns
|
548
574
|
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
@@ -939,6 +939,104 @@ define(['Core/Cartesian3', 'Core/defaultValue', 'Core/defined', 'Core/DeveloperE
|
|
939
939
|
return result;
|
940
940
|
};
|
941
941
|
|
942
|
+
/**
|
943
|
+
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
944
|
+
* @memberof Matrix3
|
945
|
+
*
|
946
|
+
* @param {Matrix3} matrix The matrix with signed elements.
|
947
|
+
* @param {Matrix3} [result] The object onto which to store the result.
|
948
|
+
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
|
949
|
+
*
|
950
|
+
* @exception {DeveloperError} matrix is required.
|
951
|
+
*/
|
952
|
+
Matrix3.abs = function(matrix, result) {
|
953
|
+
if (!defined(matrix)) {
|
954
|
+
throw new DeveloperError('matrix is required');
|
955
|
+
}
|
956
|
+
if (!defined(result)) {
|
957
|
+
return new Matrix3(Math.abs(matrix[0]), Math.abs(matrix[3]), Math.abs(matrix[6]),
|
958
|
+
Math.abs(matrix[1]), Math.abs(matrix[4]), Math.abs(matrix[7]),
|
959
|
+
Math.abs(matrix[2]), Math.abs(matrix[5]), Math.abs(matrix[8]));
|
960
|
+
}
|
961
|
+
result[0] = Math.abs(matrix[0]);
|
962
|
+
result[1] = Math.abs(matrix[1]);
|
963
|
+
result[2] = Math.abs(matrix[2]);
|
964
|
+
result[3] = Math.abs(matrix[3]);
|
965
|
+
result[4] = Math.abs(matrix[4]);
|
966
|
+
result[5] = Math.abs(matrix[5]);
|
967
|
+
result[6] = Math.abs(matrix[6]);
|
968
|
+
result[7] = Math.abs(matrix[7]);
|
969
|
+
result[8] = Math.abs(matrix[8]);
|
970
|
+
|
971
|
+
return result;
|
972
|
+
};
|
973
|
+
|
974
|
+
/**
|
975
|
+
* Computes the determinant of the provided matrix.
|
976
|
+
* @memberof Matrix3
|
977
|
+
*
|
978
|
+
* @param {Matrix3} matrix The matrix to use.
|
979
|
+
* @returns {Number} The value of the determinant of the matrix.
|
980
|
+
*
|
981
|
+
* @exception {DeveloperError} matrix is required.
|
982
|
+
*/
|
983
|
+
Matrix3.determinant = function(matrix) {
|
984
|
+
if (!defined(matrix)) {
|
985
|
+
throw new DeveloperError('matrix is required');
|
986
|
+
}
|
987
|
+
|
988
|
+
var m11 = matrix[0];
|
989
|
+
var m21 = matrix[3];
|
990
|
+
var m31 = matrix[6];
|
991
|
+
var m12 = matrix[1];
|
992
|
+
var m22 = matrix[4];
|
993
|
+
var m32 = matrix[7];
|
994
|
+
var m13 = matrix[2];
|
995
|
+
var m23 = matrix[5];
|
996
|
+
var m33 = matrix[8];
|
997
|
+
|
998
|
+
return m11 * (m22 * m33 - m23 * m32) + m12 * (m23 * m31 - m21 * m33) + m13 * (m21 * m32 - m22 * m31);
|
999
|
+
};
|
1000
|
+
|
1001
|
+
/**
|
1002
|
+
* Computes the inverse of the provided matrix.
|
1003
|
+
* @memberof Matrix3
|
1004
|
+
*
|
1005
|
+
* @param {Matrix3} matrix The matrix to invert.
|
1006
|
+
* @param {Matrix3} [result] The object onto which to store the result.
|
1007
|
+
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
|
1008
|
+
*
|
1009
|
+
* @exception {DeveloperError} matrix is required.
|
1010
|
+
* @exception {DeveloperError} matrix is not invertible.
|
1011
|
+
*/
|
1012
|
+
Matrix3.inverse = function(matrix, result) {
|
1013
|
+
if (!defined(matrix)) {
|
1014
|
+
throw new DeveloperError('matrix is required');
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
var m11 = matrix[0];
|
1018
|
+
var m21 = matrix[1];
|
1019
|
+
var m31 = matrix[2];
|
1020
|
+
var m12 = matrix[3];
|
1021
|
+
var m22 = matrix[4];
|
1022
|
+
var m32 = matrix[5];
|
1023
|
+
var m13 = matrix[6];
|
1024
|
+
var m23 = matrix[7];
|
1025
|
+
var m33 = matrix[8];
|
1026
|
+
|
1027
|
+
var determinant = Matrix3.determinant(matrix);
|
1028
|
+
|
1029
|
+
if (Math.abs(determinant) <= CesiumMath.EPSILON15) {
|
1030
|
+
throw new DeveloperError('matrix is not invertible');
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
var m = new Matrix3(m22 * m33 - m23 * m32, m13 * m32 - m12 * m33, m12 * m23 - m13 * m22,
|
1034
|
+
m23 * m31 - m21 * m33, m11 * m33 - m13 * m31, m13 * m21 - m11 * m23,
|
1035
|
+
m21 * m32 - m22 * m31, m12 * m31 - m11 * m32, m11 * m22 - m12 * m21);
|
1036
|
+
var scale = 1.0 / determinant;
|
1037
|
+
return Matrix3.multiplyByScalar(m, scale, result);
|
1038
|
+
};
|
1039
|
+
|
942
1040
|
/**
|
943
1041
|
* Compares the provided matrices componentwise and returns
|
944
1042
|
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
@@ -1681,6 +1681,48 @@ define(['Core/Cartesian3', 'Core/Cartesian4', 'Core/defaultValue', 'Core/defined
|
|
1681
1681
|
return result;
|
1682
1682
|
};
|
1683
1683
|
|
1684
|
+
/**
|
1685
|
+
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
1686
|
+
* @memberof Matrix4
|
1687
|
+
*
|
1688
|
+
* @param {Matrix4} matrix The matrix with signed elements.
|
1689
|
+
* @param {Matrix4} [result] The object onto which to store the result.
|
1690
|
+
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
|
1691
|
+
*
|
1692
|
+
* @exception {DeveloperError} matrix is required.
|
1693
|
+
*/
|
1694
|
+
Matrix4.abs = function(matrix, result) {
|
1695
|
+
if (!defined(matrix)) {
|
1696
|
+
throw new DeveloperError('matrix is required');
|
1697
|
+
}
|
1698
|
+
if (!defined(result)) {
|
1699
|
+
return new Matrix4(Math.abs(matrix[0]), Math.abs(matrix[4]), Math.abs(matrix[8]), Math.abs(matrix[12]),
|
1700
|
+
Math.abs(matrix[1]), Math.abs(matrix[5]), Math.abs(matrix[9]), Math.abs(matrix[13]),
|
1701
|
+
Math.abs(matrix[2]), Math.abs(matrix[6]), Math.abs(matrix[10]), Math.abs(matrix[14]),
|
1702
|
+
Math.abs(matrix[3]), Math.abs(matrix[7]), Math.abs(matrix[11]), Math.abs(matrix[15]));
|
1703
|
+
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
result[0] = Math.abs(matrix[0]);
|
1707
|
+
result[1] = Math.abs(matrix[1]);
|
1708
|
+
result[2] = Math.abs(matrix[2]);
|
1709
|
+
result[3] = Math.abs(matrix[3]);
|
1710
|
+
result[4] = Math.abs(matrix[4]);
|
1711
|
+
result[5] = Math.abs(matrix[5]);
|
1712
|
+
result[6] = Math.abs(matrix[6]);
|
1713
|
+
result[7] = Math.abs(matrix[7]);
|
1714
|
+
result[8] = Math.abs(matrix[8]);
|
1715
|
+
result[9] = Math.abs(matrix[9]);
|
1716
|
+
result[10] = Math.abs(matrix[10]);
|
1717
|
+
result[11] = Math.abs(matrix[11]);
|
1718
|
+
result[12] = Math.abs(matrix[12]);
|
1719
|
+
result[13] = Math.abs(matrix[13]);
|
1720
|
+
result[14] = Math.abs(matrix[14]);
|
1721
|
+
result[15] = Math.abs(matrix[15]);
|
1722
|
+
|
1723
|
+
return result;
|
1724
|
+
};
|
1725
|
+
|
1684
1726
|
/**
|
1685
1727
|
* Compares the provided matrices componentwise and returns
|
1686
1728
|
* <code>true</code> if they are equal, <code>false</code> otherwise.
|