@woosh/meep-engine 2.119.42 → 2.119.44

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 (30) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/3d/eulerAnglesFromMatrix.js +4 -4
  3. package/src/core/geom/3d/normal/spherical/sphere_map_transform.js +2 -2
  4. package/src/core/geom/3d/sphere/sphere_project.d.ts +8 -3
  5. package/src/core/geom/3d/sphere/sphere_project.d.ts.map +1 -1
  6. package/src/core/geom/3d/sphere/sphere_project.js +19 -9
  7. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +1 -2
  8. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
  9. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -2
  10. package/src/core/geom/3d/topology/simplify/quadratic/Quadratic3.d.ts +1 -1
  11. package/src/core/geom/3d/topology/simplify/quadratic/Quadratic3.d.ts.map +1 -1
  12. package/src/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +4 -4
  13. package/src/core/geom/Vector2.js +2 -2
  14. package/src/core/geom/vec2/v2_angle_between.js +2 -2
  15. package/src/core/geom/vec2/v2_distance.d.ts.map +1 -1
  16. package/src/core/geom/vec2/v2_distance.js +2 -3
  17. package/src/core/geom/vec3/serialization/v3_binary_equality_decode.d.ts.map +1 -0
  18. package/src/core/geom/vec3/serialization/v3_binary_equality_encode.d.ts.map +1 -0
  19. package/src/engine/ecs/systems/AnimationSystem.js +1 -1
  20. package/src/engine/ecs/transform/TransformSerializationAdapter.js +2 -2
  21. package/src/engine/graphics/ecs/animation/animator/AnimationGraphSystem.js +1 -1
  22. package/src/core/geom/vec2/v2_magnitude.d.ts +0 -6
  23. package/src/core/geom/vec2/v2_magnitude.d.ts.map +0 -1
  24. package/src/core/geom/vec2/v2_magnitude.js +0 -6
  25. package/src/core/geom/vec3/v3_binary_equality_decode.d.ts.map +0 -1
  26. package/src/core/geom/vec3/v3_binary_equality_encode.d.ts.map +0 -1
  27. /package/src/core/geom/vec3/{v3_binary_equality_decode.d.ts → serialization/v3_binary_equality_decode.d.ts} +0 -0
  28. /package/src/core/geom/vec3/{v3_binary_equality_decode.js → serialization/v3_binary_equality_decode.js} +0 -0
  29. /package/src/core/geom/vec3/{v3_binary_equality_encode.d.ts → serialization/v3_binary_equality_encode.d.ts} +0 -0
  30. /package/src/core/geom/vec3/{v3_binary_equality_encode.js → serialization/v3_binary_equality_encode.js} +0 -0
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.42",
8
+ "version": "2.119.44",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,4 +1,4 @@
1
- import { v2_magnitude } from "../vec2/v2_magnitude.js";
1
+ import { v2_length } from "../vec2/v2_length.js";
2
2
 
3
3
 
4
4
  /**
@@ -62,10 +62,10 @@ export function eulerAnglesFromMatrix(
62
62
  } else {
63
63
  res[0] += Math.PI;
64
64
  }
65
- const s2 = v2_magnitude(coeff(m4, j, i), coeff(m4, k, i));
65
+ const s2 = v2_length(coeff(m4, j, i), coeff(m4, k, i));
66
66
  res[1] = -atan2(s2, coeff(m4, i, i));
67
67
  } else {
68
- const s2 = v2_magnitude(coeff(m4, j, i), coeff(m4, k, i));
68
+ const s2 = v2_length(coeff(m4, j, i), coeff(m4, k, i));
69
69
  res[1] = atan2(s2, coeff(m4, i, i));
70
70
  }
71
71
 
@@ -88,7 +88,7 @@ export function eulerAnglesFromMatrix(
88
88
 
89
89
  res[0] = atan2(coeff(m4, j, k), coeff(m4, k, k));
90
90
 
91
- const c2 = v2_magnitude(coeff(m4, i, i), coeff(m4, i, j));
91
+ const c2 = v2_length(coeff(m4, i, i), coeff(m4, i, j));
92
92
 
93
93
  if ((odd && res[0] < 0) || ((~odd) && res[0] > 0)) {
94
94
  if (res[0] > 0) {
@@ -1,4 +1,4 @@
1
- import { v2_magnitude } from "../../../vec2/v2_magnitude.js";
1
+ import { v2_length } from "../../../vec2/v2_length.js";
2
2
  import { v3_dot } from "../../../vec3/v3_dot.js";
3
3
 
4
4
  /*
@@ -32,7 +32,7 @@ half3 decode (half4 enc, float3 view)
32
32
  * @param {number} z
33
33
  */
34
34
  export function encode_unit_to_spheremap(output, output_offset, x, y, z) {
35
- const length_xy = v2_magnitude(x, y);
35
+ const length_xy = v2_length(x, y);
36
36
 
37
37
  const norm_xy_x = x / length_xy;
38
38
  const norm_xy_y = y / length_xy;
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * Computations of screen-space pixel area covered by a sphere
3
3
  * NOTE: Port of GLSL code by Ingo Quilez. Source: http://www.iquilezles.org/www/articles/sphereproj/sphereproj.htm
4
- * @param {Vector4} sph Sphere in world space
5
- * @param {Matrix4} cam camera transform matrix (world to camera)(inverse world matrix of camera)
4
+ * @param {number[]|{0:number,1:number,2:number,3:number}} sph Sphere in world space
5
+ * @param {number[]|Float32Array} cam camera transform matrix (world to camera)(inverse world matrix of camera)
6
6
  * @param {number} fl focal length (fov in Radians)
7
7
  * @returns {number} area on the screen as a fraction, 1=entire screen, 0=zero area
8
8
  */
9
- export function sphere_project(sph: Vector4, cam: Matrix4, fl: number): number;
9
+ export function sphere_project(sph: number[] | {
10
+ 0: number;
11
+ 1: number;
12
+ 2: number;
13
+ 3: number;
14
+ }, cam: number[] | Float32Array, fl: number): number;
10
15
  //# sourceMappingURL=sphere_project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sphere_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/sphere/sphere_project.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,+DAHW,MAAM,GACJ,MAAM,CA0BlB"}
1
+ {"version":3,"file":"sphere_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/sphere/sphere_project.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,oCALW,MAAM,EAAE,GAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,OAC9C,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,GACJ,MAAM,CAoClB"}
@@ -7,23 +7,26 @@ const v4 = [];
7
7
  /**
8
8
  * Computations of screen-space pixel area covered by a sphere
9
9
  * NOTE: Port of GLSL code by Ingo Quilez. Source: http://www.iquilezles.org/www/articles/sphereproj/sphereproj.htm
10
- * @param {Vector4} sph Sphere in world space
11
- * @param {Matrix4} cam camera transform matrix (world to camera)(inverse world matrix of camera)
10
+ * @param {number[]|{0:number,1:number,2:number,3:number}} sph Sphere in world space
11
+ * @param {number[]|Float32Array} cam camera transform matrix (world to camera)(inverse world matrix of camera)
12
12
  * @param {number} fl focal length (fov in Radians)
13
13
  * @returns {number} area on the screen as a fraction, 1=entire screen, 0=zero area
14
14
  */
15
15
  export function sphere_project(sph, cam, fl) {
16
16
  assert.notNull(cam, 'cam');
17
+ assert.isNumber(fl, 'fl');
18
+ assert.greaterThan(fl, 0, 'fl');
17
19
 
18
- v4[0] = sph.x;
19
- v4[1] = sph.y;
20
- v4[2] = sph.z;
20
+ v4[0] = sph[0];
21
+ v4[1] = sph[1];
22
+ v4[2] = sph[2];
21
23
  v4[3] = 1;
22
24
 
23
25
  //transform to camera space
24
- v4_multiply_mat4(v4, v4, cam.elements);
26
+ v4_multiply_mat4(v4, v4, cam);
25
27
 
26
- const r2 = sph.w * sph.w;
28
+ const r = sph[3];
29
+ const r2 = r * r;
27
30
 
28
31
  const v4_x = v4[0];
29
32
  const v4_y = v4[1];
@@ -33,7 +36,14 @@ export function sphere_project(sph, cam, fl) {
33
36
 
34
37
  const l2 = v3_dot(v4_x, v4_y, v4_z, v4_x, v4_y, v4_z);
35
38
 
36
- const area = -Math.PI * fl * fl * r2 * Math.sqrt(Math.abs((l2 - r2) / (r2 - z2))) / (r2 - z2);
39
+ const rz2 = r2 - z2;
37
40
 
38
- return area;
41
+ if (rz2 === 0) {
42
+ // avoid division by 0
43
+ return 0;
44
+ }
45
+
46
+ const area = -Math.PI * fl * fl * r2 * Math.sqrt(Math.abs((l2 - r2) / rz2)) / rz2;
47
+
48
+ return Math.abs(area);
39
49
  }
@@ -199,14 +199,13 @@ export class TetrahedralMesh {
199
199
  allocate(): number;
200
200
  /**
201
201
  *
202
- * @param {number[]|Float32Array} points
203
202
  * @param {number} a
204
203
  * @param {number} b
205
204
  * @param {number} c
206
205
  * @param {number} d
207
206
  * @returns {number} index of the new tetrahedron
208
207
  */
209
- append(points: number[] | Float32Array, a: number, b: number, c: number, d: number): number;
208
+ append(a: number, b: number, c: number, d: number): number;
210
209
  /**
211
210
  * Sets back-links on neighbours to this tet to INVALID_NEIGHBOUR basically making them into mesh surface
212
211
  * This is a useful method for when you want to completely remove a given tet from the mesh to make sure that no dangling references will remain
@@ -1 +1 @@
1
- {"version":3,"file":"TetrahedralMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/TetrahedralMesh.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,qCAFU,MAAM,CAEkD;AAElE;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,4BAFU,MAAM,CAEwB;AAoBxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACI;;;OAGG;IACH,2BAFW,MAAM,EAqDhB;IAhDG;;;;OAIG;IACH,iBAAsE;IAEtE;;;;OAIG;IACH,sBAAmD;IAEnD;;;;OAIG;IACH,eAAyC;IAEzC;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,mBAAmB;IAEnB;;;;OAIG;IACH,eAAgB;IAEhB;;;;OAIG;IACH,uBAAuB;IAI3B;;;;;OAKG;IACH,+BAEC;IAED;;;;;OAKG;IACH,2BAEC;IAED;;;;OAIG;IACH,2CAUC;IAED;;;;OAIG;IACH,WAFY,MAAM,EAAE,CAYnB;IAED;;;OAGG;IACH,cAWC;IAED;;;OAGG;IACH,sBAFW,MAAM,QA8BhB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,QAFY,MAAM,CAMjB;IAED;;;;OAIG;IACH,oBAEC;IAGD;;;;OAIG;IACH,qBAYC;IAED;;;OAGG;IACH,yBAFW,MAAM,QAWhB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACL,OAAO,CAiBlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,aACN,MAAM,QAchB;IAGD;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,UACN,MAAM,QAiBhB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,MAAM,GACL,OAAO,CAUlB;IAGD;;;;OAIG;IACH,YAFY,MAAM,CA4BjB;IAED;;;;;;;;OAQG;IACH,eAPW,MAAM,EAAE,GAAC,YAAY,KACrB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAqBlB;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAmBhB;IAED;;;;OAIG;IACH,oBAFW,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,2CAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,8BAPW,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CA8DlB;IAGD;;;;;OAKG;IACH,uBAHW,MAAM,qBACN,MAAM,QA0ChB;IAED;;;;OAIG;IACH,WAFa,MAAM,CA2ClB;IAED;;;OAGG;IACH,kBAFW,YAAY,QAUtB;IAED;;;OAGG;IACH,oBAFW,YAAY,QAiBtB;IAED;;;OAGG;IACH,oBAFY,MAAM,CAYjB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAUhB;IAGL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;6BA1xB4B,iCAAiC"}
1
+ {"version":3,"file":"TetrahedralMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/TetrahedralMesh.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,qCAFU,MAAM,CAEkD;AAElE;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,4BAFU,MAAM,CAEwB;AAoBxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACI;;;OAGG;IACH,2BAFW,MAAM,EAqDhB;IAhDG;;;;OAIG;IACH,iBAAsE;IAEtE;;;;OAIG;IACH,sBAAmD;IAEnD;;;;OAIG;IACH,eAAyC;IAEzC;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,mBAAmB;IAEnB;;;;OAIG;IACH,eAAgB;IAEhB;;;;OAIG;IACH,uBAAuB;IAI3B;;;;;OAKG;IACH,+BAEC;IAED;;;;;OAKG;IACH,2BAEC;IAED;;;;OAIG;IACH,2CAUC;IAED;;;;OAIG;IACH,WAFY,MAAM,EAAE,CAYnB;IAED;;;OAGG;IACH,cAWC;IAED;;;OAGG;IACH,sBAFW,MAAM,QA8BhB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,QAFY,MAAM,CAMjB;IAED;;;;OAIG;IACH,oBAEC;IAGD;;;;OAIG;IACH,qBAYC;IAED;;;OAGG;IACH,yBAFW,MAAM,QAWhB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACL,OAAO,CAiBlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,aACN,MAAM,QAchB;IAGD;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,UACN,MAAM,QAiBhB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,MAAM,GACL,OAAO,CAUlB;IAGD;;;;OAIG;IACH,YAFY,MAAM,CA4BjB;IAED;;;;;;;OAOG;IACH,UANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAqBlB;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAmBhB;IAED;;;;OAIG;IACH,oBAFW,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,2CAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,8BAPW,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CA8DlB;IAGD;;;;;OAKG;IACH,uBAHW,MAAM,qBACN,MAAM,QA0ChB;IAED;;;;OAIG;IACH,WAFa,MAAM,CA2ClB;IAED;;;OAGG;IACH,kBAFW,YAAY,QAUtB;IAED;;;OAGG;IACH,oBAFW,YAAY,QAiBtB;IAED;;;OAGG;IACH,oBAFY,MAAM,CAYjB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAUhB;IAGL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;6BAzxB4B,iCAAiC"}
@@ -457,14 +457,13 @@ export class TetrahedralMesh {
457
457
 
458
458
  /**
459
459
  *
460
- * @param {number[]|Float32Array} points
461
460
  * @param {number} a
462
461
  * @param {number} b
463
462
  * @param {number} c
464
463
  * @param {number} d
465
464
  * @returns {number} index of the new tetrahedron
466
465
  */
467
- append(points, a, b, c, d) {
466
+ append( a, b, c, d) {
468
467
  const tetra_index = this.allocate();
469
468
 
470
469
  const address = tetra_index * LAYOUT_TETRA_BYTE_SIZE;
@@ -54,7 +54,7 @@ export class Quadratic3 {
54
54
  /**
55
55
  * Find optimal vertex position based on the quadratic
56
56
  *
57
- * Based on Bleder's implementation: https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/blenlib/intern/quadric.c
57
+ * Based on Blender's implementation: https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/blenlib/intern/quadric.c
58
58
  *
59
59
  * @param {number[]} out
60
60
  * @returns {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"Quadratic3.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/Quadratic3.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IAGI,WAAO;IACP,WAAO;IACP,WAAO;IACP,WAAO;IAGP,WAAO;IACP,WAAO;IACP,WAAO;IAGP,WAAO;IACP,WAAO;IAGP,WAAO;IAGP;;;OAGG;IACH,kBAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAMjD;IAED;;;OAGG;IACH,eAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAcjD;IAED;;;;;OAKG;IACH,sBAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,WACvC,MAAM,GACJ,OAAO,CAkCnB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB;IAED;;;OAGG;IACH,sCAmBC;IAED;;;;;;OAMG;IACH,YALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CASlB;IAED;;;;;;;OAOG;IACH,cAHW,MAAM,EAAE,GACN,OAAO,CAiBnB;IAED;;;OAGG;IACH,OAFW,UAAU,QAuBpB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAoBhB;IAED;;;OAGG;IACH,SAFa,UAAU,CAQtB;IAED;;;OAGG;IACH,YAFW,UAAU,QAqBpB;IAED;;OAEG;IACH,cAmBC;CACJ"}
1
+ {"version":3,"file":"Quadratic3.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/Quadratic3.js"],"names":[],"mappings":"AASA;;;GAGG;AACH;IAGI,WAAO;IACP,WAAO;IACP,WAAO;IACP,WAAO;IAGP,WAAO;IACP,WAAO;IACP,WAAO;IAGP,WAAO;IACP,WAAO;IAGP,WAAO;IAGP;;;OAGG;IACH,kBAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAMjD;IAED;;;OAGG;IACH,eAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAcjD;IAED;;;;;OAKG;IACH,sBAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,WACvC,MAAM,GACJ,OAAO,CAkCnB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB;IAED;;;OAGG;IACH,sCAmBC;IAED;;;;;;OAMG;IACH,YALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CASlB;IAED;;;;;;;OAOG;IACH,cAHW,MAAM,EAAE,GACN,OAAO,CAgBnB;IAED;;;OAGG;IACH,OAFW,UAAU,QAuBpB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAoBhB;IAED;;;OAGG;IACH,SAFa,UAAU,CAQtB;IAED;;;OAGG;IACH,YAFW,UAAU,QAqBpB;IAED;;OAEG;IACH,cAmBC;CACJ"}
@@ -5,6 +5,7 @@ import { v3_dot } from "../../../../vec3/v3_dot.js";
5
5
  import { compute_triangle_normal } from "../../../compute_triangle_normal.js";
6
6
 
7
7
  const scratch_v3 = new Float32Array(3);
8
+ const scratch_m3 = new Float32Array(9);
8
9
 
9
10
  /**
10
11
  * Quadric Error Metric
@@ -166,19 +167,18 @@ export class Quadratic3 {
166
167
  /**
167
168
  * Find optimal vertex position based on the quadratic
168
169
  *
169
- * Based on Bleder's implementation: https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/blenlib/intern/quadric.c
170
+ * Based on Blender's implementation: https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/blenlib/intern/quadric.c
170
171
  *
171
172
  * @param {number[]} out
172
173
  * @returns {boolean}
173
174
  */
174
175
  optimize(out) {
175
- const m = new Float32Array(9);
176
176
 
177
- if (this.toTensorM3Inverse(m, EPSILON)) {
177
+ if (this.toTensorM3Inverse(scratch_m3, EPSILON)) {
178
178
 
179
179
  this.toVector3(out);
180
180
 
181
- vec3.transformMat3(out, out, m);
181
+ vec3.transformMat3(out, out, scratch_m3);
182
182
  vec3.negate(out, out);
183
183
 
184
184
  return true;
@@ -14,8 +14,8 @@ import { min2 } from "../math/min2.js";
14
14
  import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
15
15
  import { v2_distance } from "./vec2/v2_distance.js";
16
16
  import { v2_dot } from "./vec2/v2_dot.js";
17
+ import { v2_length } from "./vec2/v2_length.js";
17
18
  import { v2_length_sqr } from "./vec2/v2_length_sqr.js";
18
- import { v2_magnitude } from "./vec2/v2_magnitude.js";
19
19
 
20
20
  class Vector2 {
21
21
  /**
@@ -525,7 +525,7 @@ class Vector2 {
525
525
  * @returns {number}
526
526
  */
527
527
  length() {
528
- return v2_magnitude(this.x, this.y);
528
+ return v2_length(this.x, this.y);
529
529
  }
530
530
 
531
531
  /**
@@ -1,6 +1,6 @@
1
1
  import { clamp } from "../../math/clamp.js";
2
2
  import { v2_dot } from "./v2_dot.js";
3
- import { v2_magnitude } from "./v2_magnitude.js";
3
+ import { v2_length } from "./v2_length.js";
4
4
 
5
5
  /**
6
6
  *
@@ -12,7 +12,7 @@ import { v2_magnitude } from "./v2_magnitude.js";
12
12
  */
13
13
  export function v2_angle_between(x0, y0, x1, y1) {
14
14
  const d = v2_dot(x0, y0, x1, y1);
15
- const l = v2_magnitude(x0, y0) * v2_magnitude(x1, y1);
15
+ const l = v2_length(x0, y0) * v2_length(x1, y1);
16
16
 
17
17
  const theta = clamp(d / l, -1, 1);
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"v2_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_distance.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,gCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAUlB"}
1
+ {"version":3,"file":"v2_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_distance.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,gCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAUlB"}
@@ -1,6 +1,5 @@
1
1
  import { assert } from "../../assert.js";
2
-
3
- import { v2_magnitude } from "./v2_magnitude.js";
2
+ import { v2_length } from "./v2_length.js";
4
3
 
5
4
  /**
6
5
  *
@@ -17,5 +16,5 @@ export function v2_distance(x0, y0, x1, y1) {
17
16
  assert.isNumber(x1, 'x0');
18
17
  assert.isNumber(y1, 'x0');
19
18
 
20
- return v2_magnitude(x1 - x0, y1 - y0);
19
+ return v2_length(x1 - x0, y1 - y0);
21
20
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_binary_equality_decode.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/vec3/serialization/v3_binary_equality_decode.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wEAHW,MAAM,EAAE,iBACR,MAAM,QAuChB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_binary_equality_encode.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/vec3/serialization/v3_binary_equality_encode.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mEAJW,MAAM,KACN,MAAM,KACN,MAAM,QAyChB"}
@@ -286,7 +286,7 @@ class AnimationSystem extends System {
286
286
  v4boundingSphere.multiplyScalar(scaleMax);
287
287
  v4boundingSphere.add3(position);
288
288
 
289
- const area = sphere_project(v4boundingSphere, cameraMatrix, focalLength);
289
+ const area = sphere_project(v4boundingSphere, cameraMatrix.elements, focalLength);
290
290
  const inPixels = area * viewportSize.x * viewportSize.y;
291
291
  return inPixels;
292
292
  }
@@ -1,7 +1,7 @@
1
1
  import { quat_decode_from_uint32 } from "../../../core/geom/3d/quaternion/quat_decode_from_uint32.js";
2
2
  import { quat_encode_to_uint32 } from "../../../core/geom/3d/quaternion/quat_encode_to_uint32.js";
3
- import { v3_binary_equality_decode } from "../../../core/geom/vec3/v3_binary_equality_decode.js";
4
- import { v3_binary_equality_encode } from "../../../core/geom/vec3/v3_binary_equality_encode.js";
3
+ import { v3_binary_equality_decode } from "../../../core/geom/vec3/serialization/v3_binary_equality_decode.js";
4
+ import { v3_binary_equality_encode } from "../../../core/geom/vec3/serialization/v3_binary_equality_encode.js";
5
5
  import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
6
6
  import { Transform } from "./Transform.js";
7
7
 
@@ -240,7 +240,7 @@ export class AnimationGraphSystem extends System {
240
240
  v4boundingSphere.multiplyScalar(scaleMax);
241
241
  v4boundingSphere.add3(position);
242
242
 
243
- const area = sphere_project(v4boundingSphere, cameraMatrix, this.__focalLength);
243
+ const area = sphere_project(v4boundingSphere, cameraMatrix.elements, this.__focalLength);
244
244
 
245
245
  /**
246
246
  *
@@ -1,6 +0,0 @@
1
- /**
2
- * @deprecated
3
- */
4
- export const v2_magnitude: typeof v2_length;
5
- import { v2_length } from "./v2_length.js";
6
- //# sourceMappingURL=v2_magnitude.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v2_magnitude.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_magnitude.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,4CAAsC;0BALZ,gBAAgB"}
@@ -1,6 +0,0 @@
1
- import { v2_length } from "./v2_length.js";
2
-
3
- /**
4
- * @deprecated
5
- */
6
- export const v2_magnitude = v2_length;
@@ -1 +0,0 @@
1
- {"version":3,"file":"v3_binary_equality_decode.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_binary_equality_decode.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wEAHW,MAAM,EAAE,iBACR,MAAM,QAuChB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"v3_binary_equality_encode.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_binary_equality_encode.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mEAJW,MAAM,KACN,MAAM,KACN,MAAM,QAyChB"}