@vpmedia/phaser 1.95.0 → 1.96.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +9 -9
  3. package/src/phaser/core/animation.js +61 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/cache.js +154 -154
  6. package/src/phaser/core/device.js +2 -1
  7. package/src/phaser/core/device_util.js +27 -27
  8. package/src/phaser/core/dom.js +43 -43
  9. package/src/phaser/core/event_manager.js +63 -63
  10. package/src/phaser/core/factory.js +47 -47
  11. package/src/phaser/core/frame.js +30 -30
  12. package/src/phaser/core/frame_data.js +30 -28
  13. package/src/phaser/core/frame_util.js +8 -8
  14. package/src/phaser/core/game.js +34 -18
  15. package/src/phaser/core/loader.js +170 -170
  16. package/src/phaser/core/loader_parser.js +22 -22
  17. package/src/phaser/core/raf.js +1 -1
  18. package/src/phaser/core/scene.js +16 -10
  19. package/src/phaser/core/scene_manager.js +51 -43
  20. package/src/phaser/core/signal.js +56 -52
  21. package/src/phaser/core/sound.js +54 -54
  22. package/src/phaser/core/sound_manager.js +49 -49
  23. package/src/phaser/core/stage.js +16 -16
  24. package/src/phaser/core/time.js +30 -30
  25. package/src/phaser/core/timer.js +64 -64
  26. package/src/phaser/core/timer_event.js +9 -9
  27. package/src/phaser/core/tween.js +90 -90
  28. package/src/phaser/core/tween_data.js +30 -30
  29. package/src/phaser/core/tween_manager.js +29 -24
  30. package/src/phaser/core/world.js +4 -3
  31. package/src/phaser/display/bitmap_text.js +61 -54
  32. package/src/phaser/display/button.js +48 -47
  33. package/src/phaser/display/canvas/buffer.js +8 -8
  34. package/src/phaser/display/canvas/graphics.js +8 -8
  35. package/src/phaser/display/canvas/masker.js +5 -5
  36. package/src/phaser/display/canvas/pool.js +18 -18
  37. package/src/phaser/display/canvas/renderer.js +16 -16
  38. package/src/phaser/display/canvas/tinter.js +22 -22
  39. package/src/phaser/display/canvas/util.js +42 -42
  40. package/src/phaser/display/display_object.js +119 -108
  41. package/src/phaser/display/graphics.js +112 -112
  42. package/src/phaser/display/graphics_data.js +10 -10
  43. package/src/phaser/display/graphics_data_util.js +3 -3
  44. package/src/phaser/display/group.js +50 -50
  45. package/src/phaser/display/image.js +54 -50
  46. package/src/phaser/display/sprite_batch.js +2 -2
  47. package/src/phaser/display/sprite_util.js +19 -19
  48. package/src/phaser/display/text.js +212 -187
  49. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  50. package/src/phaser/display/webgl/base_texture.js +9 -9
  51. package/src/phaser/display/webgl/blend_manager.js +7 -7
  52. package/src/phaser/display/webgl/earcut.js +95 -95
  53. package/src/phaser/display/webgl/earcut_node.js +4 -4
  54. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  55. package/src/phaser/display/webgl/filter_manager.js +9 -9
  56. package/src/phaser/display/webgl/filter_texture.js +10 -10
  57. package/src/phaser/display/webgl/graphics.js +37 -37
  58. package/src/phaser/display/webgl/graphics_data.js +4 -4
  59. package/src/phaser/display/webgl/mask_manager.js +6 -6
  60. package/src/phaser/display/webgl/render_texture.js +16 -16
  61. package/src/phaser/display/webgl/renderer.js +20 -20
  62. package/src/phaser/display/webgl/shader/complex.js +4 -4
  63. package/src/phaser/display/webgl/shader/fast.js +4 -4
  64. package/src/phaser/display/webgl/shader/normal.js +8 -8
  65. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  66. package/src/phaser/display/webgl/shader/strip.js +4 -4
  67. package/src/phaser/display/webgl/shader_manager.js +9 -9
  68. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  69. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  70. package/src/phaser/display/webgl/texture.js +13 -13
  71. package/src/phaser/display/webgl/texture_util.js +8 -8
  72. package/src/phaser/display/webgl/util.js +25 -25
  73. package/src/phaser/geom/circle.js +69 -69
  74. package/src/phaser/geom/ellipse.js +28 -28
  75. package/src/phaser/geom/line.js +93 -93
  76. package/src/phaser/geom/matrix.js +54 -54
  77. package/src/phaser/geom/point.js +96 -96
  78. package/src/phaser/geom/polygon.js +22 -22
  79. package/src/phaser/geom/rectangle.js +132 -132
  80. package/src/phaser/geom/rounded_rectangle.js +12 -12
  81. package/src/phaser/geom/util/circle.js +33 -33
  82. package/src/phaser/geom/util/ellipse.js +5 -5
  83. package/src/phaser/geom/util/line.js +26 -26
  84. package/src/phaser/geom/util/matrix.js +8 -8
  85. package/src/phaser/geom/util/point.js +97 -97
  86. package/src/phaser/geom/util/polygon.js +4 -4
  87. package/src/phaser/geom/util/rectangle.js +74 -74
  88. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  89. package/src/phaser/util/math.js +81 -81
  90. package/types/phaser/core/animation.d.ts +61 -56
  91. package/types/phaser/core/animation.d.ts.map +1 -1
  92. package/types/phaser/core/animation_manager.d.ts +55 -55
  93. package/types/phaser/core/cache.d.ts +154 -154
  94. package/types/phaser/core/device.d.ts.map +1 -1
  95. package/types/phaser/core/dom.d.ts +43 -43
  96. package/types/phaser/core/event_manager.d.ts +63 -63
  97. package/types/phaser/core/factory.d.ts +47 -47
  98. package/types/phaser/core/frame.d.ts +30 -30
  99. package/types/phaser/core/frame_data.d.ts +28 -27
  100. package/types/phaser/core/frame_data.d.ts.map +1 -1
  101. package/types/phaser/core/game.d.ts +52 -19
  102. package/types/phaser/core/game.d.ts.map +1 -1
  103. package/types/phaser/core/loader.d.ts +170 -170
  104. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  105. package/types/phaser/core/raf.d.ts +1 -1
  106. package/types/phaser/core/scene.d.ts +15 -9
  107. package/types/phaser/core/scene.d.ts.map +1 -1
  108. package/types/phaser/core/scene_manager.d.ts +51 -43
  109. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  110. package/types/phaser/core/signal.d.ts +54 -51
  111. package/types/phaser/core/signal.d.ts.map +1 -1
  112. package/types/phaser/core/sound.d.ts +54 -54
  113. package/types/phaser/core/sound_manager.d.ts +49 -49
  114. package/types/phaser/core/stage.d.ts +10 -10
  115. package/types/phaser/core/time.d.ts +30 -30
  116. package/types/phaser/core/timer.d.ts +64 -64
  117. package/types/phaser/core/timer_event.d.ts +9 -9
  118. package/types/phaser/core/tween.d.ts +90 -90
  119. package/types/phaser/core/tween_data.d.ts +30 -30
  120. package/types/phaser/core/tween_manager.d.ts +29 -24
  121. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  122. package/types/phaser/core/world.d.ts +4 -3
  123. package/types/phaser/core/world.d.ts.map +1 -1
  124. package/types/phaser/display/bitmap_text.d.ts +59 -52
  125. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  126. package/types/phaser/display/button.d.ts +47 -46
  127. package/types/phaser/display/button.d.ts.map +1 -1
  128. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  129. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  130. package/types/phaser/display/display_object.d.ts +119 -108
  131. package/types/phaser/display/display_object.d.ts.map +1 -1
  132. package/types/phaser/display/graphics.d.ts +101 -101
  133. package/types/phaser/display/graphics_data.d.ts +10 -10
  134. package/types/phaser/display/group.d.ts +47 -47
  135. package/types/phaser/display/image.d.ts +42 -40
  136. package/types/phaser/display/image.d.ts.map +1 -1
  137. package/types/phaser/display/text.d.ts +207 -184
  138. package/types/phaser/display/text.d.ts.map +1 -1
  139. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  140. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  141. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  142. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  143. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  144. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  145. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  146. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  147. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  148. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  149. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  150. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  151. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  152. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  153. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  154. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  155. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  156. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  157. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  158. package/types/phaser/display/webgl/texture.d.ts +12 -12
  159. package/types/phaser/geom/circle.d.ts +69 -69
  160. package/types/phaser/geom/ellipse.d.ts +28 -28
  161. package/types/phaser/geom/line.d.ts +93 -93
  162. package/types/phaser/geom/matrix.d.ts +54 -54
  163. package/types/phaser/geom/point.d.ts +96 -96
  164. package/types/phaser/geom/polygon.d.ts +22 -22
  165. package/types/phaser/geom/rectangle.d.ts +132 -132
  166. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  167. package/pnpm-workspace.yaml +0 -4
@@ -5,11 +5,11 @@ import { GEOM_LINE } from '../core/const.js';
5
5
 
6
6
  export class Line {
7
7
  /**
8
- * TBD.
9
- * @param {number} x1 - TBD.
10
- * @param {number} y1 - TBD.
11
- * @param {number} x2 - TBD.
12
- * @param {number} y2 - TBD.
8
+ * Creates a new Line instance.
9
+ * @param {number} x1 - The x coordinate of the start point (default: 0).
10
+ * @param {number} y1 - The y coordinate of the start point (default: 0).
11
+ * @param {number} x2 - The x coordinate of the end point (default: 0).
12
+ * @param {number} y2 - The y coordinate of the end point (default: 0).
13
13
  */
14
14
  constructor(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
15
15
  /** @type {Point} */
@@ -21,12 +21,12 @@ export class Line {
21
21
  }
22
22
 
23
23
  /**
24
- * TBD.
25
- * @param {number} x1 - TBD.
26
- * @param {number} y1 - TBD.
27
- * @param {number} x2 - TBD.
28
- * @param {number} y2 - TBD.
29
- * @returns {Line} TBD.
24
+ * Sets the coordinates of this line to new values.
25
+ * @param {number} x1 - The new x coordinate of the start point.
26
+ * @param {number} y1 - The new y coordinate of the start point.
27
+ * @param {number} x2 - The new x coordinate of the end point.
28
+ * @param {number} y2 - The new y coordinate of the end point.
29
+ * @returns {Line} This line instance for chaining.
30
30
  */
31
31
  setTo(x1, y1, x2, y2) {
32
32
  this.start.setTo(x1, y1);
@@ -35,11 +35,11 @@ export class Line {
35
35
  }
36
36
 
37
37
  /**
38
- * TBD.
39
- * @param {object} startSprite - TBD.
40
- * @param {object} endSprite - TBD.
41
- * @param {boolean} useCenter - TBD.
42
- * @returns {Line} TBD.
38
+ * Sets the coordinates of this line to match the positions of two sprites.
39
+ * @param {object} startSprite - The starting sprite to get the position from.
40
+ * @param {object} endSprite - The ending sprite to get the position from.
41
+ * @param {boolean} useCenter - Whether to use the center of the sprites (default: false).
42
+ * @returns {Line} This line instance for chaining.
43
43
  */
44
44
  fromSprite(startSprite, endSprite, useCenter = false) {
45
45
  if (useCenter) {
@@ -49,12 +49,12 @@ export class Line {
49
49
  }
50
50
 
51
51
  /**
52
- * TBD.
53
- * @param {number} x - TBD.
54
- * @param {number} y - TBD.
55
- * @param {number} angle - TBD.
56
- * @param {number} length - TBD.
57
- * @returns {Line} TBD.
52
+ * Sets the coordinates of this line to a point at a specific angle and distance.
53
+ * @param {number} x - The x coordinate of the starting point.
54
+ * @param {number} y - The y coordinate of the starting point.
55
+ * @param {number} angle - The angle in radians to set the line at.
56
+ * @param {number} length - The length of the line.
57
+ * @returns {Line} This line instance for chaining.
58
58
  */
59
59
  fromAngle(x, y, angle, length) {
60
60
  this.start.setTo(x, y);
@@ -63,10 +63,10 @@ export class Line {
63
63
  }
64
64
 
65
65
  /**
66
- * TBD.
67
- * @param {number} angle - TBD.
68
- * @param {boolean} asDegrees - TBD.
69
- * @returns {Line} TBD.
66
+ * Rotates this line around its center point by the specified angle.
67
+ * @param {number} angle - The angle in radians (or degrees if asDegrees is true) to rotate by.
68
+ * @param {boolean} asDegrees - Whether the angle is provided in degrees (default: false).
69
+ * @returns {Line} This line instance for chaining.
70
70
  */
71
71
  rotate(angle, asDegrees = false) {
72
72
  const cx = (this.start.x + this.end.x) / 2;
@@ -77,12 +77,12 @@ export class Line {
77
77
  }
78
78
 
79
79
  /**
80
- * TBD.
81
- * @param {number} x - TBD.
82
- * @param {number} y - TBD.
83
- * @param {number} angle - TBD.
84
- * @param {boolean} asDegrees - TBD.
85
- * @returns {Line} TBD.
80
+ * Rotates this line around a specific point by the specified angle.
81
+ * @param {number} x - The x coordinate of the center point to rotate around.
82
+ * @param {number} y - The y coordinate of the center point to rotate around.
83
+ * @param {number} angle - The angle in radians (or degrees if asDegrees is true) to rotate by.
84
+ * @param {boolean} asDegrees - Whether the angle is provided in degrees (default: false).
85
+ * @returns {Line} This line instance for chaining.
86
86
  */
87
87
  rotateAround(x, y, angle, asDegrees = false) {
88
88
  this.start.rotate(x, y, angle, asDegrees);
@@ -91,29 +91,29 @@ export class Line {
91
91
  }
92
92
 
93
93
  /**
94
- * TBD.
95
- * @param {Line} line - TBD.
96
- * @param {boolean} asSegment - TBD.
97
- * @param {Point} result - TBD.
98
- * @returns {Point} TBD.
94
+ * Checks if this line intersects with another line.
95
+ * @param {Line} line - The other line to check for intersection with.
96
+ * @param {boolean} asSegment - Whether to treat the lines as segments (default: false).
97
+ * @param {Point} result - The point to store the intersection in (optional).
98
+ * @returns {Point} The intersection point, or null if no intersection occurs.
99
99
  */
100
100
  intersects(line, asSegment, result) {
101
101
  return intersectsPoints(this.start, this.end, line.start, line.end, asSegment, result);
102
102
  }
103
103
 
104
104
  /**
105
- * TBD.
106
- * @param {Line} line - TBD.
107
- * @returns {number} TBD.
105
+ * Calculates the reflection of this line off another line.
106
+ * @param {Line} line - The line to reflect off.
107
+ * @returns {number} The angle of reflection in radians.
108
108
  */
109
109
  reflect(line) {
110
110
  return reflect(this, line);
111
111
  }
112
112
 
113
113
  /**
114
- * TBD.
115
- * @param {Point} output - TBD.
116
- * @returns {Point} TBD.
114
+ * Returns the midpoint of this line.
115
+ * @param {Point} output - The point to store the result in (optional).
116
+ * @returns {Point} The midpoint of this line.
117
117
  */
118
118
  midPoint(output = null) {
119
119
  const result = output || new Point();
@@ -123,9 +123,9 @@ export class Line {
123
123
  }
124
124
 
125
125
  /**
126
- * TBD.
127
- * @param {number} x - TBD.
128
- * @param {number} y - TBD.
126
+ * Centers this line on the specified point.
127
+ * @param {number} x - The x coordinate to center the line on.
128
+ * @param {number} y - The y coordinate to center the line on.
129
129
  */
130
130
  centerOn(x, y) {
131
131
  const cx = (this.start.x + this.end.x) / 2;
@@ -137,20 +137,20 @@ export class Line {
137
137
  }
138
138
 
139
139
  /**
140
- * TBD.
141
- * @param {number} x - TBD.
142
- * @param {number} y - TBD.
143
- * @returns {boolean} TBD.
140
+ * Checks if the specified point lies on this line (not necessarily on the segment).
141
+ * @param {number} x - The x coordinate of the point to check.
142
+ * @param {number} y - The y coordinate of the point to check.
143
+ * @returns {boolean} True if the point lies on this line, false otherwise.
144
144
  */
145
145
  pointOnLine(x, y) {
146
146
  return (x - this.start.x) * (this.end.y - this.start.y) === (this.end.x - this.start.x) * (y - this.start.y);
147
147
  }
148
148
 
149
149
  /**
150
- * TBD.
151
- * @param {number} x - TBD.
152
- * @param {number} y - TBD.
153
- * @returns {boolean} TBD.
150
+ * Checks if the specified point lies on this line segment.
151
+ * @param {number} x - The x coordinate of the point to check.
152
+ * @param {number} y - The y coordinate of the point to check.
153
+ * @returns {boolean} True if the point lies on this line segment, false otherwise.
154
154
  */
155
155
  pointOnSegment(x, y) {
156
156
  const xMin = Math.min(this.start.x, this.end.x);
@@ -161,9 +161,9 @@ export class Line {
161
161
  }
162
162
 
163
163
  /**
164
- * TBD.
165
- * @param {Point} output - TBD.
166
- * @returns {Point} TBD.
164
+ * Returns a random point on this line.
165
+ * @param {Point} output - The point to store the result in (optional).
166
+ * @returns {Point} A random point on this line.
167
167
  */
168
168
  random(output = null) {
169
169
  const result = output || new Point();
@@ -174,10 +174,10 @@ export class Line {
174
174
  }
175
175
 
176
176
  /**
177
- * TBD.
178
- * @param {number} stepRate - TBD.
179
- * @param {number[][]} results - TBD.
180
- * @returns {number[][]} TBD.
177
+ * Gets coordinates of points along this line at regular intervals.
178
+ * @param {number} stepRate - The interval between points (default: 1).
179
+ * @param {number[][]} results - The array to store the results in (optional).
180
+ * @returns {number[][]} An array of coordinate pairs representing points along this line.
181
181
  */
182
182
  coordinatesOnLine(stepRate = 1, results = []) {
183
183
  let x1 = Math.round(this.start.x);
@@ -210,16 +210,16 @@ export class Line {
210
210
  }
211
211
 
212
212
  /**
213
- * TBD.
214
- * @returns {Line} TBD.
213
+ * Creates a clone of this line.
214
+ * @returns {Line} A new line with the same values as this one.
215
215
  */
216
216
  clone() {
217
217
  return clone(this);
218
218
  }
219
219
 
220
220
  /**
221
- * TBD.
222
- * @returns {number} TBD.
221
+ * Gets the length of this line.
222
+ * @returns {number} The length of this line.
223
223
  */
224
224
  get length() {
225
225
  return Math.sqrt(
@@ -229,112 +229,112 @@ export class Line {
229
229
  }
230
230
 
231
231
  /**
232
- * TBD.
233
- * @returns {number} TBD.
232
+ * Gets the angle of this line in radians.
233
+ * @returns {number} The angle of this line in radians.
234
234
  */
235
235
  get angle() {
236
236
  return Math.atan2(this.end.y - this.start.y, this.end.x - this.start.x);
237
237
  }
238
238
 
239
239
  /**
240
- * TBD.
241
- * @returns {number} TBD.
240
+ * Gets the slope of this line.
241
+ * @returns {number} The slope of this line.
242
242
  */
243
243
  get slope() {
244
244
  return (this.end.y - this.start.y) / (this.end.x - this.start.x);
245
245
  }
246
246
 
247
247
  /**
248
- * TBD.
249
- * @returns {number} TBD.
248
+ * Gets the perpendicular slope of this line.
249
+ * @returns {number} The perpendicular slope of this line.
250
250
  */
251
251
  get perpSlope() {
252
252
  return -((this.end.x - this.start.x) / (this.end.y - this.start.y));
253
253
  }
254
254
 
255
255
  /**
256
- * TBD.
257
- * @returns {number} TBD.
256
+ * Gets the x coordinate of the leftmost point on this line.
257
+ * @returns {number} The x coordinate of the leftmost point on this line.
258
258
  */
259
259
  get x() {
260
260
  return Math.min(this.start.x, this.end.x);
261
261
  }
262
262
 
263
263
  /**
264
- * TBD.
265
- * @returns {number} TBD.
264
+ * Gets the y coordinate of the topmost point on this line.
265
+ * @returns {number} The y coordinate of the topmost point on this line.
266
266
  */
267
267
  get y() {
268
268
  return Math.min(this.start.y, this.end.y);
269
269
  }
270
270
 
271
271
  /**
272
- * TBD.
273
- * @returns {number} TBD.
272
+ * Gets the x coordinate of the leftmost point on this line.
273
+ * @returns {number} The x coordinate of the leftmost point on this line.
274
274
  */
275
275
  get left() {
276
276
  return Math.min(this.start.x, this.end.x);
277
277
  }
278
278
 
279
279
  /**
280
- * TBD.
281
- * @returns {number} TBD.
280
+ * Gets the x coordinate of the rightmost point on this line.
281
+ * @returns {number} The x coordinate of the rightmost point on this line.
282
282
  */
283
283
  get right() {
284
284
  return Math.max(this.start.x, this.end.x);
285
285
  }
286
286
 
287
287
  /**
288
- * TBD.
289
- * @returns {number} TBD.
288
+ * Gets the y coordinate of the topmost point on this line.
289
+ * @returns {number} The y coordinate of the topmost point on this line.
290
290
  */
291
291
  get top() {
292
292
  return Math.min(this.start.y, this.end.y);
293
293
  }
294
294
 
295
295
  /**
296
- * TBD.
297
- * @returns {number} TBD.
296
+ * Gets the y coordinate of the bottommost point on this line.
297
+ * @returns {number} The y coordinate of the bottommost point on this line.
298
298
  */
299
299
  get bottom() {
300
300
  return Math.max(this.start.y, this.end.y);
301
301
  }
302
302
 
303
303
  /**
304
- * TBD.
305
- * @returns {number} TBD.
304
+ * Gets the width of this line (absolute difference between x coordinates).
305
+ * @returns {number} The width of this line.
306
306
  */
307
307
  get width() {
308
308
  return Math.abs(this.start.x - this.end.x);
309
309
  }
310
310
 
311
311
  /**
312
- * TBD.
313
- * @returns {number} TBD.
312
+ * Gets the height of this line (absolute difference between y coordinates).
313
+ * @returns {number} The height of this line.
314
314
  */
315
315
  get height() {
316
316
  return Math.abs(this.start.y - this.end.y);
317
317
  }
318
318
 
319
319
  /**
320
- * TBD.
321
- * @returns {number} TBD.
320
+ * Gets the normal vector x component of this line (perpendicular to the line).
321
+ * @returns {number} The normal vector x component of this line.
322
322
  */
323
323
  get normalX() {
324
324
  return Math.cos(this.angle - 1.5707963267948966);
325
325
  }
326
326
 
327
327
  /**
328
- * TBD.
329
- * @returns {number} TBD.
328
+ * Gets the normal vector y component of this line (perpendicular to the line).
329
+ * @returns {number} The normal vector y component of this line.
330
330
  */
331
331
  get normalY() {
332
332
  return Math.sin(this.angle - 1.5707963267948966);
333
333
  }
334
334
 
335
335
  /**
336
- * TBD.
337
- * @returns {number} TBD.
336
+ * Gets the angle of the normal vector of this line in radians.
337
+ * @returns {number} The angle of the normal vector of this line in radians.
338
338
  */
339
339
  get normalAngle() {
340
340
  return wrap(this.angle - 1.5707963267948966, -Math.PI, Math.PI);
@@ -4,13 +4,13 @@ import { GEOM_MATRIX } from '../core/const.js';
4
4
 
5
5
  export class Matrix {
6
6
  /**
7
- * TBD.
8
- * @param {number} a - TBD.
9
- * @param {number} b - TBD.
10
- * @param {number} c - TBD.
11
- * @param {number} d - TBD.
12
- * @param {number} tx - TBD.
13
- * @param {number} ty - TBD.
7
+ * Creates a new Matrix instance.
8
+ * @param {number} a - The a component of the matrix (default: 1).
9
+ * @param {number} b - The b component of the matrix (default: 0).
10
+ * @param {number} c - The c component of the matrix (default: 0).
11
+ * @param {number} d - The d component of the matrix (default: 1).
12
+ * @param {number} tx - The tx component of the matrix (default: 0).
13
+ * @param {number} ty - The ty component of the matrix (default: 0).
14
14
  */
15
15
  constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
16
16
  /** @type {number} */
@@ -30,23 +30,23 @@ export class Matrix {
30
30
  }
31
31
 
32
32
  /**
33
- * TBD.
34
- * @param {number[]} array - TBD.
35
- * @returns {Matrix} TBD.
33
+ * Sets the matrix components from an array.
34
+ * @param {number[]} array - The array to read the matrix components from (should have 6 elements).
35
+ * @returns {Matrix} This matrix instance for chaining.
36
36
  */
37
37
  fromArray(array) {
38
38
  return this.setTo(array[0], array[1], array[3], array[4], array[2], array[5]);
39
39
  }
40
40
 
41
41
  /**
42
- * TBD.
43
- * @param {number} a - TBD.
44
- * @param {number} b - TBD.
45
- * @param {number} c - TBD.
46
- * @param {number} d - TBD.
47
- * @param {number} tx - TBD.
48
- * @param {number} ty - TBD.
49
- * @returns {Matrix} TBD.
42
+ * Sets the matrix components to new values.
43
+ * @param {number} a - The new a component of the matrix.
44
+ * @param {number} b - The new b component of the matrix.
45
+ * @param {number} c - The new c component of the matrix.
46
+ * @param {number} d - The new d component of the matrix.
47
+ * @param {number} tx - The new tx component of the matrix.
48
+ * @param {number} ty - The new ty component of the matrix.
49
+ * @returns {Matrix} This matrix instance for chaining.
50
50
  */
51
51
  setTo(a, b, c, d, tx, ty) {
52
52
  this.a = a;
@@ -59,17 +59,17 @@ export class Matrix {
59
59
  }
60
60
 
61
61
  /**
62
- * TBD.
63
- * @returns {Matrix} TBD.
62
+ * Creates a clone of this matrix.
63
+ * @returns {Matrix} A new matrix with the same values as this one.
64
64
  */
65
65
  clone() {
66
66
  return clone(this);
67
67
  }
68
68
 
69
69
  /**
70
- * TBD.
71
- * @param {Matrix} matrix - TBD.
72
- * @returns {Matrix} TBD.
70
+ * Copies the values of this matrix to another matrix.
71
+ * @param {Matrix} matrix - The matrix to copy values to.
72
+ * @returns {Matrix} The destination matrix.
73
73
  */
74
74
  copyTo(matrix) {
75
75
  matrix.copyFrom(this);
@@ -77,9 +77,9 @@ export class Matrix {
77
77
  }
78
78
 
79
79
  /**
80
- * TBD.
81
- * @param {Matrix} matrix - TBD.
82
- * @returns {Matrix} TBD.
80
+ * Copies the values from another matrix to this matrix.
81
+ * @param {Matrix} matrix - The matrix to copy values from.
82
+ * @returns {Matrix} This matrix instance for chaining.
83
83
  */
84
84
  copyFrom(matrix) {
85
85
  this.a = matrix.a;
@@ -92,10 +92,10 @@ export class Matrix {
92
92
  }
93
93
 
94
94
  /**
95
- * TBD.
96
- * @param {boolean} transpose - TBD.
97
- * @param {Float32Array} output - TBD.
98
- * @returns {Float32Array} TBD.
95
+ * Converts this matrix to a Float32Array.
96
+ * @param {boolean} transpose - Whether to transpose the matrix (default: false).
97
+ * @param {Float32Array} output - The array to store the result in (optional).
98
+ * @returns {Float32Array} A Float32Array containing the matrix elements.
99
99
  */
100
100
  toArray(transpose = false, output = null) {
101
101
  const result = output || new Float32Array(9);
@@ -124,10 +124,10 @@ export class Matrix {
124
124
  }
125
125
 
126
126
  /**
127
- * TBD.
128
- * @param {Point} pos - TBD.
129
- * @param {Point} output - TBD.
130
- * @returns {Point} TBD.
127
+ * Applies this matrix to a point.
128
+ * @param {Point} pos - The point to apply the matrix to.
129
+ * @param {Point} output - The point to store the result in (optional).
130
+ * @returns {Point} The transformed point.
131
131
  */
132
132
  apply(pos, output = null) {
133
133
  const result = output || new Point();
@@ -137,10 +137,10 @@ export class Matrix {
137
137
  }
138
138
 
139
139
  /**
140
- * TBD.
141
- * @param {Point} pos - TBD.
142
- * @param {Point} output - TBD.
143
- * @returns {Point} TBD.
140
+ * Applies the inverse of this matrix to a point.
141
+ * @param {Point} pos - The point to apply the inverse matrix to.
142
+ * @param {Point} output - The point to store the result in (optional).
143
+ * @returns {Point} The transformed point.
144
144
  */
145
145
  applyInverse(pos, output = null) {
146
146
  const result = output || new Point();
@@ -153,10 +153,10 @@ export class Matrix {
153
153
  }
154
154
 
155
155
  /**
156
- * TBD.
157
- * @param {number} x - TBD.
158
- * @param {number} y - TBD.
159
- * @returns {Matrix} TBD.
156
+ * Translates this matrix by the specified amounts.
157
+ * @param {number} x - The amount to translate in the x direction.
158
+ * @param {number} y - The amount to translate in the y direction.
159
+ * @returns {Matrix} This matrix instance for chaining.
160
160
  */
161
161
  translate(x, y) {
162
162
  this.tx += x;
@@ -165,10 +165,10 @@ export class Matrix {
165
165
  }
166
166
 
167
167
  /**
168
- * TBD.
169
- * @param {number} x - TBD.
170
- * @param {number} y - TBD.
171
- * @returns {Matrix} TBD.
168
+ * Scales this matrix by the specified amounts.
169
+ * @param {number} x - The amount to scale in the x direction.
170
+ * @param {number} y - The amount to scale in the y direction.
171
+ * @returns {Matrix} This matrix instance for chaining.
172
172
  */
173
173
  scale(x, y) {
174
174
  this.a *= x;
@@ -181,9 +181,9 @@ export class Matrix {
181
181
  }
182
182
 
183
183
  /**
184
- * TBD.
185
- * @param {number} angle - TBD.
186
- * @returns {Matrix} TBD.
184
+ * Rotates this matrix by the specified angle.
185
+ * @param {number} angle - The angle in radians to rotate by.
186
+ * @returns {Matrix} This matrix instance for chaining.
187
187
  */
188
188
  rotate(angle) {
189
189
  const cos = Math.cos(angle);
@@ -201,9 +201,9 @@ export class Matrix {
201
201
  }
202
202
 
203
203
  /**
204
- * TBD.
205
- * @param {Matrix} matrix - TBD.
206
- * @returns {Matrix} TBD.
204
+ * Appends another matrix to this matrix (multiplying matrices).
205
+ * @param {Matrix} matrix - The matrix to append.
206
+ * @returns {Matrix} This matrix instance for chaining.
207
207
  */
208
208
  append(matrix) {
209
209
  const a1 = this.a;
@@ -220,8 +220,8 @@ export class Matrix {
220
220
  }
221
221
 
222
222
  /**
223
- * TBD.
224
- * @returns {Matrix} TBD.
223
+ * Sets this matrix to an identity matrix (no transformation).
224
+ * @returns {Matrix} This matrix instance for chaining.
225
225
  */
226
226
  identity() {
227
227
  return this.setTo(1, 0, 0, 1, 0, 0);