@xort/cga 0.0.72 → 0.0.73

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 (57) hide show
  1. package/dist/IKanimation/Bone.js +1 -3
  2. package/dist/IKanimation/CCDSolver.js +2 -2
  3. package/dist/IKanimation/constaint/hinge.js +1 -3
  4. package/dist/IKanimation/constaint/slider.js +1 -3
  5. package/dist/alg/common.js +2 -2
  6. package/dist/alg/extrude.js +54 -56
  7. package/dist/alg/pointset.js +5 -5
  8. package/dist/alg/trianglution.js +10 -12
  9. package/dist/app.js +10 -14
  10. package/dist/diamondMaterialShader.js +2 -6
  11. package/dist/effect/breath-light.js +1 -3
  12. package/dist/extends/geometryaid.js +7 -7
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.js +3 -6
  15. package/dist/math/Color.d.ts +29 -0
  16. package/dist/math/Color.js +195 -0
  17. package/dist/math/Euler.js +10 -12
  18. package/dist/math/HVec3.js +1 -3
  19. package/dist/math/Mat3.js +1 -1
  20. package/dist/math/Mat4.js +6 -6
  21. package/dist/math/Quat.js +2 -4
  22. package/dist/math/Vec.js +1 -3
  23. package/dist/math/Vec2.js +1 -3
  24. package/dist/math/Vec3.js +5 -7
  25. package/dist/math/Vec4.js +1 -3
  26. package/dist/math/vector.js +7 -9
  27. package/dist/render/buffer-attribute.js +28 -12
  28. package/dist/render/eventhandler.d.ts +1 -1
  29. package/dist/render/eventhandler.js +7 -9
  30. package/dist/render/geometry.js +2 -2
  31. package/dist/render/mesh.js +9 -11
  32. package/dist/render/thing.js +8 -10
  33. package/dist/render/types.js +1 -2
  34. package/dist/struct/3d/Box.js +3 -3
  35. package/dist/struct/3d/Capsule.js +1 -3
  36. package/dist/struct/3d/Circle.js +2 -2
  37. package/dist/struct/3d/Disk.js +1 -1
  38. package/dist/struct/3d/Line.js +4 -4
  39. package/dist/struct/3d/Path.js +11 -13
  40. package/dist/struct/3d/Plane.js +10 -12
  41. package/dist/struct/3d/Point.js +1 -3
  42. package/dist/struct/3d/Polygon.js +1 -3
  43. package/dist/struct/3d/Polyline.js +1 -3
  44. package/dist/struct/3d/Rectangle.js +1 -3
  45. package/dist/struct/3d/Segment.js +7 -9
  46. package/dist/struct/3d/Shape.js +1 -3
  47. package/dist/struct/3d/Sphere.js +1 -1
  48. package/dist/struct/3d/Triangle.js +1 -3
  49. package/dist/struct/data/ArrayList.js +9 -11
  50. package/dist/struct/data/ArrayObject.js +1 -3
  51. package/docs/guide/distLineAll.md +5 -5
  52. package/docs/guide/distPointAll.md +6 -6
  53. package/docs/guide/distRayAll.md +4 -4
  54. package/docs/guide/distSegmentAll.md +1 -1
  55. package/package.json +2 -2
  56. package/src/index.ts +1 -0
  57. package/src/math/Color.ts +157 -0
@@ -1,12 +1,10 @@
1
1
  "use strict";
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));
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;
10
8
  };
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.trianglutionToGeometryBuffer = exports.toGeoBuffer = exports.triangListToBuffer = exports.indexable = void 0;
@@ -40,7 +38,7 @@ exports.indexable = indexable;
40
38
  function triangListToBuffer(vertices, triangleList) {
41
39
  indexable(triangleList);
42
40
  var indices = [];
43
- (0, array_1.forall)(triangleList, function (v) {
41
+ array_1.forall(triangleList, function (v) {
44
42
  indices.push(v.index);
45
43
  });
46
44
  return toGeoBuffer(vertices, indices);
@@ -70,8 +68,8 @@ exports.toGeoBuffer = toGeoBuffer;
70
68
  function trianglutionToGeometryBuffer(boundary, holes, options) {
71
69
  if (holes === void 0) { holes = []; }
72
70
  if (options === void 0) { options = { normal: Vec3_1.Vec3.UnitZ }; }
73
- var triangles = (0, trianglution_1.triangulation)(boundary, holes, options);
74
- var vertices = __spreadArray(__spreadArray([], boundary, true), (0, array_1.flat)(holes), true);
71
+ var triangles = trianglution_1.triangulation(boundary, holes, options);
72
+ var vertices = __spreadArrays(boundary, array_1.flat(holes));
75
73
  var uvs = [];
76
74
  vertices.forEach(function (v) {
77
75
  uvs.push(v.x, v.z);
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -25,7 +23,7 @@ var Thing = /** @class */ (function (_super) {
25
23
  _this.cache = {};
26
24
  _this._useData = {};
27
25
  opts = opts || {};
28
- _this.uuid = (0, uuid_1.v4)();
26
+ _this.uuid = uuid_1.v4();
29
27
  _this.id = _this.uuid;
30
28
  _this.name = opts.name || "未命名";
31
29
  _this.alias = opts.alias;
@@ -153,11 +151,11 @@ var Thing = /** @class */ (function (_super) {
153
151
  return;
154
152
  Object.defineProperty(bindObject, name, {
155
153
  get: function () {
156
- return bindObject["_".concat(name)];
154
+ return bindObject["_" + name];
157
155
  },
158
156
  set: function (value) {
159
- var oldValue = bindObject["_".concat(name)];
160
- bindObject["_".concat(name)] = value;
157
+ var oldValue = bindObject["_" + name];
158
+ bindObject["_" + name] = value;
161
159
  bindObject.fire('set', name, oldValue, value);
162
160
  },
163
161
  configurable: true
@@ -177,11 +175,11 @@ function buildAccessor(name, bindObject) {
177
175
  return;
178
176
  Object.defineProperty(bindObject, name, {
179
177
  get: function () {
180
- return bindObject["_".concat(name)];
178
+ return bindObject["_" + name];
181
179
  },
182
180
  set: function (value) {
183
- var oldValue = bindObject["_".concat(name)];
184
- bindObject["_".concat(name)] = value;
181
+ var oldValue = bindObject["_" + name];
182
+ bindObject["_" + name] = value;
185
183
  bindObject.fire('set', name, oldValue, value);
186
184
  },
187
185
  configurable: true
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBufferArray = void 0;
4
- var isBufferArray = function (obj) {
4
+ exports.isBufferArray = function (obj) {
5
5
  var types = ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'];
6
6
  return types.indexOf(obj.constructor.name) > -1;
7
7
  };
8
- exports.isBufferArray = isBufferArray;
@@ -5,9 +5,9 @@ var Vec3_1 = require("../../math/Vec3");
5
5
  var _vector = new Vec3_1.Vec3();
6
6
  var Box = /** @class */ (function () {
7
7
  function Box(min, max) {
8
- if (min === void 0) { min = (0, Vec3_1.v3)(Infinity, Infinity, Infinity); }
9
- if (max === void 0) { max = (0, Vec3_1.v3)(-Infinity, -Infinity, -Infinity); }
10
- this._center = (0, Vec3_1.v3)();
8
+ if (min === void 0) { min = Vec3_1.v3(Infinity, Infinity, Infinity); }
9
+ if (max === void 0) { max = Vec3_1.v3(-Infinity, -Infinity, -Infinity); }
10
+ this._center = Vec3_1.v3();
11
11
  this.min = min;
12
12
  this.max = max;
13
13
  // if (points) {
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -35,7 +35,7 @@ var Circle = /** @class */ (function () {
35
35
  Circle.prototype.arc1 = function (fixp0, fixp1, movep, normal) {
36
36
  this.setFrom3Points(fixp0, fixp1, movep);
37
37
  this.startAngle = 0;
38
- this.endAngle = (0, common_1.angle)(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
38
+ this.endAngle = common_1.angle(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
39
39
  };
40
40
  /**
41
41
  * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
@@ -49,7 +49,7 @@ var Circle = /** @class */ (function () {
49
49
  this.center.copy(center);
50
50
  var v2 = movep.clone().sub(center);
51
51
  var v1 = fixp1.clone().sub(center);
52
- var jd = (0, common_1.angle)(v1, v2);
52
+ var jd = common_1.angle(v1, v2);
53
53
  };
54
54
  Circle.prototype.setFrom3Points = function (p0, p1, p2, normal) {
55
55
  // if (pointsCollinear(p0, p1, p2))
@@ -5,7 +5,7 @@ var Vec3_1 = require("../../math/Vec3");
5
5
  var Disk = /** @class */ (function () {
6
6
  function Disk(center, radius, normal) {
7
7
  if (normal === void 0) { normal = Vec3_1.Vec3.UnitY; }
8
- this.center = center || (0, Vec3_1.v3)();
8
+ this.center = center || Vec3_1.v3();
9
9
  this.normal = normal;
10
10
  this.radius = radius || 0;
11
11
  this.w = this.normal.dot(center);
@@ -8,8 +8,8 @@ var _v1 = new Vec3_1.Vec3;
8
8
  ;
9
9
  var Line = /** @class */ (function () {
10
10
  function Line(origin, end) {
11
- if (origin === void 0) { origin = (0, Vec3_1.v3)(); }
12
- if (end === void 0) { end = (0, Vec3_1.v3)(); }
11
+ if (origin === void 0) { origin = Vec3_1.v3(); }
12
+ if (end === void 0) { end = Vec3_1.v3(); }
13
13
  this.origin = origin;
14
14
  this.end = end;
15
15
  this.direction = this.end
@@ -192,10 +192,10 @@ var Line = /** @class */ (function () {
192
192
  if (robust === void 0) { robust = false; }
193
193
  if (numInputs === 1) {
194
194
  if (Math.abs(v[0][0]) > Math.abs(v[0][1])) {
195
- v[1] = (0, Vec3_1.v3)(-v[0].z, 0, +v[0].x);
195
+ v[1] = Vec3_1.v3(-v[0].z, 0, +v[0].x);
196
196
  }
197
197
  else {
198
- v[1] = (0, Vec3_1.v3)(0, +v[0].z, -v[0].y);
198
+ v[1] = Vec3_1.v3(0, +v[0].z, -v[0].y);
199
199
  }
200
200
  ;
201
201
  numInputs = 2;
@@ -10,12 +10,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
13
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
19
17
  extendStatics(d, b);
20
18
  function __() { this.constructor = d; }
21
19
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -75,15 +73,15 @@ var Path = /** @class */ (function (_super) {
75
73
  var normal = new Vec3_1.Vec3();
76
74
  normal.crossVecs(d1, d2).normalize();
77
75
  this.get(i).normal = normal;
78
- var bdir = (0, Vec3_1.v3)().addVecs(d1, d2).normalize();
76
+ var bdir = Vec3_1.v3().addVecs(d1, d2).normalize();
79
77
  this.get(i).bdirection = bdir;
80
- this.get(i).bnormal = (0, Vec3_1.v3)().crossVecs(bdir, normal).normalize();
78
+ this.get(i).bnormal = Vec3_1.v3().crossVecs(bdir, normal).normalize();
81
79
  // }
82
80
  }
83
81
  if (!this._closed) { //不闭合路径 最后一个点没有
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)();
82
+ this.get(-1).bdirection = Vec3_1.v3();
83
+ this.get(-1).normal = Vec3_1.v3();
84
+ this.get(-1).bnormal = Vec3_1.v3();
87
85
  }
88
86
  if (!this._closed) {
89
87
  // 不闭合的情况下怎么样去计算端点的up和normal
@@ -118,10 +116,10 @@ var Path = /** @class */ (function (_super) {
118
116
  configurable: true
119
117
  });
120
118
  Path.prototype.applyMat4 = function (mat4) {
121
- (0, pointset_1.applyMat4)(this._array, mat4);
119
+ pointset_1.applyMat4(this._array, mat4);
122
120
  };
123
121
  Path.prototype.scale = function (x, y, z) {
124
- (0, common_1.scale)(this._array, (0, Vec3_1.v3)(x, y, z), true);
122
+ common_1.scale(this._array, Vec3_1.v3(x, y, z), true);
125
123
  };
126
124
  /**
127
125
  * 截取一段从from到to的path
@@ -159,7 +157,7 @@ var Path = /** @class */ (function (_super) {
159
157
  Path.prototype.getPointByDistance = function (arg_distance, left, right) {
160
158
  if (left === void 0) { left = 0; }
161
159
  if (right === void 0) { right = this.length - 1; }
162
- var distance = (0, Math_1.clamp)(arg_distance, 0, this.get(-1).tlen);
160
+ var distance = Math_1.clamp(arg_distance, 0, this.get(-1).tlen);
163
161
  if (distance !== arg_distance)
164
162
  return null;
165
163
  if (right - left === 1) {
@@ -188,7 +186,7 @@ var Path = /** @class */ (function (_super) {
188
186
  Path.prototype.getPointByDistancePure = function (arg_distance, left, right) {
189
187
  if (left === void 0) { left = 0; }
190
188
  if (right === void 0) { right = this.length - 1; }
191
- var distance = (0, Math_1.clamp)(arg_distance, 0, this.get(-1).tlen);
189
+ var distance = Math_1.clamp(arg_distance, 0, this.get(-1).tlen);
192
190
  if (distance !== arg_distance)
193
191
  return null;
194
192
  if (right - left === 1) {
@@ -296,7 +294,7 @@ var Path = /** @class */ (function (_super) {
296
294
  res.push(mileages);
297
295
  }
298
296
  if (normalize) {
299
- var tl = (0, types_1.isDefined)(totalMileage) ? totalMileage : this.totalMileages(ps);
297
+ var tl = types_1.isDefined(totalMileage) ? totalMileage : this.totalMileages(ps);
300
298
  for (var i = 0, len = ps.length; i < len; i++) {
301
299
  res[i] /= tl;
302
300
  }
@@ -1,12 +1,10 @@
1
1
  "use strict";
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));
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;
10
8
  };
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.Plane = void 0;
@@ -70,9 +68,9 @@ var Plane = /** @class */ (function () {
70
68
  */
71
69
  Plane.prototype.frontback = function (point) {
72
70
  var value = this.normal.dot(point);
73
- if ((0, Math_1.approximateEqual)(value, 0))
71
+ if (Math_1.approximateEqual(value, 0))
74
72
  return 0;
75
- return (0, Math_1.sign)(this.normal.dot(point));
73
+ return Math_1.sign(this.normal.dot(point));
76
74
  };
77
75
  //---Distance-------------------------------------------------------------------------------
78
76
  Plane.prototype.distancePoint = function (point) {
@@ -225,8 +223,8 @@ var Plane = /** @class */ (function () {
225
223
  * @param polyVS
226
224
  */
227
225
  Plane.prototype.splitPolyVS = function (polyVS) {
228
- polyVS = __spreadArray([], polyVS, true);
229
- (0, mesh_1.indexable)(polyVS);
226
+ polyVS = __spreadArrays(polyVS);
227
+ mesh_1.indexable(polyVS);
230
228
  var jd0 = -1; //找出第一个交点
231
229
  var jdp0; //找出第一个交点
232
230
  var lastOriention = this.orientationPoint(polyVS[0]);
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -25,16 +23,16 @@ var Segment = /** @class */ (function (_super) {
25
23
  * @param {Point|Vec3} p1
26
24
  */
27
25
  function Segment(_p0, _p1) {
28
- if (_p0 === void 0) { _p0 = (0, Vec3_1.v3)(); }
29
- if (_p1 === void 0) { _p1 = (0, Vec3_1.v3)(); }
26
+ if (_p0 === void 0) { _p0 = Vec3_1.v3(); }
27
+ if (_p1 === void 0) { _p1 = Vec3_1.v3(); }
30
28
  var _this = _super.call(this) || this;
31
29
  Object.setPrototypeOf(_this, Segment.prototype);
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);
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);
35
33
  _this.extentSqr = _this.extentDirection.lengthSq();
36
34
  _this.extent = Math.sqrt(_this.extentSqr);
37
- _this.direction = (0, Vec3_1.v3)().copy(_this.extentDirection).normalize();
35
+ _this.direction = Vec3_1.v3().copy(_this.extentDirection).normalize();
38
36
  return _this;
39
37
  }
40
38
  Segment.prototype.set = function (p0, p1) {
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  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 = (0, Vec3_1.v3)(); }
7
+ if (center === void 0) { center = Vec3_1.v3(); }
8
8
  if (radius === void 0) { radius = 0; }
9
9
  this.center = center;
10
10
  this.radius = radius;
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -1,12 +1,10 @@
1
1
  "use strict";
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));
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;
10
8
  };
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.ArrayList = void 0;
@@ -85,7 +83,7 @@ var ArrayList = /** @class */ (function () {
85
83
  for (var _i = 1; _i < arguments.length; _i++) {
86
84
  value[_i - 1] = arguments[_i];
87
85
  }
88
- (_a = this._array).splice.apply(_a, __spreadArray([i, 0], value, false));
86
+ (_a = this._array).splice.apply(_a, __spreadArrays([i, 0], value));
89
87
  };
90
88
  ArrayList.prototype.splice = function (start, deleteCount) {
91
89
  var _a;
@@ -93,7 +91,7 @@ var ArrayList = /** @class */ (function () {
93
91
  for (var _i = 2; _i < arguments.length; _i++) {
94
92
  items[_i - 2] = arguments[_i];
95
93
  }
96
- (_a = this._array).splice.apply(_a, __spreadArray([start, deleteCount], items, false));
94
+ (_a = this._array).splice.apply(_a, __spreadArrays([start, deleteCount], items));
97
95
  };
98
96
  ArrayList.prototype.get = function (index) {
99
97
  if (index < 0)
@@ -113,7 +111,7 @@ var ArrayList = /** @class */ (function () {
113
111
  * 克隆
114
112
  */
115
113
  ArrayList.prototype.clone = function () {
116
- return new this.constructor((0, common_1.clone)(this._array));
114
+ return new this.constructor(common_1.clone(this._array));
117
115
  };
118
116
  /**
119
117
  * 分类
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -14,7 +14,7 @@ sidebarDepth: 2
14
14
  </ClientOnly>
15
15
 
16
16
  ```javascript
17
- import * as cga from "@xtor/cga.js";
17
+ import * as cga from "@xtor/cga";
18
18
  var line0 = new cga.Line(randomV3(), randomV3());
19
19
  var line1 = new cga.Line(randomV3(), randomV3());
20
20
  var result = line0.distanceLine(line1);
@@ -30,7 +30,7 @@ var result = line0.distanceLine(line1);
30
30
  </ClientOnly>
31
31
 
32
32
  ```javascript
33
- import * as cga from "@xtor/cga.js";
33
+ import * as cga from "@xtor/cga";
34
34
  var line1 = new cga.Line(randomV3(), randomV3());
35
35
  var ray = new cga.Ray(randomV3(), randomV3().normalize());
36
36
  var result = line.distanceRay(ray);
@@ -46,7 +46,7 @@ var result = line.distanceRay(ray);
46
46
  </ClientOnly>
47
47
 
48
48
  ```javascript
49
- import * as cga from "@xtor/cga.js";
49
+ import * as cga from "@xtor/cga";
50
50
  var line1 = new cga.Line(randomV3(), randomV3());
51
51
  var segment = new cga.Segment(randomV3(), randomV3());
52
52
  var result = line.distanceSegment(segment);
@@ -62,7 +62,7 @@ var result = line.distanceSegment(segment);
62
62
  </ClientOnly>
63
63
 
64
64
  ```javascript
65
- import * as cga from "@xtor/cga.js";
65
+ import * as cga from "@xtor/cga";
66
66
  var line1 = new cga.Line(randomV3(), randomV3());
67
67
  var triangle = new cga.Triangle(randomV3(), randomV3(),randomV3());
68
68
  var result = line.distanceTriangle(triangle);
@@ -78,7 +78,7 @@ var result = line.distanceTriangle(triangle);
78
78
  </ClientOnly>
79
79
 
80
80
  ```javascript
81
- import * as cga from "@xtor/cga.js";
81
+ import * as cga from "@xtor/cga";
82
82
  var line1 = new cga.Line(randomV3(), randomV3());
83
83
  var circle = new cga.Circle(randomV3(), randomV3().normalize(),Math.random()*50)+5);
84
84
  var result = line.distanceCircle(circle);
@@ -5,7 +5,7 @@
5
5
  ## 三维向量点
6
6
 
7
7
  ```js
8
- import * as cga from "@xtor/cga.js";
8
+ import * as cga from "@xtor/cga";
9
9
  function randomV3() {
10
10
  return cga.Vec3(
11
11
  Math.random() * 100 - 50,
@@ -25,7 +25,7 @@ function randomV3() {
25
25
  </ClientOnly>
26
26
 
27
27
  ```javascript
28
- import * as cga from "@xtor/cga.js";
28
+ import * as cga from "@xtor/cga";
29
29
  var point0 = new cga.Vec3().copy(randomV3());
30
30
  var point1 = new cga.Vec3().copy(randomV3());
31
31
  var result = point0.distancePoint(point1);
@@ -41,7 +41,7 @@ var result = point0.distancePoint(point1);
41
41
  </ClientOnly>
42
42
 
43
43
  ```javascript
44
- import * as cga from "@xtor/cga.js";
44
+ import * as cga from "@xtor/cga";
45
45
  var point = new cga.Vec3().copy(randomV3());
46
46
  var line = new cga.Line(randomV3(), randomV3());
47
47
  var result = point.distanceTo(line);
@@ -55,7 +55,7 @@ var result = point.distanceTo(line);
55
55
  </ClientOnly>
56
56
 
57
57
  ```javascript
58
- import * as cga from "@xtor/cga.js";
58
+ import * as cga from "@xtor/cga";
59
59
  var point = new cga.Vec3().copy(randomV3());
60
60
  var ray = new cga.Ray(randomV3(), randomV3().normalize());
61
61
  var result = point.distanceRay(ray);
@@ -69,7 +69,7 @@ var result = point.distanceRay(ray);
69
69
  </ClientOnly>
70
70
 
71
71
  ```javascript
72
- import * as cga from "@xtor/cga.js";
72
+ import * as cga from "@xtor/cga";
73
73
  var point = new cga.Vec3().copy(randomV3());
74
74
  var seg = new cga.Segment(randomV3(), randomV3());
75
75
  var result = point.distanceSegment(seg);
@@ -83,7 +83,7 @@ var result = point.distanceSegment(seg);
83
83
  </ClientOnly>
84
84
 
85
85
  ```javascript
86
- import * as cga from "@xtor/cga.js";
86
+ import * as cga from "@xtor/cga";
87
87
  var vs = [];
88
88
  for (let i = 0; i < 100000; i++) {
89
89
  vs.push(randomV3());
@@ -14,7 +14,7 @@ title:射线
14
14
  </ClientOnly>
15
15
 
16
16
  ```javascript
17
- import * as cga from "@xtor/cga.js";
17
+ import * as cga from "@xtor/cga";
18
18
  var ray0 = new cga.Ray(randomV3(), randomV3().normalize());
19
19
  var ray1 = new cga.Ray(randomV3(), randomV3().normalize());
20
20
  var result = ray0.distanceLine(ray1);
@@ -30,7 +30,7 @@ var result = ray0.distanceLine(ray1);
30
30
  </ClientOnly>
31
31
 
32
32
  ```javascript
33
- import * as cga from "@xtor/cga.js";
33
+ import * as cga from "@xtor/cga";
34
34
  var ray = new cga.Ray(randomV3(), randomV3().normalize());
35
35
  var segment = new cga.Segment(randomV3(), randomV3());
36
36
  var result = ray.distanceSegment(segment);
@@ -46,7 +46,7 @@ var result = ray.distanceSegment(segment);
46
46
  </ClientOnly>
47
47
 
48
48
  ```javascript
49
- import * as cga from "@xtor/cga.js";
49
+ import * as cga from "@xtor/cga";
50
50
  var ray = new cga.Ray(randomV3(), randomV3().normalize());
51
51
  var triangle = new cga.Triangle(randomV3(), randomV3(),randomV3());
52
52
  var result = ray.distanceTriangle(segment);
@@ -62,7 +62,7 @@ var result = ray.distanceTriangle(segment);
62
62
  </ClientOnly>
63
63
 
64
64
  ```javascript
65
- import * as cga from "@xtor/cga.js";
65
+ import * as cga from "@xtor/cga";
66
66
  var ray = new cga.Ray(randomV3(), randomV3());
67
67
  var tringle = new cga.Tringle(randomV3(), randomV3(), randomV3());
68
68
  var result = ray.distanceTriangle(triangle);