@openglobus/og 0.10.4 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/og.css +1 -1
- package/package.json +11 -9
- package/src/og/Extent.js +274 -273
- package/src/og/Globe.js +11 -3
- package/src/og/LonLat.js +152 -146
- package/src/og/Popup.js +2 -1
- package/src/og/camera/PlanetCamera.js +112 -38
- package/src/og/control/EarthNavigation.js +259 -0
- package/src/og/control/MouseNavigation.js +68 -40
- package/src/og/entity/EntityCollection.js +1 -1
- package/src/og/entity/LabelHandler.js +366 -74
- package/src/og/entity/Polyline.js +3 -2
- package/src/og/layer/CanvasTiles.js +32 -30
- package/src/og/layer/KML.js +159 -0
- package/src/og/layer/Vector.js +5 -0
- package/src/og/layer/index.js +2 -1
- package/src/og/math/Vec2.js +448 -448
- package/src/og/math/Vec3.js +759 -757
- package/src/og/math/Vec4.js +216 -215
- package/src/og/quadTree/Node.js +67 -13
- package/src/og/renderer/RendererEvents.js +21 -16
- package/src/og/scene/Planet.js +25 -10
- package/src/og/segment/Segment.js +3 -3
- package/src/og/segment/SegmentLonLat.js +7 -0
- package/src/og/terrain/GlobusTerrain.js +4 -0
- package/src/og/utils/FontAtlas.js +1 -0
- package/src/og/utils/GeoImageCreator.js +123 -121
- package/src/og/utils/Loader.js +81 -80
- package/src/og/utils/NormalMapCreator.js +320 -318
- package/src/og/utils/VectorTileCreator.js +251 -250
- package/src/og/webgl/Framebuffer.js +265 -264
- package/src/og/webgl/Handler.js +1022 -1001
- package/src/og/webgl/Multisample.js +169 -168
- package/src/og/webgl/ProgramController.js +113 -112
- package/types/Clock.d.ts +90 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +73 -0
- package/types/Extent.d.ts +162 -0
- package/types/Globe.d.ts +80 -0
- package/types/ImageCanvas.d.ts +121 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +38 -0
- package/types/QueueArray.d.ts +15 -0
- package/types/Rectangle.d.ts +74 -0
- package/types/Stack.d.ts +15 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +6 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +25 -0
- package/types/bv/Sphere.d.ts +32 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +303 -0
- package/types/camera/Frustum.d.ts +129 -0
- package/types/camera/PlanetCamera.d.ts +222 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +101 -0
- package/types/control/DebugInfo.d.ts +16 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +22 -0
- package/types/control/LayerSwitcher.d.ts +23 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +12 -0
- package/types/control/SimpleNavigation.d.ts +28 -0
- package/types/control/Sun.d.ts +52 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/ZoomControl.d.ts +28 -0
- package/types/control/index.d.ts +15 -0
- package/types/ellipsoid/Ellipsoid.d.ts +142 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +5 -0
- package/types/entity/BaseBillboard.d.ts +208 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +74 -0
- package/types/entity/Entity.d.ts +330 -0
- package/types/entity/EntityCollection.d.ts +303 -0
- package/types/entity/Geometry.d.ts +72 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +194 -0
- package/types/entity/LabelHandler.d.ts +24 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +303 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +123 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +118 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/inherits.d.ts +4 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +106 -0
- package/types/layer/CanvasTiles.d.ts +75 -0
- package/types/layer/GeoImage.d.ts +65 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +80 -0
- package/types/layer/KML.d.ts +58 -0
- package/types/layer/WMS.d.ts +66 -0
- package/types/layer/XYZ.d.ts +126 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +177 -0
- package/types/math/Mat3.d.ts +53 -0
- package/types/math/Mat4.d.ts +157 -0
- package/types/math/Plane.d.ts +17 -0
- package/types/math/Vec2.d.ts +308 -0
- package/types/math/Vec3.d.ts +459 -0
- package/types/math/Vec4.d.ts +161 -0
- package/types/math/coder.d.ts +42 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +5 -0
- package/types/proj/EPSG4326.d.ts +5 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/RendererEvents.d.ts +230 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +572 -0
- package/types/scene/RenderNode.d.ts +143 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +247 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +8 -0
- package/types/terrain/EmptyTerrain.d.ts +72 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +153 -0
- package/types/terrain/MapboxTerrain.d.ts +8 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +14 -0
- package/types/utils/GeoImageCreator.d.ts +29 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +230 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +372 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +155 -0
- package/types/webgl/ProgramController.d.ts +84 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
package/src/og/math/Vec3.js
CHANGED
|
@@ -14,850 +14,852 @@ import { Quat } from './Quat.js';
|
|
|
14
14
|
* @param {number} [y] - Second value.
|
|
15
15
|
* @param {number} [z] - Third value.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
export class Vec3 {
|
|
18
|
+
|
|
19
|
+
constructor(x, y, z) {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
25
|
+
this.x = x || 0.0;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
this.y = y || 0.0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
this.z = z || 0.0;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @const */
|
|
41
|
+
static get UP() { return new Vec3(0, 1, 0) };
|
|
42
|
+
/** @const */
|
|
43
|
+
static get DOWN() { return new Vec3(0, -1, 0) };
|
|
44
|
+
/** @const */
|
|
45
|
+
static get RIGHT() { return new Vec3(1, 0, 0) };
|
|
46
|
+
/** @const */
|
|
47
|
+
static get LEFT() { return new Vec3(-1, 0, 0) };
|
|
48
|
+
/** @const */
|
|
49
|
+
static get FORWARD() { return new Vec3(0, 0, -1) };
|
|
50
|
+
/** @const */
|
|
51
|
+
static get BACKWARD() { return new Vec3(0, 0, 1) };
|
|
52
|
+
/** @const */
|
|
53
|
+
static get ZERO() { return new Vec3() };
|
|
54
|
+
/** @const */
|
|
55
|
+
static get UNIT_X() { return new Vec3(1, 0, 0) };
|
|
56
|
+
/** @const */
|
|
57
|
+
static get UNIT_Y() { return new Vec3(0, 1, 0) };
|
|
58
|
+
/** @const */
|
|
59
|
+
static get UNIT_Z() { return new Vec3(0, 0, 1) };
|
|
18
60
|
|
|
19
61
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
62
|
+
* Separate 63 bit Vec3 to two Vec3 32 bit float values.
|
|
63
|
+
* @function
|
|
64
|
+
* @param {number} value - Double type value.
|
|
65
|
+
* @param {Vec3} high - Out vector high values.
|
|
66
|
+
* @param {Vec3} low - Out vector low values.
|
|
67
|
+
* @returns {Array.<number,number>} Encoded array.
|
|
22
68
|
*/
|
|
23
|
-
|
|
69
|
+
static doubleToTwoFloats(v, high, low) {
|
|
24
70
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
71
|
+
let x = v.x, y = v.y, z = v.z;
|
|
72
|
+
|
|
73
|
+
if (x >= 0.0) {
|
|
74
|
+
let doubleHigh = Math.floor(x / 65536.0) * 65536.0;
|
|
75
|
+
high.x = Math.fround(doubleHigh);
|
|
76
|
+
low.x = Math.fround(x - doubleHigh);
|
|
77
|
+
} else {
|
|
78
|
+
let doubleHigh = Math.floor(-x / 65536.0) * 65536.0;
|
|
79
|
+
high.x = Math.fround(-doubleHigh);
|
|
80
|
+
low.x = Math.fround(x + doubleHigh);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (y >= 0.0) {
|
|
84
|
+
let doubleHigh = Math.floor(y / 65536.0) * 65536.0;
|
|
85
|
+
high.y = Math.fround(doubleHigh);
|
|
86
|
+
low.y = Math.fround(y - doubleHigh);
|
|
87
|
+
} else {
|
|
88
|
+
let doubleHigh = Math.floor(-y / 65536.0) * 65536.0;
|
|
89
|
+
high.y = Math.fround(-doubleHigh);
|
|
90
|
+
low.y = Math.fround(y + doubleHigh);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (z >= 0.0) {
|
|
94
|
+
let doubleHigh = Math.floor(z / 65536.0) * 65536.0;
|
|
95
|
+
high.z = Math.fround(doubleHigh);
|
|
96
|
+
low.z = Math.fround(z - doubleHigh);
|
|
97
|
+
} else {
|
|
98
|
+
let doubleHigh = Math.floor(-z / 65536.0) * 65536.0;
|
|
99
|
+
high.z = Math.fround(-doubleHigh);
|
|
100
|
+
low.z = Math.fround(z + doubleHigh);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
30
103
|
|
|
31
104
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
105
|
+
* Separate 63 bit Vec3 to two Vec3 32 bit float values.
|
|
106
|
+
* @function
|
|
107
|
+
* @param {number} value - Double type value.
|
|
108
|
+
* @param {Float32Array} high - Out vector high values.
|
|
109
|
+
* @param {Float32Array} low - Out vector low values.
|
|
110
|
+
* @returns {Array.<number,number>} Encoded array.
|
|
34
111
|
*/
|
|
35
|
-
|
|
36
|
-
};
|
|
112
|
+
static doubleToTwoFloat32Array(v, high, low) {
|
|
37
113
|
|
|
38
|
-
|
|
39
|
-
Vec3.UP = new Vec3(0, 1, 0);
|
|
40
|
-
/** @const */
|
|
41
|
-
Vec3.DOWN = new Vec3(0, -1, 0);
|
|
42
|
-
/** @const */
|
|
43
|
-
Vec3.RIGHT = new Vec3(1, 0, 0);
|
|
44
|
-
/** @const */
|
|
45
|
-
Vec3.LEFT = new Vec3(-1, 0, 0);
|
|
46
|
-
/** @const */
|
|
47
|
-
Vec3.FORWARD = new Vec3(0, 0, -1);
|
|
48
|
-
/** @const */
|
|
49
|
-
Vec3.BACKWARD = new Vec3(0, 0, 1);
|
|
50
|
-
/** @const */
|
|
51
|
-
Vec3.ZERO = new Vec3();
|
|
52
|
-
/** @const */
|
|
53
|
-
Vec3.UNIT_X = new Vec3(1, 0, 0);
|
|
54
|
-
/** @const */
|
|
55
|
-
Vec3.UNIT_Y = new Vec3(0, 1, 0);
|
|
56
|
-
/** @const */
|
|
57
|
-
Vec3.UNIT_Z = new Vec3(0, 0, 1);
|
|
114
|
+
let x = v.x, y = v.y, z = v.z;
|
|
58
115
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return new Vec3(x, y, z);
|
|
69
|
-
};
|
|
116
|
+
if (x >= 0.0) {
|
|
117
|
+
let doubleHigh = Math.floor(x / 65536.0) * 65536.0;
|
|
118
|
+
high[0] = Math.fround(doubleHigh);
|
|
119
|
+
low[0] = Math.fround(x - doubleHigh);
|
|
120
|
+
} else {
|
|
121
|
+
let doubleHigh = Math.floor(-x / 65536.0) * 65536.0;
|
|
122
|
+
high[0] = Math.fround(-doubleHigh);
|
|
123
|
+
low[0] = Math.fround(x + doubleHigh);
|
|
124
|
+
}
|
|
70
125
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
let x = v.x, y = v.y, z = v.z;
|
|
82
|
-
|
|
83
|
-
if (x >= 0.0) {
|
|
84
|
-
let doubleHigh = Math.floor(x / 65536.0) * 65536.0;
|
|
85
|
-
high.x = Math.fround(doubleHigh);
|
|
86
|
-
low.x = Math.fround(x - doubleHigh);
|
|
87
|
-
} else {
|
|
88
|
-
let doubleHigh = Math.floor(-x / 65536.0) * 65536.0;
|
|
89
|
-
high.x = Math.fround(-doubleHigh);
|
|
90
|
-
low.x = Math.fround(x + doubleHigh);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (y >= 0.0) {
|
|
94
|
-
let doubleHigh = Math.floor(y / 65536.0) * 65536.0;
|
|
95
|
-
high.y = Math.fround(doubleHigh);
|
|
96
|
-
low.y = Math.fround(y - doubleHigh);
|
|
97
|
-
} else {
|
|
98
|
-
let doubleHigh = Math.floor(-y / 65536.0) * 65536.0;
|
|
99
|
-
high.y = Math.fround(-doubleHigh);
|
|
100
|
-
low.y = Math.fround(y + doubleHigh);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (z >= 0.0) {
|
|
104
|
-
let doubleHigh = Math.floor(z / 65536.0) * 65536.0;
|
|
105
|
-
high.z = Math.fround(doubleHigh);
|
|
106
|
-
low.z = Math.fround(z - doubleHigh);
|
|
107
|
-
} else {
|
|
108
|
-
let doubleHigh = Math.floor(-z / 65536.0) * 65536.0;
|
|
109
|
-
high.z = Math.fround(-doubleHigh);
|
|
110
|
-
low.z = Math.fround(z + doubleHigh);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
126
|
+
if (y >= 0.0) {
|
|
127
|
+
let doubleHigh = Math.floor(y / 65536.0) * 65536.0;
|
|
128
|
+
high[1] = Math.fround(doubleHigh);
|
|
129
|
+
low[1] = Math.fround(y - doubleHigh);
|
|
130
|
+
} else {
|
|
131
|
+
let doubleHigh = Math.floor(-y / 65536.0) * 65536.0;
|
|
132
|
+
high[1] = Math.fround(-doubleHigh);
|
|
133
|
+
low[1] = Math.fround(y + doubleHigh);
|
|
134
|
+
}
|
|
113
135
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
let x = v.x, y = v.y, z = v.z;
|
|
125
|
-
|
|
126
|
-
if (x >= 0.0) {
|
|
127
|
-
let doubleHigh = Math.floor(x / 65536.0) * 65536.0;
|
|
128
|
-
high[0] = Math.fround(doubleHigh);
|
|
129
|
-
low[0] = Math.fround(x - doubleHigh);
|
|
130
|
-
} else {
|
|
131
|
-
let doubleHigh = Math.floor(-x / 65536.0) * 65536.0;
|
|
132
|
-
high[0] = Math.fround(-doubleHigh);
|
|
133
|
-
low[0] = Math.fround(x + doubleHigh);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (y >= 0.0) {
|
|
137
|
-
let doubleHigh = Math.floor(y / 65536.0) * 65536.0;
|
|
138
|
-
high[1] = Math.fround(doubleHigh);
|
|
139
|
-
low[1] = Math.fround(y - doubleHigh);
|
|
140
|
-
} else {
|
|
141
|
-
let doubleHigh = Math.floor(-y / 65536.0) * 65536.0;
|
|
142
|
-
high[1] = Math.fround(-doubleHigh);
|
|
143
|
-
low[1] = Math.fround(y + doubleHigh);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (z >= 0.0) {
|
|
147
|
-
let doubleHigh = Math.floor(z / 65536.0) * 65536.0;
|
|
148
|
-
high[2] = Math.fround(doubleHigh);
|
|
149
|
-
low[2] = Math.fround(z - doubleHigh);
|
|
150
|
-
} else {
|
|
151
|
-
let doubleHigh = Math.floor(-z / 65536.0) * 65536.0;
|
|
152
|
-
high[2] = Math.fround(-doubleHigh);
|
|
153
|
-
low[2] = Math.fround(z + doubleHigh);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
136
|
+
if (z >= 0.0) {
|
|
137
|
+
let doubleHigh = Math.floor(z / 65536.0) * 65536.0;
|
|
138
|
+
high[2] = Math.fround(doubleHigh);
|
|
139
|
+
low[2] = Math.fround(z - doubleHigh);
|
|
140
|
+
} else {
|
|
141
|
+
let doubleHigh = Math.floor(-z / 65536.0) * 65536.0;
|
|
142
|
+
high[2] = Math.fround(-doubleHigh);
|
|
143
|
+
low[2] = Math.fround(z + doubleHigh);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
156
146
|
|
|
157
|
-
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
};
|
|
147
|
+
/**
|
|
148
|
+
* Creates 3d vector from array.
|
|
149
|
+
* @function
|
|
150
|
+
* @param {Array.<number,number,number>} arr - Input array
|
|
151
|
+
* @returns {og.Vec3} -
|
|
152
|
+
*/
|
|
153
|
+
static fromVec(arr) {
|
|
154
|
+
return new Vec3(arr[0], arr[1], arr[2]);
|
|
155
|
+
};
|
|
166
156
|
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
};
|
|
157
|
+
/**
|
|
158
|
+
* Gets angle between two vectors.
|
|
159
|
+
* @static
|
|
160
|
+
* @param {og.Vec3} a - First vector.
|
|
161
|
+
* @param {og.Vec3} b - Second vector.
|
|
162
|
+
* @returns {number} -
|
|
163
|
+
*/
|
|
164
|
+
static angle(a, b) {
|
|
165
|
+
return Math.acos(a.dot(b) / Math.sqrt(a.length2() * b.length2()));
|
|
166
|
+
};
|
|
177
167
|
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
168
|
+
/**
|
|
169
|
+
* Returns two vectors linear interpolation.
|
|
170
|
+
* @static
|
|
171
|
+
* @param {og.Vec3} v1 - Start vector.
|
|
172
|
+
* @param {og.Vec3} v2 - End vector.
|
|
173
|
+
* @param {number} l - Interpolate value.
|
|
174
|
+
* @returns {og.Vec3} -
|
|
175
|
+
*/
|
|
176
|
+
static lerp(v1, v2, l) {
|
|
177
|
+
return Vec3(v1.x + (v2.x - v1.x) * l, v1.y + (v2.y - v1.y) * l, v1.z + (v2.z - v1.z) * l);
|
|
178
|
+
};
|
|
189
179
|
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
180
|
+
/**
|
|
181
|
+
* Returns summary vector.
|
|
182
|
+
* @static
|
|
183
|
+
* @param {og.Vec3} a - First vector.
|
|
184
|
+
* @param {og.Vec3} b - Second vector.
|
|
185
|
+
* @returns {og.Vec3} - Summary vector.
|
|
186
|
+
*/
|
|
187
|
+
static add(a, b) {
|
|
188
|
+
var res = new Vec3(a.x, a.y, a.z);
|
|
189
|
+
res.addA(b);
|
|
190
|
+
return res;
|
|
191
|
+
};
|
|
202
192
|
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
};
|
|
193
|
+
/**
|
|
194
|
+
* Returns two vectors subtraction.
|
|
195
|
+
* @static
|
|
196
|
+
* @param {og.Vec3} a - First vector.
|
|
197
|
+
* @param {og.Vec3} b - Second vector.
|
|
198
|
+
* @returns {og.Vec3} - Vectors subtraction.
|
|
199
|
+
*/
|
|
200
|
+
static sub(a, b) {
|
|
201
|
+
var res = new Vec3(a.x, a.y, a.z);
|
|
202
|
+
res.subA(b);
|
|
203
|
+
return res;
|
|
204
|
+
};
|
|
215
205
|
|
|
216
|
-
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
206
|
+
/**
|
|
207
|
+
* Returns scaled vector.
|
|
208
|
+
* @static
|
|
209
|
+
* @param {og.Vec3} a - Input vector.
|
|
210
|
+
* @param {number} scale - Scale value.
|
|
211
|
+
* @returns {og.Vec3} -
|
|
212
|
+
*/
|
|
213
|
+
static scale(a, scale) {
|
|
214
|
+
var res = new Vec3(a.x, a.y, a.z);
|
|
215
|
+
res.scale(scale);
|
|
216
|
+
return res;
|
|
217
|
+
};
|
|
228
218
|
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
219
|
+
/**
|
|
220
|
+
* Returns two vectors production.
|
|
221
|
+
* @static
|
|
222
|
+
* @param {og.Vec3} a - First vector.
|
|
223
|
+
* @param {og.Vec3} b - Second vector.
|
|
224
|
+
* @returns {og.Vec3} -
|
|
225
|
+
*/
|
|
226
|
+
static mul(a, b) {
|
|
227
|
+
var res = new Vec3(a.x, a.y, a.z);
|
|
228
|
+
res.mulA(b);
|
|
229
|
+
return res;
|
|
230
|
+
};
|
|
241
231
|
|
|
242
|
-
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
};
|
|
232
|
+
/**
|
|
233
|
+
* Returns true if two vectors are non collinear.
|
|
234
|
+
* @public
|
|
235
|
+
* @param {og.Vec3} a - First vector.
|
|
236
|
+
* @param {og.Vec3} b - Second vector.
|
|
237
|
+
* @returns {og.Vec3} -
|
|
238
|
+
*/
|
|
239
|
+
static noncollinear(a, b) {
|
|
240
|
+
return a.y * b.z - a.z * b.y || a.z * b.x - a.x * b.z || a.x * b.y - a.y * b.z;
|
|
241
|
+
};
|
|
252
242
|
|
|
253
|
-
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* @param {og.Vec3} [def] - Default value for non existed result.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
};
|
|
243
|
+
/**
|
|
244
|
+
* Get projection of the vector to plane where n - normal to the plane.
|
|
245
|
+
* @static
|
|
246
|
+
* @param {og.Vec3} b - Vector to project.
|
|
247
|
+
* @param {og.Vec3} n - Plane normal.
|
|
248
|
+
* @param {og.Vec3} [def] - Default value for non existed result.
|
|
249
|
+
* @returns {og.Vec3} -
|
|
250
|
+
*/
|
|
251
|
+
static proj_b_to_plane(b, n, def) {
|
|
252
|
+
var res = b.sub(n.scaleTo(n.dot(b) / n.dot(n)));
|
|
253
|
+
if (def && res.isZero()) {
|
|
254
|
+
return new Vec3(def.x, def.y, def.z);
|
|
255
|
+
}
|
|
256
|
+
return res;
|
|
257
|
+
};
|
|
268
258
|
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
};
|
|
259
|
+
/**
|
|
260
|
+
* Get projection of the first vector to the second.
|
|
261
|
+
* @static
|
|
262
|
+
* @param {og.Vec3} b - First vector.
|
|
263
|
+
* @param {og.Vec3} a - Second vector.
|
|
264
|
+
* @returns {og.Vec3} -
|
|
265
|
+
*/
|
|
266
|
+
static proj_b_to_a(b, a) {
|
|
267
|
+
return a.scaleTo(a.dot(b) / a.dot(a));
|
|
268
|
+
};
|
|
279
269
|
|
|
280
|
-
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
};
|
|
270
|
+
/**
|
|
271
|
+
* Makes vectors normalized and orthogonal to each other.
|
|
272
|
+
* Normalizes normal. Normalizes tangent and makes sure it is orthogonal to normal (that is, angle between them is 90 degrees).
|
|
273
|
+
* @static
|
|
274
|
+
* @param {og.Vec3} normal - Normal vector.
|
|
275
|
+
* @param {og.Vec3} tangent - Tangent vector.
|
|
276
|
+
* @returns {og.Vec3} -
|
|
277
|
+
*/
|
|
278
|
+
static orthoNormalize(normal, tangent) {
|
|
279
|
+
normal = normal.normal();
|
|
280
|
+
normal.scale(tangent.dot(normal));
|
|
281
|
+
return tangent.subA(normal).normalize();
|
|
282
|
+
};
|
|
293
283
|
|
|
294
|
-
/**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
};
|
|
284
|
+
/**
|
|
285
|
+
* Returns vector components division product one to another.
|
|
286
|
+
* @static
|
|
287
|
+
* @param {og.Vec3} a - First vector.
|
|
288
|
+
* @param {og.Vec3} b - Second vector.
|
|
289
|
+
* @returns {og.Vec3} -
|
|
290
|
+
*/
|
|
291
|
+
static div(a, b) {
|
|
292
|
+
var res = new Vec3(a.x, a.y, a.z);
|
|
293
|
+
res.divA(b);
|
|
294
|
+
return res;
|
|
295
|
+
};
|
|
306
296
|
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
};
|
|
297
|
+
/**
|
|
298
|
+
* Converts to 4d vector, Fourth value is 1.0.
|
|
299
|
+
* @public
|
|
300
|
+
* @returns {og.Vec4} -
|
|
301
|
+
*/
|
|
302
|
+
toVec4() {
|
|
303
|
+
return new Vec4(this.x, this.y, this.z, 1.0);
|
|
304
|
+
};
|
|
315
305
|
|
|
316
|
-
/**
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
};
|
|
306
|
+
/**
|
|
307
|
+
* Returns clone vector.
|
|
308
|
+
* @public
|
|
309
|
+
* @returns {og.Vec3} -
|
|
310
|
+
*/
|
|
311
|
+
clone() {
|
|
312
|
+
return new Vec3(this.x, this.y, this.z);
|
|
313
|
+
};
|
|
324
314
|
|
|
325
|
-
/**
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
};
|
|
315
|
+
/**
|
|
316
|
+
* Converts vector to text string.
|
|
317
|
+
* @public
|
|
318
|
+
* @returns {string} -
|
|
319
|
+
*/
|
|
320
|
+
toString() {
|
|
321
|
+
return "(" + this.x + "," + this.y + "," + this.z + ")";
|
|
322
|
+
};
|
|
333
323
|
|
|
334
|
-
/**
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
};
|
|
324
|
+
/**
|
|
325
|
+
* Returns true if vector's values are zero.
|
|
326
|
+
* @public
|
|
327
|
+
* @returns {boolean} -
|
|
328
|
+
*/
|
|
329
|
+
isZero() {
|
|
330
|
+
return !(this.x || this.y || this.z);
|
|
331
|
+
};
|
|
342
332
|
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
};
|
|
333
|
+
/**
|
|
334
|
+
* Get projection of the first vector to the second.
|
|
335
|
+
* @static
|
|
336
|
+
* @param {og.Vec3} a - Project vector.
|
|
337
|
+
* @returns {og.Vec3} -
|
|
338
|
+
*/
|
|
339
|
+
projToVec(a) {
|
|
340
|
+
return a.scaleTo(a.dot(this) / a.dot(a));
|
|
341
|
+
};
|
|
352
342
|
|
|
353
|
-
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
};
|
|
343
|
+
/**
|
|
344
|
+
* Compares with vector. Returns true if it equals another.
|
|
345
|
+
* @public
|
|
346
|
+
* @param {og.Vec3} p - Vector to compare.
|
|
347
|
+
* @returns {boolean} -
|
|
348
|
+
*/
|
|
349
|
+
equal(p) {
|
|
350
|
+
return this.x === p.x && this.y === p.y && this.z === p.z;
|
|
351
|
+
};
|
|
362
352
|
|
|
363
|
-
/**
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
};
|
|
353
|
+
/**
|
|
354
|
+
* Copy input vector's values.
|
|
355
|
+
* @param {og.Vec3} point3 - Vector to copy.
|
|
356
|
+
* @returns {og.Vec3} -
|
|
357
|
+
*/
|
|
358
|
+
copy(point3) {
|
|
359
|
+
this.x = point3.x;
|
|
360
|
+
this.y = point3.y;
|
|
361
|
+
this.z = point3.z;
|
|
362
|
+
return this;
|
|
363
|
+
};
|
|
374
364
|
|
|
375
|
-
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
};
|
|
365
|
+
/**
|
|
366
|
+
* Gets vector's length.
|
|
367
|
+
* @public
|
|
368
|
+
* @returns {number} -
|
|
369
|
+
*/
|
|
370
|
+
length() {
|
|
371
|
+
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
372
|
+
};
|
|
383
373
|
|
|
384
|
-
/**
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
};
|
|
374
|
+
/**
|
|
375
|
+
* Returns squared vector's length.
|
|
376
|
+
* @public
|
|
377
|
+
* @returns {number} -
|
|
378
|
+
*/
|
|
379
|
+
length2() {
|
|
380
|
+
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
381
|
+
};
|
|
392
382
|
|
|
393
|
-
/**
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
};
|
|
383
|
+
/**
|
|
384
|
+
* Converts vector's values to a quaternion object.
|
|
385
|
+
* @public
|
|
386
|
+
* @returns {og.Quat} -
|
|
387
|
+
*/
|
|
388
|
+
getQuat() {
|
|
389
|
+
return new Quat(this.x, this.y, this.z);
|
|
390
|
+
};
|
|
401
391
|
|
|
402
|
-
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
};
|
|
392
|
+
/**
|
|
393
|
+
* Adds vector to the current.
|
|
394
|
+
* @public
|
|
395
|
+
* @param {og.Vec3} point3 - Point to add.
|
|
396
|
+
* @returns {og.Vec3} -
|
|
397
|
+
*/
|
|
398
|
+
addA(point3) {
|
|
399
|
+
this.x += point3.x;
|
|
400
|
+
this.y += point3.y;
|
|
401
|
+
this.z += point3.z;
|
|
402
|
+
return this;
|
|
403
|
+
};
|
|
414
404
|
|
|
415
|
-
/**
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
};
|
|
405
|
+
/**
|
|
406
|
+
* Gets two vectors summarization.
|
|
407
|
+
* @public
|
|
408
|
+
* @param {og.Vec3} point3 - Vector to add.
|
|
409
|
+
* @returns {og.Vec3} Returns a sum vector.
|
|
410
|
+
*/
|
|
411
|
+
add(point3) {
|
|
412
|
+
return new Vec3(this.x + point3.x, this.y + point3.y, this.z + point3.z);
|
|
413
|
+
};
|
|
424
414
|
|
|
425
|
-
/**
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
};
|
|
415
|
+
/**
|
|
416
|
+
* Subtract vector from the current.
|
|
417
|
+
* @public
|
|
418
|
+
* @param {og.Vec3} point3 - Subtract vector.
|
|
419
|
+
* @returns {og.Vec3} -
|
|
420
|
+
*/
|
|
421
|
+
subA(point3) {
|
|
422
|
+
this.x -= point3.x;
|
|
423
|
+
this.y -= point3.y;
|
|
424
|
+
this.z -= point3.z;
|
|
425
|
+
return this;
|
|
426
|
+
};
|
|
437
427
|
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
};
|
|
428
|
+
/**
|
|
429
|
+
* Gets vector subtraction.
|
|
430
|
+
* @public
|
|
431
|
+
* @param {og.Vec3} point3 - Subtract vector.
|
|
432
|
+
* @return {og.Vec3} Returns new instance of a subtraction
|
|
433
|
+
*/
|
|
434
|
+
sub(point3) {
|
|
435
|
+
return new Vec3(this.x - point3.x, this.y - point3.y, this.z - point3.z);
|
|
436
|
+
};
|
|
447
437
|
|
|
448
|
-
/**
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
};
|
|
438
|
+
/**
|
|
439
|
+
* Scale current vector.
|
|
440
|
+
* @public
|
|
441
|
+
* @param {number} scale - Scale value.
|
|
442
|
+
* @returns {og.Vec3} -
|
|
443
|
+
*/
|
|
444
|
+
scale(scale) {
|
|
445
|
+
this.x *= scale;
|
|
446
|
+
this.y *= scale;
|
|
447
|
+
this.z *= scale;
|
|
448
|
+
return this;
|
|
449
|
+
};
|
|
460
450
|
|
|
461
|
-
/**
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
};
|
|
451
|
+
/**
|
|
452
|
+
* Scale current vector to another instance.
|
|
453
|
+
* @public
|
|
454
|
+
* @param {number} scale - Scale value.
|
|
455
|
+
* @returns {og.Vec3} -
|
|
456
|
+
*/
|
|
457
|
+
scaleTo(scale) {
|
|
458
|
+
return new Vec3(this.x * scale, this.y * scale, this.z * scale);
|
|
459
|
+
};
|
|
470
460
|
|
|
471
|
-
/**
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
};
|
|
461
|
+
/**
|
|
462
|
+
* Multiply current vector object to another and store result in the current instance.
|
|
463
|
+
* @public
|
|
464
|
+
* @param {og.Vec3} vec - Multiply vector.
|
|
465
|
+
* @returns {og.Vec3} -
|
|
466
|
+
*/
|
|
467
|
+
mulA(vec) {
|
|
468
|
+
this.x *= vec.x;
|
|
469
|
+
this.y *= vec.y;
|
|
470
|
+
this.z *= vec.z;
|
|
471
|
+
return this;
|
|
472
|
+
};
|
|
483
473
|
|
|
484
|
-
/**
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
};
|
|
474
|
+
/**
|
|
475
|
+
* Multiply current vector object to another and returns new vector instance.
|
|
476
|
+
* @public
|
|
477
|
+
* @param {og.Vec3} vec - Multiply vector.
|
|
478
|
+
* @returns {og.Vec3} -
|
|
479
|
+
*/
|
|
480
|
+
mul(vec) {
|
|
481
|
+
return new Vec3(this.x * vec.x, this.y * vec.y, this.z * vec.z);
|
|
482
|
+
};
|
|
493
483
|
|
|
494
|
-
/**
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
};
|
|
484
|
+
/**
|
|
485
|
+
* Divide current vector's components to another. Results stores in the current vector object.
|
|
486
|
+
* @public
|
|
487
|
+
* @param {og.Vec3} vec - Div vector.
|
|
488
|
+
* @returns {og.Vec3} -
|
|
489
|
+
*/
|
|
490
|
+
divA(vec) {
|
|
491
|
+
this.x /= vec.x;
|
|
492
|
+
this.y /= vec.y;
|
|
493
|
+
this.z /= vec.z;
|
|
494
|
+
return this;
|
|
495
|
+
};
|
|
506
496
|
|
|
507
|
-
/**
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
};
|
|
497
|
+
/**
|
|
498
|
+
* Divide current vector's components to another and returns new vector instance.
|
|
499
|
+
* @public
|
|
500
|
+
* @param {og.Vec3} vec - Div vector.
|
|
501
|
+
* @returns {og.Vec3} -
|
|
502
|
+
*/
|
|
503
|
+
div(vec) {
|
|
504
|
+
return new Vec3(this.x / vec.x, this.y / vec.y, this.z / vec.z);
|
|
505
|
+
};
|
|
516
506
|
|
|
517
|
-
/**
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
};
|
|
507
|
+
/**
|
|
508
|
+
* Gets vectors dot production.
|
|
509
|
+
* @public
|
|
510
|
+
* @param {og.Vec3} point3 - Another vector.
|
|
511
|
+
* @returns {number} -
|
|
512
|
+
*/
|
|
513
|
+
dot(point3) {
|
|
514
|
+
return point3.x * this.x + point3.y * this.y + point3.z * this.z;
|
|
515
|
+
};
|
|
526
516
|
|
|
527
|
-
/**
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
};
|
|
517
|
+
/**
|
|
518
|
+
* Gets vectors dot production.
|
|
519
|
+
* @public
|
|
520
|
+
* @param {Array.<number,number,number>} arr - Array vector.
|
|
521
|
+
* @returns {number} -
|
|
522
|
+
*/
|
|
523
|
+
dotArr(arr) {
|
|
524
|
+
return arr[0] * this.x + arr[1] * this.y + arr[2] * this.z;
|
|
525
|
+
};
|
|
536
526
|
|
|
537
|
-
/**
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
};
|
|
527
|
+
/**
|
|
528
|
+
* Gets vectors cross production.
|
|
529
|
+
* @public
|
|
530
|
+
* @param {og.Vec3} point3 - Another vector.
|
|
531
|
+
* @returns {og.Vec3} -
|
|
532
|
+
*/
|
|
533
|
+
cross(point3) {
|
|
534
|
+
return new Vec3(
|
|
535
|
+
this.y * point3.z - this.z * point3.y,
|
|
536
|
+
this.z * point3.x - this.x * point3.z,
|
|
537
|
+
this.x * point3.y - this.y * point3.x
|
|
538
|
+
);
|
|
539
|
+
};
|
|
550
540
|
|
|
551
|
-
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
};
|
|
541
|
+
/**
|
|
542
|
+
* Sets vector to zero.
|
|
543
|
+
* @public
|
|
544
|
+
* @returns {og.Vec3} -
|
|
545
|
+
*/
|
|
546
|
+
clear() {
|
|
547
|
+
this.x = this.y = this.z = 0;
|
|
548
|
+
return this;
|
|
549
|
+
};
|
|
560
550
|
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
551
|
+
/**
|
|
552
|
+
* Returns normalized vector.
|
|
553
|
+
* @public
|
|
554
|
+
* @returns {og.Vec3} -
|
|
555
|
+
*/
|
|
556
|
+
getNormal() {
|
|
557
|
+
var res = new Vec3();
|
|
558
|
+
res.copy(this);
|
|
569
559
|
|
|
570
|
-
|
|
560
|
+
var length = 1.0 / res.length();
|
|
571
561
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
562
|
+
res.x *= length;
|
|
563
|
+
res.y *= length;
|
|
564
|
+
res.z *= length;
|
|
575
565
|
|
|
576
|
-
|
|
577
|
-
};
|
|
566
|
+
return res;
|
|
567
|
+
};
|
|
578
568
|
|
|
579
|
-
/**
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
569
|
+
/**
|
|
570
|
+
* Returns normalized vector.
|
|
571
|
+
* @deprecated
|
|
572
|
+
* @public
|
|
573
|
+
* @returns {og.Vec3} -
|
|
574
|
+
*/
|
|
575
|
+
normal() {
|
|
576
|
+
var res = new Vec3();
|
|
577
|
+
res.copy(this);
|
|
588
578
|
|
|
589
|
-
|
|
579
|
+
var length = 1.0 / res.length();
|
|
590
580
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
581
|
+
res.x *= length;
|
|
582
|
+
res.y *= length;
|
|
583
|
+
res.z *= length;
|
|
594
584
|
|
|
595
|
-
|
|
596
|
-
};
|
|
585
|
+
return res;
|
|
586
|
+
};
|
|
597
587
|
|
|
598
|
-
/**
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
588
|
+
/**
|
|
589
|
+
* Returns normalized negate vector.
|
|
590
|
+
* @public
|
|
591
|
+
* @returns {og.Vec3} -
|
|
592
|
+
*/
|
|
593
|
+
normalNegate() {
|
|
594
|
+
var res = new Vec3();
|
|
595
|
+
res.copy(this);
|
|
606
596
|
|
|
607
|
-
|
|
597
|
+
var length = -1.0 / res.length();
|
|
608
598
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
599
|
+
res.x *= length;
|
|
600
|
+
res.y *= length;
|
|
601
|
+
res.z *= length;
|
|
612
602
|
|
|
613
|
-
|
|
614
|
-
};
|
|
603
|
+
return res;
|
|
604
|
+
};
|
|
615
605
|
|
|
616
|
-
/**
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
606
|
+
/**
|
|
607
|
+
* Returns normalized negate scale vector.
|
|
608
|
+
* @public
|
|
609
|
+
* @returns {og.Vec3} -
|
|
610
|
+
*/
|
|
611
|
+
normalNegateScale(scale) {
|
|
612
|
+
var res = new Vec3();
|
|
613
|
+
res.copy(this);
|
|
624
614
|
|
|
625
|
-
|
|
615
|
+
var length = -scale / res.length();
|
|
626
616
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
617
|
+
res.x *= length;
|
|
618
|
+
res.y *= length;
|
|
619
|
+
res.z *= length;
|
|
630
620
|
|
|
631
|
-
|
|
632
|
-
};
|
|
621
|
+
return res;
|
|
622
|
+
};
|
|
633
623
|
|
|
634
|
-
/**
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
624
|
+
/**
|
|
625
|
+
* Returns normalized scale vector.
|
|
626
|
+
* @public
|
|
627
|
+
* @returns {og.Vec3} -
|
|
628
|
+
*/
|
|
629
|
+
normalScale(scale) {
|
|
630
|
+
var res = new Vec3();
|
|
631
|
+
res.copy(this);
|
|
642
632
|
|
|
643
|
-
|
|
633
|
+
var length = scale / res.length();
|
|
644
634
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
635
|
+
res.x *= length;
|
|
636
|
+
res.y *= length;
|
|
637
|
+
res.z *= length;
|
|
648
638
|
|
|
649
|
-
|
|
650
|
-
};
|
|
639
|
+
return res;
|
|
640
|
+
};
|
|
651
641
|
|
|
652
|
-
/**
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
642
|
+
/**
|
|
643
|
+
* Normalize current vector.
|
|
644
|
+
* @public
|
|
645
|
+
* @returns {og.Vec3} -
|
|
646
|
+
*/
|
|
647
|
+
normalize() {
|
|
648
|
+
var length = 1.0 / this.length();
|
|
659
649
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
650
|
+
this.x *= length;
|
|
651
|
+
this.y *= length;
|
|
652
|
+
this.z *= length;
|
|
663
653
|
|
|
664
|
-
|
|
665
|
-
};
|
|
654
|
+
return this;
|
|
655
|
+
};
|
|
666
656
|
|
|
667
|
-
/**
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
};
|
|
657
|
+
/**
|
|
658
|
+
* Converts vector to a number array.
|
|
659
|
+
* @public
|
|
660
|
+
* @returns {Array.<number,number,number>} -
|
|
661
|
+
* @deprecated
|
|
662
|
+
*/
|
|
663
|
+
toVec() {
|
|
664
|
+
return [this.x, this.y, this.z];
|
|
665
|
+
};
|
|
676
666
|
|
|
677
|
-
/**
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
};
|
|
667
|
+
/**
|
|
668
|
+
* Converts vector to a number array.
|
|
669
|
+
* @public
|
|
670
|
+
* @returns {Array.<number,number,number>} -
|
|
671
|
+
*/
|
|
672
|
+
toArray() {
|
|
673
|
+
return [this.x, this.y, this.z];
|
|
674
|
+
};
|
|
685
675
|
|
|
686
|
-
/**
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
};
|
|
676
|
+
/**
|
|
677
|
+
* Gets distance to point.
|
|
678
|
+
* @public
|
|
679
|
+
* @param {og.Vec3} point3 - Distant point.
|
|
680
|
+
* @returns {number} -
|
|
681
|
+
*/
|
|
682
|
+
distance(point3) {
|
|
683
|
+
return Vec3.sub(this, point3).length();
|
|
684
|
+
};
|
|
695
685
|
|
|
696
|
-
/**
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
};
|
|
686
|
+
/**
|
|
687
|
+
* Sets vector's values.
|
|
688
|
+
* @public
|
|
689
|
+
* @param {number} x - Value X.
|
|
690
|
+
* @param {number} y - Value Y.
|
|
691
|
+
* @param {number} z - Value Z.
|
|
692
|
+
* @returns {og.Vec3} -
|
|
693
|
+
*/
|
|
694
|
+
set(x, y, z) {
|
|
695
|
+
this.x = x;
|
|
696
|
+
this.y = y;
|
|
697
|
+
this.z = z;
|
|
698
|
+
return this;
|
|
699
|
+
};
|
|
710
700
|
|
|
711
|
-
/**
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
};
|
|
701
|
+
/**
|
|
702
|
+
* Negate current vector.
|
|
703
|
+
* @public
|
|
704
|
+
* @returns {og.Vec3} -
|
|
705
|
+
*/
|
|
706
|
+
negate() {
|
|
707
|
+
this.x = -this.x;
|
|
708
|
+
this.y = -this.y;
|
|
709
|
+
this.z = -this.z;
|
|
710
|
+
return this;
|
|
711
|
+
};
|
|
722
712
|
|
|
723
|
-
/**
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
};
|
|
713
|
+
/**
|
|
714
|
+
* Negate current vector to another instance.
|
|
715
|
+
* @public
|
|
716
|
+
* @returns {og.Vec3} -
|
|
717
|
+
*/
|
|
718
|
+
negateTo() {
|
|
719
|
+
return new Vec3(-this.x, -this.y, -this.z);
|
|
720
|
+
};
|
|
731
721
|
|
|
732
|
-
/**
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
};
|
|
722
|
+
/**
|
|
723
|
+
* Gets projected point coordinates of the current vector on the ray.
|
|
724
|
+
* @public
|
|
725
|
+
* @param {og.Vec3} pos - Ray position.
|
|
726
|
+
* @param {og.Vec3} direction - Ray direction.
|
|
727
|
+
* @returns {og.Vec3} -
|
|
728
|
+
*/
|
|
729
|
+
projToRay(pos, direction) {
|
|
730
|
+
var v = Vec3.proj_b_to_a(Vec3.sub(this, pos), direction);
|
|
731
|
+
v.addA(pos);
|
|
732
|
+
return v;
|
|
733
|
+
};
|
|
744
734
|
|
|
745
|
-
/**
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
};
|
|
735
|
+
/**
|
|
736
|
+
* Gets angle between two vectors.
|
|
737
|
+
* @public
|
|
738
|
+
* @param {og.Vec3} a - Another vector.
|
|
739
|
+
* @returns {number} -
|
|
740
|
+
*/
|
|
741
|
+
angle(a) {
|
|
742
|
+
return Vec3.angle(this, a);
|
|
743
|
+
};
|
|
754
744
|
|
|
755
|
-
/**
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
};
|
|
745
|
+
/**
|
|
746
|
+
* Returns two vectors linear interpolation.
|
|
747
|
+
* @public
|
|
748
|
+
* @param {og.Vec3} v2 - End vector.
|
|
749
|
+
* @param {number} l - Interpolate value.
|
|
750
|
+
* @returns {og.Vec3} -
|
|
751
|
+
*/
|
|
752
|
+
lerp(v2, l) {
|
|
753
|
+
return new Vec3(this.x + (v2.x - this.x) * l, this.y + (v2.y - this.y) * l, this.z + (v2.z - this.z) * l);
|
|
754
|
+
};
|
|
765
755
|
|
|
766
|
-
/**
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
};
|
|
756
|
+
/**
|
|
757
|
+
* Returns vector interpolation by v(t) = v1 * t + v2 * (1 - t)
|
|
758
|
+
* @public
|
|
759
|
+
* @param {og.Vec3} v2 - End vector.
|
|
760
|
+
* @param {number} t - Interpolate value.
|
|
761
|
+
* @returns {og.Vec3} -
|
|
762
|
+
*/
|
|
763
|
+
smerp(v2, t) {
|
|
764
|
+
var one_d = 1 - t;
|
|
765
|
+
return new Vec3(this.x * t + v2.x * one_d, this.y * t + v2.y * one_d, this.z * t + v2.z * one_d);
|
|
766
|
+
};
|
|
777
767
|
|
|
778
|
-
|
|
768
|
+
static get LERP_DELTA() { return 1e-6 };
|
|
779
769
|
|
|
780
|
-
/**
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
770
|
+
/**
|
|
771
|
+
* Spherically interpolates between two vectors.
|
|
772
|
+
* Interpolates between current and v2 vector by amount t. The difference between this and linear interpolation (aka, "lerp") is that
|
|
773
|
+
* the vectors are treated as directions rather than points in space. The direction of the returned vector is interpolated
|
|
774
|
+
* by the angle and its magnitude is interpolated between the magnitudes of from and to.
|
|
775
|
+
* @public
|
|
776
|
+
* @param {og.Vec3} v2 -
|
|
777
|
+
* @param {number} t - The parameter t is clamped to the range [0, 1].
|
|
778
|
+
* @returns {og.Vec3} -
|
|
779
|
+
*/
|
|
780
|
+
slerp(v2, t) {
|
|
781
|
+
var res = new Vec3();
|
|
782
|
+
|
|
783
|
+
if (t <= 0.0) {
|
|
784
|
+
res.copy(this);
|
|
785
|
+
return;
|
|
786
|
+
} else if (t >= 1.0) {
|
|
787
|
+
res.copy(v2);
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
792
790
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
return;
|
|
796
|
-
} else if (t >= 1.0) {
|
|
797
|
-
res.copy(v2);
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
var omega, sinom, scale0, scale1;
|
|
802
|
-
var cosom = this.dot(v2);
|
|
803
|
-
|
|
804
|
-
if ((1.0 - cosom) > Vec3.LERP_DELTA) {
|
|
805
|
-
omega = Math.acos(cosom);
|
|
806
|
-
sinom = Math.sin(omega);
|
|
807
|
-
scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
|
808
|
-
scale1 = Math.sin(t * omega) / sinom;
|
|
809
|
-
} else {
|
|
810
|
-
scale0 = 1.0 - t;
|
|
811
|
-
scale1 = t;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
return Vec3.add(this.scaleTo(scale0), v2.scale(scale1));
|
|
815
|
-
};
|
|
791
|
+
var omega, sinom, scale0, scale1;
|
|
792
|
+
var cosom = this.dot(v2);
|
|
816
793
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
*
|
|
821
|
-
*
|
|
822
|
-
* @todo: TEST IT!
|
|
823
|
-
*/
|
|
824
|
-
Vec3.prototype.getRotationTo = function (dest, fallbackAxis) {
|
|
825
|
-
// Based on Stan Melax's article in Game Programming Gems
|
|
826
|
-
// Copy, since cannot modify local
|
|
827
|
-
let v0 = this.clone();
|
|
828
|
-
let v1 = dest.clone();
|
|
829
|
-
v0.normalize();
|
|
830
|
-
v1.normalize();
|
|
831
|
-
|
|
832
|
-
let d = v0.dot(v1);
|
|
833
|
-
// If dot == 1, vectors are the same
|
|
834
|
-
if (d >= 1.0) {
|
|
835
|
-
return Quat.IDENTITY.clone();
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
if (d < (1e-6 - 1.0)) {
|
|
839
|
-
if (!fallbackAxis.isEqual(Vec3.ZERO)) {
|
|
840
|
-
// rotate 180 degrees about the fallback axis
|
|
841
|
-
return Quat.axisAngleToQuat(Math.PI, fallbackAxis);
|
|
794
|
+
if ((1.0 - cosom) > Vec3.LERP_DELTA) {
|
|
795
|
+
omega = Math.acos(cosom);
|
|
796
|
+
sinom = Math.sin(omega);
|
|
797
|
+
scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
|
798
|
+
scale1 = Math.sin(t * omega) / sinom;
|
|
842
799
|
} else {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
if (axis.isZero()) { // pick another if colinear
|
|
846
|
-
axis = Vec3.UNIT_Y.cross(v0);
|
|
847
|
-
}
|
|
848
|
-
axis.normalize();
|
|
849
|
-
return Quat.axisAngleToQuat(Math.PI, axis);
|
|
800
|
+
scale0 = 1.0 - t;
|
|
801
|
+
scale1 = t;
|
|
850
802
|
}
|
|
851
|
-
} else {
|
|
852
|
-
let s = Math.sqrt((1 + d) * 2);
|
|
853
|
-
let invs = 1.0 / s;
|
|
854
803
|
|
|
855
|
-
|
|
804
|
+
return Vec3.add(this.scaleTo(scale0), v2.scale(scale1));
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Gets the shortest arc quaternion to rotate this vector to the destination vector.
|
|
809
|
+
* @param {Vec3} dest -
|
|
810
|
+
* @param {Vec3} fallbackAxis -
|
|
811
|
+
* @returns {Quat} -
|
|
812
|
+
* @todo: TEST IT!
|
|
813
|
+
*/
|
|
814
|
+
getRotationTo(dest, fallbackAxis) {
|
|
815
|
+
// Based on Stan Melax's article in Game Programming Gems
|
|
816
|
+
// Copy, since cannot modify local
|
|
817
|
+
let v0 = this.clone();
|
|
818
|
+
let v1 = dest.clone();
|
|
819
|
+
v0.normalize();
|
|
820
|
+
v1.normalize();
|
|
821
|
+
|
|
822
|
+
let d = v0.dot(v1);
|
|
823
|
+
// If dot == 1, vectors are the same
|
|
824
|
+
if (d >= 1.0) {
|
|
825
|
+
return Quat.IDENTITY.clone();
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if (d < (1e-6 - 1.0)) {
|
|
829
|
+
if (!fallbackAxis.isEqual(Vec3.ZERO)) {
|
|
830
|
+
// rotate 180 degrees about the fallback axis
|
|
831
|
+
return Quat.axisAngleToQuat(Math.PI, fallbackAxis);
|
|
832
|
+
} else {
|
|
833
|
+
// Generate an axis
|
|
834
|
+
let axis = Vec3.UNIT_X.cross(v0);
|
|
835
|
+
if (axis.isZero()) { // pick another if colinear
|
|
836
|
+
axis = Vec3.UNIT_Y.cross(v0);
|
|
837
|
+
}
|
|
838
|
+
axis.normalize();
|
|
839
|
+
return Quat.axisAngleToQuat(Math.PI, axis);
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
let s = Math.sqrt((1 + d) * 2);
|
|
843
|
+
let invs = 1.0 / s;
|
|
844
|
+
|
|
845
|
+
let c = v0.cross(v1);
|
|
856
846
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
847
|
+
let q = new Quat(c.x * invs, c.y * invs, c.z * invs, s * 0.5);
|
|
848
|
+
q.normalise();
|
|
849
|
+
return q;
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Vector 3d object creator.
|
|
856
|
+
* @function
|
|
857
|
+
* @param {number} [x] - First cvalue.
|
|
858
|
+
* @param {number} [y] - Second value.
|
|
859
|
+
* @param {number} [z] - Third value.
|
|
860
|
+
* @returns {og.Vec3} -
|
|
861
|
+
*/
|
|
862
|
+
export function vec3(x, y, z) {
|
|
863
|
+
return new Vec3(x, y, z);
|
|
861
864
|
};
|
|
862
865
|
|
|
863
|
-
export { Vec3 };
|