melonjs 15.3.0 → 15.4.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/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +53 -5
- package/dist/melonjs.mjs/application/header.js +2 -2
- package/dist/melonjs.mjs/application/resize.js +4 -8
- package/dist/melonjs.mjs/application/settings.js +5 -5
- package/dist/melonjs.mjs/audio/audio.js +4 -6
- package/dist/melonjs.mjs/camera/camera2d.js +12 -14
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
- package/dist/melonjs.mjs/geometries/line.js +18 -25
- package/dist/melonjs.mjs/geometries/path2d.js +16 -13
- package/dist/melonjs.mjs/geometries/point.js +8 -16
- package/dist/melonjs.mjs/geometries/poly.js +40 -97
- package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
- package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
- package/dist/melonjs.mjs/index.js +6 -6
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +3 -3
- package/dist/melonjs.mjs/input/pointer.js +4 -4
- package/dist/melonjs.mjs/input/pointerevent.js +6 -7
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +2 -2
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +16 -33
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +4 -5
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +2 -2
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +5 -59
- package/dist/melonjs.mjs/math/matrix3.js +82 -141
- package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
- package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
- package/dist/melonjs.mjs/math/vector2.js +7 -91
- package/dist/melonjs.mjs/math/vector3.js +6 -90
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +2 -2
- package/dist/melonjs.mjs/particles/particle.js +2 -2
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +22 -20
- package/dist/melonjs.mjs/physics/bounds.js +27 -33
- package/dist/melonjs.mjs/physics/collision.js +5 -5
- package/dist/melonjs.mjs/physics/detector.js +10 -10
- package/dist/melonjs.mjs/physics/quadtree.js +5 -5
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +3 -4
- package/dist/melonjs.mjs/physics/world.js +6 -9
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +2 -2
- package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
- package/dist/melonjs.mjs/renderable/container.js +25 -25
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
- package/dist/melonjs.mjs/renderable/light2d.js +3 -3
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
- package/dist/melonjs.mjs/renderable/renderable.js +26 -26
- package/dist/melonjs.mjs/renderable/sprite.js +3 -3
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
- package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
- package/dist/melonjs.mjs/renderable/text/text.js +422 -0
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
- package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
- package/dist/melonjs.mjs/renderable/trigger.js +10 -10
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
- package/dist/melonjs.mjs/state/stage.js +2 -2
- package/dist/melonjs.mjs/state/state.js +1 -38
- package/dist/melonjs.mjs/system/device.js +49 -10
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +24 -2
- package/dist/melonjs.mjs/system/platform.js +18 -18
- package/dist/melonjs.mjs/system/pooling.js +10 -10
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +2 -2
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +2 -3
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -7
- package/dist/melonjs.mjs/video/renderer.js +16 -16
- package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +4 -4
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
- package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +4 -4
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +50 -52
- package/dist/melonjs.module.js +1137 -1576
- package/dist/types/application/application.d.ts +28 -4
- package/dist/types/application/header.d.ts +2 -2
- package/dist/types/application/settings.d.ts +23 -23
- package/dist/types/audio/audio.d.ts +4 -6
- package/dist/types/camera/camera2d.d.ts +13 -16
- package/dist/types/entity/entity.d.ts +0 -1
- package/dist/types/geometries/ellipse.d.ts +18 -50
- package/dist/types/geometries/path2d.d.ts +1 -1
- package/dist/types/geometries/point.d.ts +5 -13
- package/dist/types/geometries/poly.d.ts +26 -75
- package/dist/types/geometries/rectangle.d.ts +12 -58
- package/dist/types/geometries/roundrect.d.ts +2 -11
- package/dist/types/index.d.ts +3 -3
- package/dist/types/input/gamepad.d.ts +31 -31
- package/dist/types/input/keyboard.d.ts +105 -105
- package/dist/types/input/pointer.d.ts +21 -21
- package/dist/types/input/pointerevent.d.ts +6 -6
- package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
- package/dist/types/math/matrix2.d.ts +9 -63
- package/dist/types/math/matrix3.d.ts +9 -68
- package/dist/types/math/observable_vector2.d.ts +2 -2
- package/dist/types/math/observable_vector3.d.ts +2 -2
- package/dist/types/math/vector2.d.ts +8 -92
- package/dist/types/math/vector3.d.ts +8 -92
- package/dist/types/particles/settings.d.ts +29 -29
- package/dist/types/physics/body.d.ts +10 -8
- package/dist/types/physics/bounds.d.ts +24 -30
- package/dist/types/physics/collision.d.ts +12 -12
- package/dist/types/physics/detector.d.ts +1 -1
- package/dist/types/physics/world.d.ts +4 -7
- package/dist/types/renderable/container.d.ts +19 -19
- package/dist/types/renderable/imagelayer.d.ts +6 -6
- package/dist/types/renderable/light2d.d.ts +7 -7
- package/dist/types/renderable/renderable.d.ts +9 -16
- package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
- package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
- package/dist/types/renderable/text/glyph.d.ts +28 -0
- package/dist/types/renderable/text/text.d.ts +159 -0
- package/dist/types/renderable/text/textmetrics.d.ts +47 -0
- package/dist/types/renderable/text/textstyle.d.ts +5 -0
- package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
- package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
- package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
- package/dist/types/state/state.d.ts +11 -11
- package/dist/types/system/device.d.ts +15 -9
- package/dist/types/system/event.d.ts +20 -0
- package/dist/types/system/platform.d.ts +17 -17
- package/dist/types/utils/function.d.ts +1 -2
- package/dist/types/video/renderer.d.ts +13 -13
- package/dist/types/video/texture/canvas_texture.d.ts +14 -14
- package/dist/types/video/video.d.ts +2 -2
- package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
- package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
- package/dist/types/video/webgl/utils/precision.d.ts +1 -1
- package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
- package/package.json +15 -15
- package/src/application/application.js +51 -3
- package/src/application/header.js +1 -1
- package/src/application/resize.js +3 -7
- package/src/application/settings.js +4 -4
- package/src/audio/audio.js +3 -5
- package/src/camera/camera2d.js +11 -13
- package/src/entity/entity.js +2 -3
- package/src/geometries/ellipse.js +25 -58
- package/src/geometries/line.js +17 -24
- package/src/geometries/path2d.js +15 -12
- package/src/geometries/point.js +7 -15
- package/src/geometries/poly.js +39 -96
- package/src/geometries/rectangle.js +36 -90
- package/src/geometries/roundrect.js +25 -34
- package/src/index.js +4 -4
- package/src/input/keyboard.js +2 -2
- package/src/input/pointer.js +3 -3
- package/src/input/pointerevent.js +5 -6
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +15 -32
- package/src/level/tiled/TMXObject.js +2 -3
- package/src/level/tiled/TMXTile.js +3 -3
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/level/tiled/TMXTileset.js +3 -6
- package/src/level/tiled/TMXTilesetGroup.js +1 -1
- package/src/level/tiled/TMXUtils.js +25 -28
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/parser.js +3 -4
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +4 -58
- package/src/math/matrix3.js +81 -140
- package/src/math/observable_vector2.js +6 -6
- package/src/math/observable_vector3.js +4 -4
- package/src/math/vector2.js +6 -90
- package/src/math/vector3.js +5 -89
- package/src/particles/emitter.js +1 -1
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +21 -19
- package/src/physics/bounds.js +26 -32
- package/src/physics/collision.js +4 -4
- package/src/physics/detector.js +9 -9
- package/src/physics/quadtree.js +4 -4
- package/src/physics/sat.js +2 -3
- package/src/physics/world.js +5 -8
- package/src/polyfill/roundrect.js +163 -163
- package/src/renderable/collectable.js +1 -1
- package/src/renderable/colorlayer.js +3 -3
- package/src/renderable/container.js +24 -24
- package/src/renderable/imagelayer.js +3 -3
- package/src/renderable/light2d.js +2 -2
- package/src/renderable/nineslicesprite.js +1 -1
- package/src/renderable/renderable.js +25 -25
- package/src/renderable/sprite.js +2 -2
- package/src/{text → renderable/text}/bitmaptext.js +8 -8
- package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
- package/src/{text → renderable/text}/glyph.js +1 -1
- package/src/{text → renderable/text}/text.js +16 -17
- package/src/{text → renderable/text}/textmetrics.js +2 -2
- package/src/renderable/trigger.js +9 -9
- package/src/renderable/ui/uibaseelement.js +6 -6
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -1
- package/src/state/state.js +0 -49
- package/src/system/device.js +48 -9
- package/src/system/event.js +22 -0
- package/src/system/platform.js +18 -18
- package/src/system/pooling.js +9 -9
- package/src/tweens/tween.js +1 -1
- package/src/utils/function.js +1 -2
- package/src/video/canvas/canvas_renderer.js +2 -6
- package/src/video/renderer.js +15 -15
- package/src/video/texture/atlas.js +12 -12
- package/src/video/texture/canvas_texture.js +14 -14
- package/src/video/video.js +3 -3
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/compositors/compositor.js +12 -13
- package/src/video/webgl/compositors/primitive_compositor.js +4 -4
- package/src/video/webgl/compositors/quad_compositor.js +1 -2
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/utils/precision.js +3 -3
- package/src/video/webgl/webgl_renderer.js +49 -51
- /package/src/{text → renderable/text}/textstyle.js +0 -0
package/src/loader/parser.js
CHANGED
|
@@ -125,7 +125,7 @@ export function preloadTMX(tmxData, onload, onerror) {
|
|
|
125
125
|
switch (format) {
|
|
126
126
|
case "xml":
|
|
127
127
|
case "tmx":
|
|
128
|
-
case "tsx":
|
|
128
|
+
case "tsx": {
|
|
129
129
|
// ie9 does not fully implement the responseXML
|
|
130
130
|
if (ua.match(/msie/i) || !xmlhttp.responseXML) {
|
|
131
131
|
if (globalThis.DOMParser) {
|
|
@@ -139,7 +139,7 @@ export function preloadTMX(tmxData, onload, onerror) {
|
|
|
139
139
|
result = xmlhttp.responseXML;
|
|
140
140
|
}
|
|
141
141
|
// converts to a JS object
|
|
142
|
-
|
|
142
|
+
const data = TMXUtils.parse(result);
|
|
143
143
|
switch (format) {
|
|
144
144
|
case "tmx":
|
|
145
145
|
result = data.map;
|
|
@@ -149,9 +149,8 @@ export function preloadTMX(tmxData, onload, onerror) {
|
|
|
149
149
|
result = data.tilesets[0];
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
|
-
|
|
153
152
|
break;
|
|
154
|
-
|
|
153
|
+
}
|
|
155
154
|
case "json":
|
|
156
155
|
case "tmj":
|
|
157
156
|
case "tsj":
|
package/src/math/color.js
CHANGED
|
@@ -182,7 +182,7 @@ let cssToRGB = new Map();
|
|
|
182
182
|
* @classdesc
|
|
183
183
|
* A color manipulation object.
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
export default class Color {
|
|
186
186
|
/**
|
|
187
187
|
* @param {number} [r=0] - red component or array of color components
|
|
188
188
|
* @param {number} [g=0] - green component
|
package/src/math/matrix2.js
CHANGED
|
@@ -7,7 +7,7 @@ import Matrix3d from "./matrix3.js";
|
|
|
7
7
|
* the identity matrix and parameters position : <br>
|
|
8
8
|
* <img src="images/identity-matrix_2x.png"/>
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
export default class Matrix2d {
|
|
11
11
|
/**
|
|
12
12
|
* @param {(Matrix2d|Matrix3d|...number)} args - an instance of me.Matrix2d or me.Matrix3d to copy from, or individual matrix components (See {@link Matrix2d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
13
13
|
*/
|
|
@@ -40,11 +40,8 @@ import Matrix3d from "./matrix3.js";
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* tx component of the matrix
|
|
43
|
-
* @public
|
|
44
43
|
* @type {number}
|
|
45
44
|
* @see Matrix2d.translate
|
|
46
|
-
* @name tx
|
|
47
|
-
* @memberof Matrix2d
|
|
48
45
|
*/
|
|
49
46
|
get tx() {
|
|
50
47
|
return this.val[6];
|
|
@@ -52,11 +49,8 @@ import Matrix3d from "./matrix3.js";
|
|
|
52
49
|
|
|
53
50
|
/**
|
|
54
51
|
* ty component of the matrix
|
|
55
|
-
* @public
|
|
56
52
|
* @type {number}
|
|
57
53
|
* @see Matrix2d.translate
|
|
58
|
-
* @name ty
|
|
59
|
-
* @memberof Matrix2d
|
|
60
54
|
*/
|
|
61
55
|
get ty() {
|
|
62
56
|
return this.val[7];
|
|
@@ -66,8 +60,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
66
60
|
* reset the transformation matrix to the identity matrix (no transformation).<br>
|
|
67
61
|
* the identity matrix and parameters position : <br>
|
|
68
62
|
* <img src="images/identity-matrix_2x.png"/>
|
|
69
|
-
* @name identity
|
|
70
|
-
* @memberof Matrix2d
|
|
71
63
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
72
64
|
*/
|
|
73
65
|
identity() {
|
|
@@ -81,8 +73,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
81
73
|
|
|
82
74
|
/**
|
|
83
75
|
* set the matrix to the specified value
|
|
84
|
-
* @name setTransform
|
|
85
|
-
* @memberof Matrix2d
|
|
86
76
|
* @param {number} a
|
|
87
77
|
* @param {number} b
|
|
88
78
|
* @param {number} c
|
|
@@ -124,8 +114,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
124
114
|
|
|
125
115
|
/**
|
|
126
116
|
* Copies over the values from another me.Matrix2d.
|
|
127
|
-
* @name copy
|
|
128
|
-
* @memberof Matrix2d
|
|
129
117
|
* @param {Matrix2d} m - the matrix object to copy from
|
|
130
118
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
131
119
|
*/
|
|
@@ -136,8 +124,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
136
124
|
|
|
137
125
|
/**
|
|
138
126
|
* Copies over the upper-left 3x3 values from the given me.Matrix3d
|
|
139
|
-
* @name fromMat3d
|
|
140
|
-
* @memberof Matrix2d
|
|
141
127
|
* @param {Matrix3d} m - the matrix object to copy from
|
|
142
128
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
143
129
|
*/
|
|
@@ -160,8 +146,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
160
146
|
|
|
161
147
|
/**
|
|
162
148
|
* multiply both matrix
|
|
163
|
-
* @name multiply
|
|
164
|
-
* @memberof Matrix2d
|
|
165
149
|
* @param {Matrix2d} m - the other matrix
|
|
166
150
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
167
151
|
*/
|
|
@@ -191,8 +175,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
191
175
|
|
|
192
176
|
/**
|
|
193
177
|
* Transpose the value of this matrix.
|
|
194
|
-
* @name transpose
|
|
195
|
-
* @memberof Matrix2d
|
|
196
178
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
197
179
|
*/
|
|
198
180
|
transpose() {
|
|
@@ -213,8 +195,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
213
195
|
|
|
214
196
|
/**
|
|
215
197
|
* invert this matrix, causing it to apply the opposite transformation.
|
|
216
|
-
* @name invert
|
|
217
|
-
* @memberof Matrix2d
|
|
218
198
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
219
199
|
*/
|
|
220
200
|
invert() {
|
|
@@ -245,10 +225,8 @@ import Matrix3d from "./matrix3.js";
|
|
|
245
225
|
return this;
|
|
246
226
|
}
|
|
247
227
|
|
|
248
|
-
|
|
228
|
+
/**
|
|
249
229
|
* apply the current transform to the given 2d or 3d vector
|
|
250
|
-
* @name apply
|
|
251
|
-
* @memberof Matrix2d
|
|
252
230
|
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
253
231
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
254
232
|
*/
|
|
@@ -270,8 +248,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
270
248
|
|
|
271
249
|
/**
|
|
272
250
|
* apply the inverted current transform to the given 2d vector
|
|
273
|
-
* @name applyInverse
|
|
274
|
-
* @memberof Matrix2d
|
|
275
251
|
* @param {Vector2d} v - the vector object to be transformed
|
|
276
252
|
* @returns {Vector2d} result vector object.
|
|
277
253
|
*/
|
|
@@ -290,8 +266,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
290
266
|
|
|
291
267
|
/**
|
|
292
268
|
* scale the matrix
|
|
293
|
-
* @name scale
|
|
294
|
-
* @memberof Matrix2d
|
|
295
269
|
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
296
270
|
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
297
271
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
@@ -309,8 +283,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
309
283
|
|
|
310
284
|
/**
|
|
311
285
|
* adds a 2D scaling transformation.
|
|
312
|
-
* @name scaleV
|
|
313
|
-
* @memberof Matrix2d
|
|
314
286
|
* @param {Vector2d} v - scaling vector
|
|
315
287
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
316
288
|
*/
|
|
@@ -320,8 +292,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
320
292
|
|
|
321
293
|
/**
|
|
322
294
|
* specifies a 2D scale operation using the [sx, 1] scaling vector
|
|
323
|
-
* @name scaleX
|
|
324
|
-
* @memberof Matrix2d
|
|
325
295
|
* @param {number} x - x scaling vector
|
|
326
296
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
327
297
|
*/
|
|
@@ -331,8 +301,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
331
301
|
|
|
332
302
|
/**
|
|
333
303
|
* specifies a 2D scale operation using the [1,sy] scaling vector
|
|
334
|
-
* @name scaleY
|
|
335
|
-
* @memberof Matrix2d
|
|
336
304
|
* @param {number} y - y scaling vector
|
|
337
305
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
338
306
|
*/
|
|
@@ -342,8 +310,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
342
310
|
|
|
343
311
|
/**
|
|
344
312
|
* rotate the matrix (counter-clockwise) by the specified angle (in radians).
|
|
345
|
-
* @name rotate
|
|
346
|
-
* @memberof Matrix2d
|
|
347
313
|
* @param {number} angle - Rotation angle in radians.
|
|
348
314
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
349
315
|
*/
|
|
@@ -372,18 +338,8 @@ import Matrix3d from "./matrix3.js";
|
|
|
372
338
|
|
|
373
339
|
/**
|
|
374
340
|
* translate the matrix position on the horizontal and vertical axis
|
|
375
|
-
* @
|
|
376
|
-
* @
|
|
377
|
-
* @method
|
|
378
|
-
* @param {number} x - the x coordindates to translate the matrix by
|
|
379
|
-
* @param {number} y - the y coordindates to translate the matrix by
|
|
380
|
-
* @returns {Matrix2d} Reference to this object for method chaining
|
|
381
|
-
*/
|
|
382
|
-
/**
|
|
383
|
-
* translate the matrix by a vector on the horizontal and vertical axis
|
|
384
|
-
* @name translateV
|
|
385
|
-
* @memberof Matrix2d
|
|
386
|
-
* @param {Vector2d} v - the vector to translate the matrix by
|
|
341
|
+
* @param {number|Vector2d} x - the x coordindates or a vector to translate the matrix by
|
|
342
|
+
* @param {number} [y] - the y coordindates to translate the matrix by
|
|
387
343
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
388
344
|
*/
|
|
389
345
|
translate() {
|
|
@@ -408,8 +364,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
408
364
|
|
|
409
365
|
/**
|
|
410
366
|
* returns true if the matrix is an identity matrix.
|
|
411
|
-
* @name isIdentity
|
|
412
|
-
* @memberof Matrix2d
|
|
413
367
|
* @returns {boolean}
|
|
414
368
|
*/
|
|
415
369
|
isIdentity() {
|
|
@@ -430,8 +384,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
430
384
|
|
|
431
385
|
/**
|
|
432
386
|
* return true if the two matrices are identical
|
|
433
|
-
* @name equals
|
|
434
|
-
* @memberof Matrix2d
|
|
435
387
|
* @param {Matrix2d} m - the other matrix
|
|
436
388
|
* @returns {boolean} true if both are equals
|
|
437
389
|
*/
|
|
@@ -454,8 +406,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
454
406
|
|
|
455
407
|
/**
|
|
456
408
|
* Clone the Matrix
|
|
457
|
-
* @name clone
|
|
458
|
-
* @memberof Matrix2d
|
|
459
409
|
* @returns {Matrix2d}
|
|
460
410
|
*/
|
|
461
411
|
clone() {
|
|
@@ -464,8 +414,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
464
414
|
|
|
465
415
|
/**
|
|
466
416
|
* return an array representation of this Matrix
|
|
467
|
-
* @name toArray
|
|
468
|
-
* @memberof Matrix2d
|
|
469
417
|
* @returns {Float32Array}
|
|
470
418
|
*/
|
|
471
419
|
toArray() {
|
|
@@ -474,8 +422,6 @@ import Matrix3d from "./matrix3.js";
|
|
|
474
422
|
|
|
475
423
|
/**
|
|
476
424
|
* convert the object to a string representation
|
|
477
|
-
* @name toString
|
|
478
|
-
* @memberof Matrix2d
|
|
479
425
|
* @returns {string}
|
|
480
426
|
*/
|
|
481
427
|
toString() {
|
package/src/math/matrix3.js
CHANGED
|
@@ -5,7 +5,7 @@ import { EPSILON } from "./math.js";
|
|
|
5
5
|
* @classdesc
|
|
6
6
|
* a 4x4 Matrix3d Object
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
export default class Matrix3d {
|
|
9
9
|
/**
|
|
10
10
|
* @param {(Matrix3d|...number)} args - An instance of me.Matrix3d to copy from, or individual Matrix components (See {@link Matrix3d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
11
11
|
*/
|
|
@@ -34,10 +34,7 @@ import { EPSILON } from "./math.js";
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* tx component of the matrix
|
|
37
|
-
* @public
|
|
38
37
|
* @type {number}
|
|
39
|
-
* @name tx
|
|
40
|
-
* @memberof Matrix3d
|
|
41
38
|
*/
|
|
42
39
|
get tx() {
|
|
43
40
|
return this.val[12];
|
|
@@ -45,10 +42,7 @@ import { EPSILON } from "./math.js";
|
|
|
45
42
|
|
|
46
43
|
/**
|
|
47
44
|
* ty component of the matrix
|
|
48
|
-
* @public
|
|
49
45
|
* @type {number}
|
|
50
|
-
* @name ty
|
|
51
|
-
* @memberof Matrix3d
|
|
52
46
|
*/
|
|
53
47
|
get ty() {
|
|
54
48
|
return this.val[13];
|
|
@@ -56,10 +50,7 @@ import { EPSILON } from "./math.js";
|
|
|
56
50
|
|
|
57
51
|
/**
|
|
58
52
|
* ty component of the matrix
|
|
59
|
-
* @public
|
|
60
53
|
* @type {number}
|
|
61
|
-
* @name tz
|
|
62
|
-
* @memberof Matrix3d
|
|
63
54
|
*/
|
|
64
55
|
get tz() {
|
|
65
56
|
return this.val[14];
|
|
@@ -69,8 +60,6 @@ import { EPSILON } from "./math.js";
|
|
|
69
60
|
* reset the transformation matrix to the identity matrix (no transformation).<br>
|
|
70
61
|
* the identity matrix and parameters position : <br>
|
|
71
62
|
* <img src="images/identity-matrix_2x.png"/>
|
|
72
|
-
* @name identity
|
|
73
|
-
* @memberof Matrix3d
|
|
74
63
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
75
64
|
*/
|
|
76
65
|
identity() {
|
|
@@ -84,8 +73,6 @@ import { EPSILON } from "./math.js";
|
|
|
84
73
|
|
|
85
74
|
/**
|
|
86
75
|
* set the matrix to the specified value
|
|
87
|
-
* @name setTransform
|
|
88
|
-
* @memberof Matrix3d
|
|
89
76
|
* @param {number} m00
|
|
90
77
|
* @param {number} m01
|
|
91
78
|
* @param {number} m02
|
|
@@ -129,8 +116,6 @@ import { EPSILON } from "./math.js";
|
|
|
129
116
|
|
|
130
117
|
/**
|
|
131
118
|
* Copies over the values from another me.Matrix3d.
|
|
132
|
-
* @name copy
|
|
133
|
-
* @memberof Matrix3d
|
|
134
119
|
* @param {Matrix3d} m - the matrix object to copy from
|
|
135
120
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
136
121
|
*/
|
|
@@ -141,8 +126,6 @@ import { EPSILON } from "./math.js";
|
|
|
141
126
|
|
|
142
127
|
/**
|
|
143
128
|
* Copies over the upper-left 2x2 values from the given me.Matrix2d
|
|
144
|
-
* @name fromMat2d
|
|
145
|
-
* @memberof Matrix3d
|
|
146
129
|
* @param {Matrix2d} m - the matrix object to copy from
|
|
147
130
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
148
131
|
*/
|
|
@@ -159,8 +142,6 @@ import { EPSILON } from "./math.js";
|
|
|
159
142
|
|
|
160
143
|
/**
|
|
161
144
|
* multiply both matrix
|
|
162
|
-
* @name multiply
|
|
163
|
-
* @memberof Matrix3d
|
|
164
145
|
* @param {Matrix3d} m - Other matrix
|
|
165
146
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
166
147
|
*/
|
|
@@ -214,8 +195,6 @@ import { EPSILON } from "./math.js";
|
|
|
214
195
|
|
|
215
196
|
/**
|
|
216
197
|
* Transpose the value of this matrix.
|
|
217
|
-
* @name transpose
|
|
218
|
-
* @memberof Matrix3d
|
|
219
198
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
220
199
|
*/
|
|
221
200
|
transpose() {
|
|
@@ -227,93 +206,89 @@ import { EPSILON } from "./math.js";
|
|
|
227
206
|
a13 = a[7],
|
|
228
207
|
a23 = a[11];
|
|
229
208
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
209
|
+
a[1] = a[4];
|
|
210
|
+
a[2] = a[8];
|
|
211
|
+
a[3] = a[12];
|
|
212
|
+
a[4] = a01;
|
|
213
|
+
a[6] = a[9];
|
|
214
|
+
a[7] = a[13];
|
|
215
|
+
a[8] = a02;
|
|
216
|
+
a[9] = a12;
|
|
217
|
+
a[11] = a[14];
|
|
218
|
+
a[12] = a03;
|
|
219
|
+
a[13] = a13;
|
|
220
|
+
a[14] = a23;
|
|
221
|
+
|
|
222
|
+
return this;
|
|
244
223
|
}
|
|
245
224
|
|
|
246
225
|
/**
|
|
247
226
|
* invert this matrix, causing it to apply the opposite transformation.
|
|
248
|
-
* @name invert
|
|
249
|
-
* @memberof Matrix3d
|
|
250
227
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
251
228
|
*/
|
|
252
229
|
invert() {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
230
|
+
let a = this.val;
|
|
231
|
+
|
|
232
|
+
let a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];
|
|
233
|
+
let a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
|
|
234
|
+
let a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
|
|
235
|
+
let a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
|
|
236
|
+
|
|
237
|
+
let b00 = a00 * a11 - a01 * a10;
|
|
238
|
+
let b01 = a00 * a12 - a02 * a10;
|
|
239
|
+
let b02 = a00 * a13 - a03 * a10;
|
|
240
|
+
let b03 = a01 * a12 - a02 * a11;
|
|
241
|
+
|
|
242
|
+
let b04 = a01 * a13 - a03 * a11;
|
|
243
|
+
let b05 = a02 * a13 - a03 * a12;
|
|
244
|
+
let b06 = a20 * a31 - a21 * a30;
|
|
245
|
+
let b07 = a20 * a32 - a22 * a30;
|
|
246
|
+
|
|
247
|
+
let b08 = a20 * a33 - a23 * a30;
|
|
248
|
+
let b09 = a21 * a32 - a22 * a31;
|
|
249
|
+
let b10 = a21 * a33 - a23 * a31;
|
|
250
|
+
let b11 = a22 * a33 - a23 * a32;
|
|
251
|
+
|
|
252
|
+
// Calculate the determinant
|
|
253
|
+
let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
|
254
|
+
|
|
255
|
+
if (!det)
|
|
256
|
+
{
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
det = 1 / det;
|
|
261
|
+
|
|
262
|
+
a[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
|
|
263
|
+
a[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
|
|
264
|
+
a[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
|
|
265
|
+
a[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
|
|
266
|
+
a[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
|
|
267
|
+
a[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
|
|
268
|
+
a[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
|
|
269
|
+
a[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
|
|
270
|
+
a[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
|
|
271
|
+
a[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
|
|
272
|
+
a[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
|
|
273
|
+
a[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
|
|
274
|
+
a[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
|
|
275
|
+
a[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
|
|
276
|
+
a[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
|
|
277
|
+
a[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
|
|
278
|
+
|
|
279
|
+
return this;
|
|
303
280
|
}
|
|
304
281
|
|
|
305
282
|
/**
|
|
306
283
|
* apply the current transform to the given 2d or 3d vector
|
|
307
|
-
* @name apply
|
|
308
|
-
* @memberof Matrix3d
|
|
309
284
|
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
310
285
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
311
286
|
*/
|
|
312
|
-
|
|
287
|
+
apply(v) {
|
|
313
288
|
let a = this.val,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
289
|
+
x = v.x,
|
|
290
|
+
y = v.y,
|
|
291
|
+
z = (typeof v.z !== "undefined") ? v.z : 1;
|
|
317
292
|
|
|
318
293
|
let w = (a[3] * x + a[7] * y + a[11] * z + a[15]) || 1.0;
|
|
319
294
|
|
|
@@ -325,32 +300,28 @@ import { EPSILON } from "./math.js";
|
|
|
325
300
|
}
|
|
326
301
|
|
|
327
302
|
return v;
|
|
328
|
-
|
|
303
|
+
}
|
|
329
304
|
|
|
330
|
-
|
|
305
|
+
/**
|
|
331
306
|
* apply the inverted current transform to the given 2d or 3d vector
|
|
332
|
-
* @name applyInverse
|
|
333
|
-
* @memberof Matrix3d
|
|
334
307
|
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
335
308
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
336
309
|
*/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
310
|
+
applyInverse(v) {
|
|
311
|
+
// invert the current matrix
|
|
312
|
+
let im = pool.pull("Matrix3d", this).invert();
|
|
340
313
|
|
|
341
|
-
|
|
342
|
-
|
|
314
|
+
// apply the inverted matrix
|
|
315
|
+
im.apply(v);
|
|
343
316
|
|
|
344
|
-
|
|
317
|
+
pool.push(im);
|
|
345
318
|
|
|
346
|
-
|
|
347
|
-
|
|
319
|
+
return v;
|
|
320
|
+
}
|
|
348
321
|
|
|
349
322
|
/**
|
|
350
323
|
* generate an orthogonal projection matrix, with the result replacing the current matrix
|
|
351
324
|
* <img src="images/glOrtho.gif"/><br>
|
|
352
|
-
* @name ortho
|
|
353
|
-
* @memberof Matrix3d
|
|
354
325
|
* @param {number} left - farthest left on the x-axis
|
|
355
326
|
* @param {number} right - farthest right on the x-axis
|
|
356
327
|
* @param {number} bottom - farthest down on the y-axis
|
|
@@ -387,8 +358,6 @@ import { EPSILON } from "./math.js";
|
|
|
387
358
|
|
|
388
359
|
/**
|
|
389
360
|
* scale the matrix
|
|
390
|
-
* @name scale
|
|
391
|
-
* @memberof Matrix3d
|
|
392
361
|
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
393
362
|
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
394
363
|
* @param {number} [z=0] - a number representing the depth vector
|
|
@@ -417,8 +386,6 @@ import { EPSILON } from "./math.js";
|
|
|
417
386
|
|
|
418
387
|
/**
|
|
419
388
|
* adds a 2D scaling transformation.
|
|
420
|
-
* @name scaleV
|
|
421
|
-
* @memberof Matrix3d
|
|
422
389
|
* @param {Vector2d|Vector3d} v - scaling vector
|
|
423
390
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
424
391
|
*/
|
|
@@ -428,8 +395,6 @@ import { EPSILON } from "./math.js";
|
|
|
428
395
|
|
|
429
396
|
/**
|
|
430
397
|
* specifies a 2D scale operation using the [sx, 1] scaling vector
|
|
431
|
-
* @name scaleX
|
|
432
|
-
* @memberof Matrix3d
|
|
433
398
|
* @param {number} x - x scaling vector
|
|
434
399
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
435
400
|
*/
|
|
@@ -439,8 +404,6 @@ import { EPSILON } from "./math.js";
|
|
|
439
404
|
|
|
440
405
|
/**
|
|
441
406
|
* specifies a 2D scale operation using the [1,sy] scaling vector
|
|
442
|
-
* @name scaleY
|
|
443
|
-
* @memberof Matrix3d
|
|
444
407
|
* @param {number} y - y scaling vector
|
|
445
408
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
446
409
|
*/
|
|
@@ -450,8 +413,6 @@ import { EPSILON } from "./math.js";
|
|
|
450
413
|
|
|
451
414
|
/**
|
|
452
415
|
* rotate this matrix (counter-clockwise) by the specified angle (in radians).
|
|
453
|
-
* @name rotate
|
|
454
|
-
* @memberof Matrix3d
|
|
455
416
|
* @param {number} angle - Rotation angle in radians.
|
|
456
417
|
* @param {Vector3d} v - the axis to rotate around
|
|
457
418
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
@@ -529,21 +490,11 @@ import { EPSILON } from "./math.js";
|
|
|
529
490
|
|
|
530
491
|
/**
|
|
531
492
|
* translate the matrix position using the given vector
|
|
532
|
-
* @
|
|
533
|
-
* @
|
|
534
|
-
* @method
|
|
535
|
-
* @param {number} x - a number representing the abscissa of the vector.
|
|
536
|
-
* @param {number} [y=x] - a number representing the ordinate of the vector.
|
|
493
|
+
* @param {number|Vector2d|Vector3d} x - a number representing the abscissa of the vector, or a vector object
|
|
494
|
+
* @param {number} [y] - a number representing the ordinate of the vector.
|
|
537
495
|
* @param {number} [z=0] - a number representing the depth of the vector
|
|
538
496
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
539
497
|
*/
|
|
540
|
-
/**
|
|
541
|
-
* translate the matrix by a vector on the horizontal and vertical axis
|
|
542
|
-
* @name translateV
|
|
543
|
-
* @memberof Matrix3d
|
|
544
|
-
* @param {Vector2d|Vector3d} v - the vector to translate the matrix by
|
|
545
|
-
* @returns {Matrix3d} Reference to this object for method chaining
|
|
546
|
-
*/
|
|
547
498
|
translate() {
|
|
548
499
|
let a = this.val;
|
|
549
500
|
let _x, _y, _z;
|
|
@@ -570,8 +521,6 @@ import { EPSILON } from "./math.js";
|
|
|
570
521
|
|
|
571
522
|
/**
|
|
572
523
|
* returns true if the matrix is an identity matrix.
|
|
573
|
-
* @name isIdentity
|
|
574
|
-
* @memberof Matrix3d
|
|
575
524
|
* @returns {boolean}
|
|
576
525
|
*/
|
|
577
526
|
isIdentity() {
|
|
@@ -599,8 +548,6 @@ import { EPSILON } from "./math.js";
|
|
|
599
548
|
|
|
600
549
|
/**
|
|
601
550
|
* return true if the two matrices are identical
|
|
602
|
-
* @name equals
|
|
603
|
-
* @memberof Matrix3d
|
|
604
551
|
* @param {Matrix3d} m - the other matrix
|
|
605
552
|
* @returns {boolean} true if both are equals
|
|
606
553
|
*/
|
|
@@ -630,8 +577,6 @@ import { EPSILON } from "./math.js";
|
|
|
630
577
|
|
|
631
578
|
/**
|
|
632
579
|
* Clone the Matrix
|
|
633
|
-
* @name clone
|
|
634
|
-
* @memberof Matrix3d
|
|
635
580
|
* @returns {Matrix3d}
|
|
636
581
|
*/
|
|
637
582
|
clone() {
|
|
@@ -640,8 +585,6 @@ import { EPSILON } from "./math.js";
|
|
|
640
585
|
|
|
641
586
|
/**
|
|
642
587
|
* return an array representation of this Matrix
|
|
643
|
-
* @name toArray
|
|
644
|
-
* @memberof Matrix3d
|
|
645
588
|
* @returns {Float32Array}
|
|
646
589
|
*/
|
|
647
590
|
toArray() {
|
|
@@ -650,8 +593,6 @@ import { EPSILON } from "./math.js";
|
|
|
650
593
|
|
|
651
594
|
/**
|
|
652
595
|
* convert the object to a string representation
|
|
653
|
-
* @name toString
|
|
654
|
-
* @memberof Matrix3d
|
|
655
596
|
* @returns {string}
|
|
656
597
|
*/
|
|
657
598
|
toString() {
|