@xort/cga 0.0.73 → 0.0.74

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 (49) hide show
  1. package/dist/IKanimation/Bone.js +3 -1
  2. package/dist/IKanimation/CCDSolver.js +2 -2
  3. package/dist/IKanimation/constaint/hinge.js +3 -1
  4. package/dist/IKanimation/constaint/slider.js +3 -1
  5. package/dist/alg/common.js +2 -2
  6. package/dist/alg/extrude.js +56 -54
  7. package/dist/alg/pointset.js +5 -5
  8. package/dist/alg/trianglution.js +12 -10
  9. package/dist/app.js +14 -10
  10. package/dist/diamondMaterialShader.js +6 -2
  11. package/dist/effect/breath-light.js +3 -1
  12. package/dist/extends/geometryaid.js +7 -7
  13. package/dist/index.js +6 -2
  14. package/dist/math/Color.js +9 -3
  15. package/dist/math/Euler.js +12 -10
  16. package/dist/math/HVec3.js +3 -1
  17. package/dist/math/Mat3.js +1 -1
  18. package/dist/math/Mat4.js +6 -6
  19. package/dist/math/Quat.js +4 -2
  20. package/dist/math/Vec.js +3 -1
  21. package/dist/math/Vec2.js +3 -1
  22. package/dist/math/Vec3.js +7 -5
  23. package/dist/math/Vec4.js +3 -1
  24. package/dist/math/vector.js +9 -7
  25. package/dist/render/buffer-attribute.js +12 -28
  26. package/dist/render/eventhandler.d.ts +1 -1
  27. package/dist/render/eventhandler.js +9 -7
  28. package/dist/render/geometry.js +2 -2
  29. package/dist/render/mesh.js +11 -9
  30. package/dist/render/thing.js +10 -8
  31. package/dist/render/types.js +2 -1
  32. package/dist/struct/3d/Box.js +3 -3
  33. package/dist/struct/3d/Capsule.js +3 -1
  34. package/dist/struct/3d/Circle.js +2 -2
  35. package/dist/struct/3d/Disk.js +1 -1
  36. package/dist/struct/3d/Line.js +4 -4
  37. package/dist/struct/3d/Path.js +13 -11
  38. package/dist/struct/3d/Plane.js +12 -10
  39. package/dist/struct/3d/Point.js +3 -1
  40. package/dist/struct/3d/Polygon.js +3 -1
  41. package/dist/struct/3d/Polyline.js +3 -1
  42. package/dist/struct/3d/Rectangle.js +3 -1
  43. package/dist/struct/3d/Segment.js +9 -7
  44. package/dist/struct/3d/Shape.js +3 -1
  45. package/dist/struct/3d/Sphere.js +1 -1
  46. package/dist/struct/3d/Triangle.js +3 -1
  47. package/dist/struct/data/ArrayList.js +11 -9
  48. package/dist/struct/data/ArrayObject.js +3 -1
  49. package/package.json +1 -1
@@ -10,10 +10,12 @@ var __extends = (this && this.__extends) || (function () {
10
10
  var extendStatics = function (d, b) {
11
11
  extendStatics = Object.setPrototypeOf ||
12
12
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
14
14
  return extendStatics(d, b);
15
15
  };
16
16
  return function (d, b) {
17
+ if (typeof b !== "function" && b !== null)
18
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
17
19
  extendStatics(d, b);
18
20
  function __() { this.constructor = d; }
19
21
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -73,15 +75,15 @@ var Path = /** @class */ (function (_super) {
73
75
  var normal = new Vec3_1.Vec3();
74
76
  normal.crossVecs(d1, d2).normalize();
75
77
  this.get(i).normal = normal;
76
- var bdir = Vec3_1.v3().addVecs(d1, d2).normalize();
78
+ var bdir = (0, Vec3_1.v3)().addVecs(d1, d2).normalize();
77
79
  this.get(i).bdirection = bdir;
78
- this.get(i).bnormal = Vec3_1.v3().crossVecs(bdir, normal).normalize();
80
+ this.get(i).bnormal = (0, Vec3_1.v3)().crossVecs(bdir, normal).normalize();
79
81
  // }
80
82
  }
81
83
  if (!this._closed) { //不闭合路径 最后一个点没有
82
- this.get(-1).bdirection = Vec3_1.v3();
83
- this.get(-1).normal = Vec3_1.v3();
84
- this.get(-1).bnormal = Vec3_1.v3();
84
+ this.get(-1).bdirection = (0, Vec3_1.v3)();
85
+ this.get(-1).normal = (0, Vec3_1.v3)();
86
+ this.get(-1).bnormal = (0, Vec3_1.v3)();
85
87
  }
86
88
  if (!this._closed) {
87
89
  // 不闭合的情况下怎么样去计算端点的up和normal
@@ -116,10 +118,10 @@ var Path = /** @class */ (function (_super) {
116
118
  configurable: true
117
119
  });
118
120
  Path.prototype.applyMat4 = function (mat4) {
119
- pointset_1.applyMat4(this._array, mat4);
121
+ (0, pointset_1.applyMat4)(this._array, mat4);
120
122
  };
121
123
  Path.prototype.scale = function (x, y, z) {
122
- common_1.scale(this._array, Vec3_1.v3(x, y, z), true);
124
+ (0, common_1.scale)(this._array, (0, Vec3_1.v3)(x, y, z), true);
123
125
  };
124
126
  /**
125
127
  * 截取一段从from到to的path
@@ -157,7 +159,7 @@ var Path = /** @class */ (function (_super) {
157
159
  Path.prototype.getPointByDistance = function (arg_distance, left, right) {
158
160
  if (left === void 0) { left = 0; }
159
161
  if (right === void 0) { right = this.length - 1; }
160
- var distance = Math_1.clamp(arg_distance, 0, this.get(-1).tlen);
162
+ var distance = (0, Math_1.clamp)(arg_distance, 0, this.get(-1).tlen);
161
163
  if (distance !== arg_distance)
162
164
  return null;
163
165
  if (right - left === 1) {
@@ -186,7 +188,7 @@ var Path = /** @class */ (function (_super) {
186
188
  Path.prototype.getPointByDistancePure = function (arg_distance, left, right) {
187
189
  if (left === void 0) { left = 0; }
188
190
  if (right === void 0) { right = this.length - 1; }
189
- var distance = Math_1.clamp(arg_distance, 0, this.get(-1).tlen);
191
+ var distance = (0, Math_1.clamp)(arg_distance, 0, this.get(-1).tlen);
190
192
  if (distance !== arg_distance)
191
193
  return null;
192
194
  if (right - left === 1) {
@@ -294,7 +296,7 @@ var Path = /** @class */ (function (_super) {
294
296
  res.push(mileages);
295
297
  }
296
298
  if (normalize) {
297
- var tl = types_1.isDefined(totalMileage) ? totalMileage : this.totalMileages(ps);
299
+ var tl = (0, types_1.isDefined)(totalMileage) ? totalMileage : this.totalMileages(ps);
298
300
  for (var i = 0, len = ps.length; i < len; i++) {
299
301
  res[i] /= tl;
300
302
  }
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
8
10
  };
9
11
  Object.defineProperty(exports, "__esModule", { value: true });
10
12
  exports.Plane = void 0;
@@ -68,9 +70,9 @@ var Plane = /** @class */ (function () {
68
70
  */
69
71
  Plane.prototype.frontback = function (point) {
70
72
  var value = this.normal.dot(point);
71
- if (Math_1.approximateEqual(value, 0))
73
+ if ((0, Math_1.approximateEqual)(value, 0))
72
74
  return 0;
73
- return Math_1.sign(this.normal.dot(point));
75
+ return (0, Math_1.sign)(this.normal.dot(point));
74
76
  };
75
77
  //---Distance-------------------------------------------------------------------------------
76
78
  Plane.prototype.distancePoint = function (point) {
@@ -223,8 +225,8 @@ var Plane = /** @class */ (function () {
223
225
  * @param polyVS
224
226
  */
225
227
  Plane.prototype.splitPolyVS = function (polyVS) {
226
- polyVS = __spreadArrays(polyVS);
227
- mesh_1.indexable(polyVS);
228
+ polyVS = __spreadArray([], polyVS, true);
229
+ (0, mesh_1.indexable)(polyVS);
228
230
  var jd0 = -1; //找出第一个交点
229
231
  var jdp0; //找出第一个交点
230
232
  var lastOriention = this.orientationPoint(polyVS[0]);
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -23,16 +25,16 @@ var Segment = /** @class */ (function (_super) {
23
25
  * @param {Point|Vec3} p1
24
26
  */
25
27
  function Segment(_p0, _p1) {
26
- if (_p0 === void 0) { _p0 = Vec3_1.v3(); }
27
- if (_p1 === void 0) { _p1 = Vec3_1.v3(); }
28
+ if (_p0 === void 0) { _p0 = (0, Vec3_1.v3)(); }
29
+ if (_p1 === void 0) { _p1 = (0, Vec3_1.v3)(); }
28
30
  var _this = _super.call(this) || this;
29
31
  Object.setPrototypeOf(_this, Segment.prototype);
30
- _this.push(Vec3_1.v3().copy(_p0), Vec3_1.v3().copy(_p1));
31
- _this.center = Vec3_1.v3().addVecs(_p0, _p1).multiplyScalar(0.5);
32
- _this.extentDirection = Vec3_1.v3().subVecs(_p1, _p0);
32
+ _this.push((0, Vec3_1.v3)().copy(_p0), (0, Vec3_1.v3)().copy(_p1));
33
+ _this.center = (0, Vec3_1.v3)().addVecs(_p0, _p1).multiplyScalar(0.5);
34
+ _this.extentDirection = (0, Vec3_1.v3)().subVecs(_p1, _p0);
33
35
  _this.extentSqr = _this.extentDirection.lengthSq();
34
36
  _this.extent = Math.sqrt(_this.extentSqr);
35
- _this.direction = Vec3_1.v3().copy(_this.extentDirection).normalize();
37
+ _this.direction = (0, Vec3_1.v3)().copy(_this.extentDirection).normalize();
36
38
  return _this;
37
39
  }
38
40
  Segment.prototype.set = function (p0, p1) {
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -4,7 +4,7 @@ exports.Sphere = void 0;
4
4
  var Vec3_1 = require("../../math/Vec3");
5
5
  var Sphere = /** @class */ (function () {
6
6
  function Sphere(center, radius) {
7
- if (center === void 0) { center = Vec3_1.v3(); }
7
+ if (center === void 0) { center = (0, Vec3_1.v3)(); }
8
8
  if (radius === void 0) { radius = 0; }
9
9
  this.center = center;
10
10
  this.radius = radius;
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
8
10
  };
9
11
  Object.defineProperty(exports, "__esModule", { value: true });
10
12
  exports.ArrayList = void 0;
@@ -83,7 +85,7 @@ var ArrayList = /** @class */ (function () {
83
85
  for (var _i = 1; _i < arguments.length; _i++) {
84
86
  value[_i - 1] = arguments[_i];
85
87
  }
86
- (_a = this._array).splice.apply(_a, __spreadArrays([i, 0], value));
88
+ (_a = this._array).splice.apply(_a, __spreadArray([i, 0], value, false));
87
89
  };
88
90
  ArrayList.prototype.splice = function (start, deleteCount) {
89
91
  var _a;
@@ -91,7 +93,7 @@ var ArrayList = /** @class */ (function () {
91
93
  for (var _i = 2; _i < arguments.length; _i++) {
92
94
  items[_i - 2] = arguments[_i];
93
95
  }
94
- (_a = this._array).splice.apply(_a, __spreadArrays([start, deleteCount], items));
96
+ (_a = this._array).splice.apply(_a, __spreadArray([start, deleteCount], items, false));
95
97
  };
96
98
  ArrayList.prototype.get = function (index) {
97
99
  if (index < 0)
@@ -111,7 +113,7 @@ var ArrayList = /** @class */ (function () {
111
113
  * 克隆
112
114
  */
113
115
  ArrayList.prototype.clone = function () {
114
- return new this.constructor(common_1.clone(this._array));
116
+ return new this.constructor((0, common_1.clone)(this._array));
115
117
  };
116
118
  /**
117
119
  * 分类
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xort/cga",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "description": "Xtor Compute Geometry Algorithm Libary 计算几何算法库",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",