@openglobus/og 0.16.2 → 0.17.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.
- package/README.md +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +2 -3
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +50 -63
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +26 -24
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/src/og/astro/orbit.js
CHANGED
|
@@ -1,123 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
return math.solve_iteration_fixed(
|
|
17
|
-
} else if (ecc < 0
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return M;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
trueAnomaly
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
res._m[
|
|
114
|
-
res._m[
|
|
115
|
-
res._m[
|
|
116
|
-
res._m[
|
|
117
|
-
res._m[
|
|
118
|
-
res
|
|
119
|
-
|
|
120
|
-
res._m[7] = -cosraan * sini;
|
|
121
|
-
res._m[8] = cosi;
|
|
122
|
-
return res;
|
|
123
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as math from "../math.js";
|
|
4
|
+
import { Mat3 } from "../math/Mat3.js";
|
|
5
|
+
|
|
6
|
+
export function getEccentricAnomaly(M, ecc) {
|
|
7
|
+
if (ecc == 0.0) {
|
|
8
|
+
// Circular orbit
|
|
9
|
+
return M;
|
|
10
|
+
} else if (ecc < 0.2) {
|
|
11
|
+
// Low eccentricity, so use the standard iteration technique
|
|
12
|
+
return math.solve_iteration_fixed(solveKeplerFunc1(ecc, M), M, 5);
|
|
13
|
+
} else if (ecc < 0.9) {
|
|
14
|
+
// Higher eccentricity elliptical orbit; use a more complex but
|
|
15
|
+
// much faster converging iteration.
|
|
16
|
+
return math.solve_iteration_fixed(solveKeplerFunc2(ecc, M), M, 6);
|
|
17
|
+
} else if (ecc < 1.0) {
|
|
18
|
+
// Extremely stable Laguerre-Conway method for solving Kepler's
|
|
19
|
+
// equation. Only use this for high-eccentricity orbits, as it
|
|
20
|
+
// requires more calcuation.
|
|
21
|
+
let E = M + 0.85 * ecc * Math.sign(Math.sin(M));
|
|
22
|
+
return math.solve_iteration_fixed(solveKeplerLaguerreConway(ecc, M), E, 8);
|
|
23
|
+
} else if (ecc == 1.0) {
|
|
24
|
+
// TODO: Parabolic orbit
|
|
25
|
+
return M;
|
|
26
|
+
} else {
|
|
27
|
+
// Laguerre-Conway method for hyperbolic (ecc > 1) orbits.
|
|
28
|
+
let E = Math.log((2 * M) / ecc + 1.85);
|
|
29
|
+
return math.solve_iteration_fixed(solveKeplerLaguerreConwayHyp(ecc, M), E, 30);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Standard iteration for solving Kepler's Equation
|
|
34
|
+
function solveKeplerFunc1(ecc, M) {
|
|
35
|
+
return function (x) {
|
|
36
|
+
return M + ecc * Math.sin(x);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Faster converging iteration for Kepler's Equation; more efficient
|
|
41
|
+
// than above for orbits with eccentricities greater than 0.3. This
|
|
42
|
+
// is from Jean Meeus's _Astronomical Algorithms_ (2nd ed), p. 199
|
|
43
|
+
function solveKeplerFunc2(ecc, M) {
|
|
44
|
+
return function (x) {
|
|
45
|
+
return x + (M + ecc * Math.sin(x) - x) / (1 - ecc * Math.cos(x));
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function solveKeplerLaguerreConway(ecc, M) {
|
|
50
|
+
return function (x) {
|
|
51
|
+
var s = ecc * Math.sin(x);
|
|
52
|
+
var c = ecc * Math.cos(x);
|
|
53
|
+
var f = x - s - M;
|
|
54
|
+
var f1 = 1 - c;
|
|
55
|
+
var f2 = s;
|
|
56
|
+
x += (-5 * f) / (f1 + Math.sign(f1) * Math.sqrt(Math.abs(16 * f1 * f1 - 20 * f * f2)));
|
|
57
|
+
return x;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function solveKeplerLaguerreConwayHyp(ecc, M) {
|
|
62
|
+
return function (x) {
|
|
63
|
+
var s = ecc * Math.sinh(x);
|
|
64
|
+
var c = ecc * Math.cosh(x);
|
|
65
|
+
var f = s - x - M;
|
|
66
|
+
var f1 = c - 1;
|
|
67
|
+
var f2 = s;
|
|
68
|
+
x += (-5 * f) / (f1 + Math.sign(f1) * Math.sqrt(Math.abs(16 * f1 * f1 - 20 * f * f2)));
|
|
69
|
+
return x;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getEllipticalEccentricAnomaly(meanAnomaly, eccentricity) {
|
|
74
|
+
var tol = 0.00000001745;
|
|
75
|
+
var iterations = 20;
|
|
76
|
+
var e = meanAnomaly - 2.0 * Math.PI * ((meanAnomaly / (2.0 * Math.PI)) | 0);
|
|
77
|
+
var err = 1;
|
|
78
|
+
while (Math.abs(err) > tol && iterations > 0) {
|
|
79
|
+
err = e - eccentricity * Math.sin(e) - meanAnomaly;
|
|
80
|
+
var delta = err / (1 - eccentricity * Math.cos(e));
|
|
81
|
+
e -= delta;
|
|
82
|
+
iterations--;
|
|
83
|
+
}
|
|
84
|
+
return e;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function getTrueAnomaly(eccentricAnomaly, eccentricity) {
|
|
88
|
+
var revs = Math.floor(eccentricAnomaly / math.TWO_PI);
|
|
89
|
+
eccentricAnomaly -= revs * math.TWO_PI;
|
|
90
|
+
var trueAnomaly = Math.atan2(
|
|
91
|
+
Math.sin(eccentricAnomaly) * Math.sqrt(1 - eccentricity * eccentricity),
|
|
92
|
+
Math.cos(eccentricAnomaly) - eccentricity
|
|
93
|
+
);
|
|
94
|
+
trueAnomaly = math.zeroTwoPI(trueAnomaly);
|
|
95
|
+
if (eccentricAnomaly < 0) {
|
|
96
|
+
trueAnomaly -= math.TWO_PI;
|
|
97
|
+
}
|
|
98
|
+
return trueAnomaly + revs * math.TWO_PI;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getPerifocalToCartesianMatrix(argumentOfPeriapsis, inclination, rightAscension) {
|
|
102
|
+
var res = new Mat3();
|
|
103
|
+
var cosap = Math.cos(argumentOfPeriapsis),
|
|
104
|
+
sinap = Math.sin(argumentOfPeriapsis),
|
|
105
|
+
cosi = Math.cos(inclination),
|
|
106
|
+
sini = Math.sin(inclination),
|
|
107
|
+
cosraan = Math.cos(rightAscension),
|
|
108
|
+
sinraan = Math.sin(rightAscension);
|
|
109
|
+
res._m[0] = cosraan * cosap - sinraan * sinap * cosi;
|
|
110
|
+
res._m[1] = sinraan * cosap + cosraan * sinap * cosi;
|
|
111
|
+
res._m[2] = sinap * sini;
|
|
112
|
+
res._m[3] = -cosraan * sinap - sinraan * cosap * cosi;
|
|
113
|
+
res._m[4] = -sinraan * sinap + cosraan * cosap * cosi;
|
|
114
|
+
res._m[5] = cosap * sini;
|
|
115
|
+
res._m[6] = sinraan * sini;
|
|
116
|
+
res._m[7] = -cosraan * sini;
|
|
117
|
+
res._m[8] = cosi;
|
|
118
|
+
return res;
|
|
119
|
+
}
|
package/src/og/astro/rotation.js
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
res._m[
|
|
30
|
-
res._m[
|
|
31
|
-
res._m[
|
|
32
|
-
res._m[
|
|
33
|
-
res._m[
|
|
34
|
-
|
|
35
|
-
res
|
|
36
|
-
|
|
37
|
-
res._m[8] = zAxis.z;
|
|
38
|
-
|
|
39
|
-
return res;
|
|
40
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { PI_TWO } from "../math.js";
|
|
4
|
+
import { Mat3 } from "../math/Mat3.js";
|
|
5
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
6
|
+
|
|
7
|
+
export function getRotationMatrix(rightAscension, declination, res) {
|
|
8
|
+
let xAxis = new Vec3(),
|
|
9
|
+
zAxis = new Vec3();
|
|
10
|
+
|
|
11
|
+
res = res || new Mat3();
|
|
12
|
+
|
|
13
|
+
xAxis.x = Math.cos(rightAscension + PI_TWO);
|
|
14
|
+
xAxis.y = Math.sin(rightAscension + PI_TWO);
|
|
15
|
+
xAxis.z = 0.0;
|
|
16
|
+
|
|
17
|
+
let cosDec = Math.cos(declination);
|
|
18
|
+
|
|
19
|
+
zAxis.x = cosDec * Math.cos(rightAscension);
|
|
20
|
+
zAxis.y = cosDec * Math.sin(rightAscension);
|
|
21
|
+
zAxis.z = Math.sin(declination);
|
|
22
|
+
|
|
23
|
+
let yAxis = zAxis.cross(xAxis);
|
|
24
|
+
|
|
25
|
+
res._m[0] = xAxis.x;
|
|
26
|
+
res._m[1] = yAxis.x;
|
|
27
|
+
res._m[2] = zAxis.x;
|
|
28
|
+
res._m[3] = xAxis.y;
|
|
29
|
+
res._m[4] = yAxis.y;
|
|
30
|
+
res._m[5] = zAxis.y;
|
|
31
|
+
res._m[6] = xAxis.z;
|
|
32
|
+
res._m[7] = yAxis.z;
|
|
33
|
+
res._m[8] = zAxis.z;
|
|
34
|
+
|
|
35
|
+
return res;
|
|
36
|
+
}
|
package/src/og/bv/Box.js
CHANGED
|
@@ -1,81 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
new Vec3(),
|
|
26
|
-
new Vec3(),
|
|
27
|
-
new Vec3(),
|
|
28
|
-
new Vec3()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
v[
|
|
61
|
-
v[
|
|
62
|
-
v[
|
|
63
|
-
v[
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { Box };
|
|
81
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bounding box class.
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
class Box {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {*} boundsArr
|
|
13
|
+
*/
|
|
14
|
+
constructor(boundsArr = [0, 0, 0, 0, 0, 0]) {
|
|
15
|
+
/**
|
|
16
|
+
* Vertices array.
|
|
17
|
+
* @public
|
|
18
|
+
* @type{Array.<Vec3>}
|
|
19
|
+
*/
|
|
20
|
+
this.vertices = [
|
|
21
|
+
new Vec3(),
|
|
22
|
+
new Vec3(),
|
|
23
|
+
new Vec3(),
|
|
24
|
+
new Vec3(),
|
|
25
|
+
new Vec3(),
|
|
26
|
+
new Vec3(),
|
|
27
|
+
new Vec3(),
|
|
28
|
+
new Vec3()
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
if (boundsArr) {
|
|
32
|
+
this.setFromBoundsArr(boundsArr);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
copy(bbox) {
|
|
37
|
+
for (let i = 0, len = this.vertices.length; i < len; i++) {
|
|
38
|
+
this.vertices[i].copy(bbox.vertices[i]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sets bounding box coordinates by the bounds array.
|
|
44
|
+
* @param {Array.<number>} bounds - Bounds is an array where [minX, minY, minZ, maxX, maxY, maxZ]
|
|
45
|
+
*/
|
|
46
|
+
setFromBoundsArr(bounds) {
|
|
47
|
+
var xmin = bounds[0],
|
|
48
|
+
xmax = bounds[3],
|
|
49
|
+
ymin = bounds[1],
|
|
50
|
+
ymax = bounds[4],
|
|
51
|
+
zmin = bounds[2],
|
|
52
|
+
zmax = bounds[5];
|
|
53
|
+
|
|
54
|
+
var v = this.vertices;
|
|
55
|
+
|
|
56
|
+
v[0].set(xmin, ymin, zmin);
|
|
57
|
+
v[1].set(xmax, ymin, zmin);
|
|
58
|
+
v[2].set(xmax, ymin, zmax);
|
|
59
|
+
v[3].set(xmin, ymin, zmax);
|
|
60
|
+
v[4].set(xmin, ymax, zmin);
|
|
61
|
+
v[5].set(xmax, ymax, zmin);
|
|
62
|
+
v[6].set(xmax, ymax, zmax);
|
|
63
|
+
v[7].set(xmin, ymax, zmax);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Sets bounding box coordinates by ellipsoid geodetic extend.
|
|
68
|
+
* @param {Ellipsoid} ellipsoid - Ellipsoid.
|
|
69
|
+
* @param {Extent} extent - Geodetic extent.
|
|
70
|
+
*/
|
|
71
|
+
setFromExtent(ellipsoid, extent) {
|
|
72
|
+
this.setFromBoundsArr(extent.getCartesianBounds(ellipsoid));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { Box };
|
|
77
|
+
|
package/src/og/bv/Sphere.js
CHANGED
|
@@ -1,61 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { Sphere };
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bounding sphere class.
|
|
7
|
+
* @class
|
|
8
|
+
* @param {Number} [radius] - Bounding sphere radius.
|
|
9
|
+
* @param {Vec3} [center] - Bounding sphere coordinates.
|
|
10
|
+
*/
|
|
11
|
+
class Sphere {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {number} radius
|
|
15
|
+
* @param {Vec3} center
|
|
16
|
+
*/
|
|
17
|
+
constructor(radius = 0, center = Vec3.ZERO) {
|
|
18
|
+
/**
|
|
19
|
+
* Sphere radius.
|
|
20
|
+
* @public
|
|
21
|
+
* @type {Number}
|
|
22
|
+
*/
|
|
23
|
+
this.radius = radius;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sphere coordinates.
|
|
27
|
+
* @public
|
|
28
|
+
* @type {Vec3}
|
|
29
|
+
*/
|
|
30
|
+
this.center = center ? center.clone() : new Vec3();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sets bounding sphere coordinates by the bounds array.
|
|
35
|
+
* @param {Array.<number>} bounds - Bounds is an array where [minX, minY, minZ, maxX, maxY, maxZ]
|
|
36
|
+
*/
|
|
37
|
+
setFromBounds(bounds) {
|
|
38
|
+
let m = new Vec3(bounds[0], bounds[1], bounds[2]);
|
|
39
|
+
this.center.set(
|
|
40
|
+
m.x + (bounds[3] - m.x) * 0.5,
|
|
41
|
+
m.y + (bounds[3] - m.y) * 0.5,
|
|
42
|
+
m.z + (bounds[5] - m.z) * 0.5
|
|
43
|
+
);
|
|
44
|
+
this.radius = this.center.distance(m);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sets bounding sphere coordinates by ellipsoid geodetic extend.
|
|
49
|
+
* @param {Ellipsoid} ellipsoid - Ellipsoid.
|
|
50
|
+
* @param {Extent} extent - Geodetic extent.
|
|
51
|
+
*/
|
|
52
|
+
setFromExtent(ellipsoid, extent) {
|
|
53
|
+
this.setFromBounds(extent.getCartesianBounds(ellipsoid));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Sphere };
|