@xort/cga 0.0.76 → 0.0.79

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 (215) hide show
  1. package/dist/app.js +4 -1
  2. package/dist/math/Color.d.ts +7 -9
  3. package/dist/math/Color.js +54 -56
  4. package/package.json +2 -1
  5. package/src/app.ts +4 -1
  6. package/src/index.ts +1 -0
  7. package/src/math/Color.ts +60 -36
  8. package/dist/src/IKanimation/Bone.d.ts +0 -9
  9. package/dist/src/IKanimation/Bone.js +0 -40
  10. package/dist/src/IKanimation/CCDSolver.d.ts +0 -37
  11. package/dist/src/IKanimation/CCDSolver.js +0 -93
  12. package/dist/src/IKanimation/Joint.d.ts +0 -3
  13. package/dist/src/IKanimation/Joint.js +0 -17
  14. package/dist/src/IKanimation/constaint/constraint.d.ts +0 -10
  15. package/dist/src/IKanimation/constaint/constraint.js +0 -25
  16. package/dist/src/IKanimation/constaint/hinge.d.ts +0 -12
  17. package/dist/src/IKanimation/constaint/hinge.js +0 -46
  18. package/dist/src/IKanimation/constaint/slider.d.ts +0 -12
  19. package/dist/src/IKanimation/constaint/slider.js +0 -44
  20. package/dist/src/IKanimation/index.d.ts +0 -0
  21. package/dist/src/IKanimation/index.js +0 -9
  22. package/dist/src/IKanimation/isolver.d.ts +0 -4
  23. package/dist/src/IKanimation/isolver.js +0 -10
  24. package/dist/src/IKanimation/skeleton.d.ts +0 -13
  25. package/dist/src/IKanimation/skeleton.js +0 -31
  26. package/dist/src/alg/common.d.ts +0 -114
  27. package/dist/src/alg/common.js +0 -302
  28. package/dist/src/alg/curve.d.ts +0 -4
  29. package/dist/src/alg/curve.js +0 -11
  30. package/dist/src/alg/delaunator.d.ts +0 -29
  31. package/dist/src/alg/delaunator.js +0 -442
  32. package/dist/src/alg/delaunay.d.ts +0 -20
  33. package/dist/src/alg/delaunay.js +0 -199
  34. package/dist/src/alg/delaunayslow.d.ts +0 -18
  35. package/dist/src/alg/delaunayslow.js +0 -140
  36. package/dist/src/alg/extrude/extrude.d.ts +0 -3
  37. package/dist/src/alg/extrude/extrude.js +0 -17
  38. package/dist/src/alg/extrude.d.ts +0 -199
  39. package/dist/src/alg/extrude.js +0 -731
  40. package/dist/src/alg/offset/index.d.ts +0 -0
  41. package/dist/src/alg/offset/index.js +0 -9
  42. package/dist/src/alg/offset.d.ts +0 -0
  43. package/dist/src/alg/offset.js +0 -472
  44. package/dist/src/alg/pointset.d.ts +0 -94
  45. package/dist/src/alg/pointset.js +0 -223
  46. package/dist/src/alg/recognition.d.ts +0 -14
  47. package/dist/src/alg/recognition.js +0 -37
  48. package/dist/src/alg/result.d.ts +0 -22
  49. package/dist/src/alg/result.js +0 -2
  50. package/dist/src/alg/segmentset.d.ts +0 -11
  51. package/dist/src/alg/segmentset.js +0 -45
  52. package/dist/src/alg/sort.d.ts +0 -2
  53. package/dist/src/alg/sort.js +0 -14
  54. package/dist/src/alg/split.d.ts +0 -8
  55. package/dist/src/alg/split.js +0 -10
  56. package/dist/src/alg/trianglution.d.ts +0 -20
  57. package/dist/src/alg/trianglution.js +0 -77
  58. package/dist/src/alg/vol.d.ts +0 -6
  59. package/dist/src/alg/vol.js +0 -18
  60. package/dist/src/alg/voronoi.d.ts +0 -31
  61. package/dist/src/alg/voronoi.js +0 -418
  62. package/dist/src/app.d.ts +0 -1
  63. package/dist/src/app.js +0 -245
  64. package/dist/src/basic/distance.d.ts +0 -12
  65. package/dist/src/basic/distance.js +0 -42
  66. package/dist/src/csg/bsp.d.ts +0 -9
  67. package/dist/src/csg/bsp.js +0 -22
  68. package/dist/src/csg/node.d.ts +0 -12
  69. package/dist/src/csg/node.js +0 -75
  70. package/dist/src/csg/polygon.d.ts +0 -43
  71. package/dist/src/csg/polygon.js +0 -161
  72. package/dist/src/diamondMaterialShader.d.ts +0 -92
  73. package/dist/src/diamondMaterialShader.js +0 -118
  74. package/dist/src/effect/breath-light.d.ts +0 -4
  75. package/dist/src/effect/breath-light.js +0 -39
  76. package/dist/src/extends/geometryaid.d.ts +0 -28
  77. package/dist/src/extends/geometryaid.js +0 -80
  78. package/dist/src/extends/split.d.ts +0 -3
  79. package/dist/src/extends/split.js +0 -13
  80. package/dist/src/glview.d.ts +0 -112
  81. package/dist/src/glview.js +0 -564
  82. package/dist/src/index.d.ts +0 -36
  83. package/dist/src/index.js +0 -54
  84. package/dist/src/math/Euler.d.ts +0 -47
  85. package/dist/src/math/Euler.js +0 -245
  86. package/dist/src/math/HVec3.d.ts +0 -44
  87. package/dist/src/math/HVec3.js +0 -195
  88. package/dist/src/math/Mat3.d.ts +0 -29
  89. package/dist/src/math/Mat3.js +0 -244
  90. package/dist/src/math/Mat4.d.ts +0 -85
  91. package/dist/src/math/Mat4.js +0 -791
  92. package/dist/src/math/Math.d.ts +0 -130
  93. package/dist/src/math/Math.js +0 -198
  94. package/dist/src/math/Quat.d.ts +0 -83
  95. package/dist/src/math/Quat.js +0 -440
  96. package/dist/src/math/Vec.d.ts +0 -7
  97. package/dist/src/math/Vec.js +0 -43
  98. package/dist/src/math/Vec2.d.ts +0 -68
  99. package/dist/src/math/Vec2.js +0 -347
  100. package/dist/src/math/Vec3.d.ts +0 -232
  101. package/dist/src/math/Vec3.js +0 -1089
  102. package/dist/src/math/Vec4.d.ts +0 -81
  103. package/dist/src/math/Vec4.js +0 -494
  104. package/dist/src/math/vector.d.ts +0 -114
  105. package/dist/src/math/vector.js +0 -373
  106. package/dist/src/render/buffer-attribute.d.ts +0 -100
  107. package/dist/src/render/buffer-attribute.js +0 -340
  108. package/dist/src/render/eventhandler.d.ts +0 -78
  109. package/dist/src/render/eventhandler.js +0 -189
  110. package/dist/src/render/geometry.d.ts +0 -89
  111. package/dist/src/render/geometry.js +0 -775
  112. package/dist/src/render/mesh.d.ts +0 -25
  113. package/dist/src/render/mesh.js +0 -82
  114. package/dist/src/render/thing.d.ts +0 -34
  115. package/dist/src/render/thing.js +0 -196
  116. package/dist/src/render/types.d.ts +0 -2
  117. package/dist/src/render/types.js +0 -8
  118. package/dist/src/robust/plane.d.ts +0 -7
  119. package/dist/src/robust/plane.js +0 -17
  120. package/dist/src/robust/vec.d.ts +0 -15
  121. package/dist/src/robust/vec.js +0 -71
  122. package/dist/src/shape/arc.d.ts +0 -2
  123. package/dist/src/shape/arc.js +0 -14
  124. package/dist/src/struct/3d/Box.d.ts +0 -23
  125. package/dist/src/struct/3d/Box.js +0 -109
  126. package/dist/src/struct/3d/Capsule.d.ts +0 -12
  127. package/dist/src/struct/3d/Capsule.js +0 -36
  128. package/dist/src/struct/3d/Circle.d.ts +0 -34
  129. package/dist/src/struct/3d/Circle.js +0 -80
  130. package/dist/src/struct/3d/Disk.d.ts +0 -10
  131. package/dist/src/struct/3d/Disk.js +0 -22
  132. package/dist/src/struct/3d/Frustum.d.ts +0 -35
  133. package/dist/src/struct/3d/Frustum.js +0 -159
  134. package/dist/src/struct/3d/Line.d.ts +0 -40
  135. package/dist/src/struct/3d/Line.js +0 -339
  136. package/dist/src/struct/3d/Path.d.ts +0 -75
  137. package/dist/src/struct/3d/Path.js +0 -308
  138. package/dist/src/struct/3d/Plane.d.ts +0 -74
  139. package/dist/src/struct/3d/Plane.js +0 -295
  140. package/dist/src/struct/3d/Point.d.ts +0 -4
  141. package/dist/src/struct/3d/Point.js +0 -30
  142. package/dist/src/struct/3d/Polygon.d.ts +0 -8
  143. package/dist/src/struct/3d/Polygon.js +0 -55
  144. package/dist/src/struct/3d/Polyline.d.ts +0 -25
  145. package/dist/src/struct/3d/Polyline.js +0 -109
  146. package/dist/src/struct/3d/Ray.d.ts +0 -21
  147. package/dist/src/struct/3d/Ray.js +0 -262
  148. package/dist/src/struct/3d/Rectangle.d.ts +0 -7
  149. package/dist/src/struct/3d/Rectangle.js +0 -35
  150. package/dist/src/struct/3d/Segment.d.ts +0 -32
  151. package/dist/src/struct/3d/Segment.js +0 -334
  152. package/dist/src/struct/3d/Shape.d.ts +0 -4
  153. package/dist/src/struct/3d/Shape.js +0 -27
  154. package/dist/src/struct/3d/Sphere.d.ts +0 -11
  155. package/dist/src/struct/3d/Sphere.js +0 -30
  156. package/dist/src/struct/3d/Triangle.d.ts +0 -8
  157. package/dist/src/struct/3d/Triangle.js +0 -53
  158. package/dist/src/struct/data/ArrayList.d.ts +0 -42
  159. package/dist/src/struct/data/ArrayList.js +0 -172
  160. package/dist/src/struct/data/ArrayObject.d.ts +0 -30
  161. package/dist/src/struct/data/ArrayObject.js +0 -131
  162. package/dist/src/struct/data/type.d.ts +0 -13
  163. package/dist/src/struct/data/type.js +0 -18
  164. package/dist/src/utils/array.d.ts +0 -24
  165. package/dist/src/utils/array.js +0 -89
  166. package/dist/src/utils/types.d.ts +0 -24
  167. package/dist/src/utils/types.js +0 -20
  168. package/dist/src-gis/app.d.ts +0 -1
  169. package/dist/src-gis/app.js +0 -4
  170. package/dist/src-gis/core/Cartographic.d.ts +0 -20
  171. package/dist/src-gis/core/Cartographic.js +0 -52
  172. package/dist/src-gis/core/EllipsoidGeodesic.d.ts +0 -14
  173. package/dist/src-gis/core/EllipsoidGeodesic.js +0 -51
  174. package/dist/src-gis/core/EllipsoidTerrainProvider.d.ts +0 -10
  175. package/dist/src-gis/core/EllipsoidTerrainProvider.js +0 -29
  176. package/dist/src-gis/core/HeightmapTerrainData.d.ts +0 -3
  177. package/dist/src-gis/core/HeightmapTerrainData.js +0 -9
  178. package/dist/src-gis/core/Rectangle.d.ts +0 -45
  179. package/dist/src-gis/core/Rectangle.js +0 -127
  180. package/dist/src-gis/core/TaskProcessor.d.ts +0 -35
  181. package/dist/src-gis/core/TaskProcessor.js +0 -183
  182. package/dist/src-gis/gis.d.ts +0 -5
  183. package/dist/src-gis/gis.js +0 -12
  184. package/dist/src-gis/globe.d.ts +0 -12
  185. package/dist/src-gis/globe.js +0 -61
  186. package/dist/src-gis/math/Cartographic.d.ts +0 -8
  187. package/dist/src-gis/math/Cartographic.js +0 -26
  188. package/dist/src-gis/math/GVec3.d.ts +0 -12
  189. package/dist/src-gis/math/GVec3.js +0 -69
  190. package/dist/src-gis/math/ellipsoid.d.ts +0 -8
  191. package/dist/src-gis/math/ellipsoid.js +0 -14
  192. package/dist/src-gis/provider/DcTerrainProvider.d.ts +0 -15
  193. package/dist/src-gis/provider/DcTerrainProvider.js +0 -19
  194. package/dist/src-gis/provider/TerrainProvider.d.ts +0 -3
  195. package/dist/src-gis/provider/TerrainProvider.js +0 -17
  196. package/dist/src-gis/scene/DcImageryProvider.d.ts +0 -6
  197. package/dist/src-gis/scene/DcImageryProvider.js +0 -35
  198. package/dist/src-gis/scene/GeographicTilingScheme.d.ts +0 -21
  199. package/dist/src-gis/scene/GeographicTilingScheme.js +0 -46
  200. package/dist/src-gis/scene/Globe.d.ts +0 -34
  201. package/dist/src-gis/scene/Globe.js +0 -62
  202. package/dist/src-gis/scene/GlobeSurfaceShaderSet.d.ts +0 -6
  203. package/dist/src-gis/scene/GlobeSurfaceShaderSet.js +0 -11
  204. package/dist/src-gis/scene/GlobeSurfaceTileProvider.d.ts +0 -21
  205. package/dist/src-gis/scene/GlobeSurfaceTileProvider.js +0 -15
  206. package/dist/src-gis/scene/ImageryLayerCollection.d.ts +0 -21
  207. package/dist/src-gis/scene/ImageryLayerCollection.js +0 -87
  208. package/dist/src-gis/scene/ImageryProvider.d.ts +0 -4
  209. package/dist/src-gis/scene/ImageryProvider.js +0 -28
  210. package/dist/src-gis/scene/QuadtreeTile.d.ts +0 -48
  211. package/dist/src-gis/scene/QuadtreeTile.js +0 -137
  212. package/dist/src-gis/scene/UrlTemplateImageryProvider.d.ts +0 -9
  213. package/dist/src-gis/scene/UrlTemplateImageryProvider.js +0 -29
  214. package/dist/src-gis/scene/quadtree_primitive.d.ts +0 -14
  215. package/dist/src-gis/scene/quadtree_primitive.js +0 -50
@@ -1,25 +0,0 @@
1
- import { Vec3 } from "../math/Vec3";
2
- import { Vec2 } from "../math/Vec2";
3
- import { BufferGeometry } from "./geometry";
4
- import { BufferAttribute } from "./buffer-attribute";
5
- import { Vec4 } from "../math/Vec4";
6
- import { TypedArray } from "./types";
7
- export declare function indexable(obj: any[] | any, refIndexInfo?: {
8
- index: number;
9
- }, force?: boolean): void;
10
- export declare function triangListToBuffer(vertices: Vec3[], triangleList: Vec3[]): BufferGeometry;
11
- /**
12
- * 顶点纹理坐标所以转化为buffer数据
13
- * @param {Array<Verctor3|Number>} vertices
14
- * @param {Array<Number>} indices
15
- * @param {Array<Verctor2|Number>} uvs
16
- */
17
- export declare function toGeoBuffer(vertices: BufferAttribute | Array<number | Vec2 | Vec3 | Vec4> | TypedArray, indices: number[] | Uint32Array | Uint16Array, uvs?: BufferAttribute | TypedArray | Array<Vec2 | number>): BufferGeometry;
18
- /**
19
- * 三角剖分后转成几何体
20
- * 只考虑XY平面
21
- * @param {*} boundary
22
- * @param {*} hole
23
- * @param {*} options
24
- */
25
- export declare function trianglutionToGeometryBuffer(boundary: any, holes?: any[], options?: any): BufferGeometry;
@@ -1,82 +0,0 @@
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));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.trianglutionToGeometryBuffer = exports.toGeoBuffer = exports.triangListToBuffer = exports.indexable = void 0;
13
- /*
14
- * @Description :
15
- * @Author : 赵耀圣
16
- * @Q群 : 632839661
17
- * @Date : 2020-12-10 15:01:42
18
- * @LastEditTime : 2021-03-11 09:09:57
19
- * @FilePath : \cga.js\src\render\mesh.ts
20
- */
21
- var Vec3_1 = require("../math/Vec3");
22
- var array_1 = require("../utils/array");
23
- var geometry_1 = require("./geometry");
24
- var trianglution_1 = require("../alg/trianglution");
25
- function indexable(obj, refIndexInfo, force) {
26
- if (refIndexInfo === void 0) { refIndexInfo = { index: 0 }; }
27
- if (force === void 0) { force = false; }
28
- if (obj instanceof Array) {
29
- for (var i = 0; i < obj.length; i++)
30
- indexable(obj[i], refIndexInfo);
31
- }
32
- else if (obj instanceof Object) {
33
- if (obj.index === undefined)
34
- obj.index = refIndexInfo.index++;
35
- else if (force)
36
- obj.index = refIndexInfo.index++;
37
- }
38
- }
39
- exports.indexable = indexable;
40
- function triangListToBuffer(vertices, triangleList) {
41
- indexable(triangleList);
42
- var indices = [];
43
- (0, array_1.forall)(triangleList, function (v) {
44
- indices.push(v.index);
45
- });
46
- return toGeoBuffer(vertices, indices);
47
- }
48
- exports.triangListToBuffer = triangListToBuffer;
49
- /**
50
- * 顶点纹理坐标所以转化为buffer数据
51
- * @param {Array<Verctor3|Number>} vertices
52
- * @param {Array<Number>} indices
53
- * @param {Array<Verctor2|Number>} uvs
54
- */
55
- function toGeoBuffer(vertices, indices, uvs) {
56
- var geometry = new geometry_1.BufferGeometry();
57
- geometry.addAttribute('position', vertices, 3);
58
- geometry.addAttribute('uv', uvs || new Float32Array(geometry.getAttribute('position').array.length / 3 * 2), 2);
59
- geometry.setIndex(indices);
60
- return geometry;
61
- }
62
- exports.toGeoBuffer = toGeoBuffer;
63
- /**
64
- * 三角剖分后转成几何体
65
- * 只考虑XY平面
66
- * @param {*} boundary
67
- * @param {*} hole
68
- * @param {*} options
69
- */
70
- function trianglutionToGeometryBuffer(boundary, holes, options) {
71
- if (holes === void 0) { holes = []; }
72
- 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);
75
- var uvs = [];
76
- vertices.forEach(function (v) {
77
- uvs.push(v.x, v.z);
78
- });
79
- var geometry = toGeoBuffer(vertices, triangles, uvs);
80
- return geometry;
81
- }
82
- exports.trianglutionToGeometryBuffer = trianglutionToGeometryBuffer;
@@ -1,34 +0,0 @@
1
- import { EventHandler } from './eventhandler';
2
- export declare class Thing extends EventHandler {
3
- protected cache: any;
4
- uuid: any;
5
- id: any;
6
- name: any;
7
- alias: any;
8
- isThing: boolean;
9
- parent: any;
10
- children: any[];
11
- meta: any;
12
- needsUpdate: boolean;
13
- _renderObject: any;
14
- _useData: any;
15
- tag: string;
16
- constructor(opts?: any);
17
- add(thing: any, force?: boolean): this;
18
- remove(thing: any): this;
19
- foreach(cb: (arg0: this) => void): void;
20
- getObjectByProperty(name: string, value: any): any;
21
- getObjectById(id: any): any;
22
- getObjectByName(name: any): any;
23
- /**
24
- * 生成属性的set/get方法
25
- * @param {string} name
26
- * @param {function} setFunc
27
- * @param {boolean} skipEqualsCheck
28
- */
29
- defineProperty(name: string | number | symbol, setFunc: any, skipEqualsCheck?: boolean): void;
30
- buildAccessor(name: any, bindObject?: any): void;
31
- buildAccessors(schema: any[], bindObject?: this): void;
32
- }
33
- export declare function buildAccessor(name: any, bindObject: any): void;
34
- export declare function buildAccessors(schema: any[], bindObject: any): void;
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
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]; };
7
- return extendStatics(d, b);
8
- };
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
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.buildAccessors = exports.buildAccessor = exports.Thing = void 0;
19
- var eventhandler_1 = require("./eventhandler");
20
- var uuid_1 = require("uuid");
21
- var Thing = /** @class */ (function (_super) {
22
- __extends(Thing, _super);
23
- function Thing(opts) {
24
- var _this = _super.call(this) || this;
25
- _this.cache = {};
26
- _this._useData = {};
27
- opts = opts || {};
28
- _this.uuid = (0, uuid_1.v4)();
29
- _this.id = _this.uuid;
30
- _this.name = opts.name || "未命名";
31
- _this.alias = opts.alias;
32
- _this.isThing = true;
33
- _this.parent = null;
34
- _this.children = [];
35
- _this.meta = undefined;
36
- _this.needsUpdate = false;
37
- _this._renderObject = null;
38
- _this._useData = {};
39
- _this.tag = "untagged";
40
- _this.on("set", function (name, oldValue, newValue) {
41
- _this.fire("set_" + name, name, oldValue, newValue);
42
- });
43
- for (var key in opts) {
44
- if (opts.hasOwnProperty(key)) {
45
- if (!_this[key]) {
46
- _this[key] = opts[key];
47
- }
48
- }
49
- }
50
- return _this;
51
- }
52
- Thing.prototype.add = function (thing, force) {
53
- if (force === void 0) { force = false; }
54
- if (arguments.length > 1) {
55
- for (var i = 0; i < arguments.length; i++) {
56
- this.add(arguments[i]);
57
- }
58
- return this;
59
- }
60
- if (thing === this) {
61
- console.error("Thing.add: 自己不能作为自己的子节点", thing);
62
- return this;
63
- }
64
- if (thing && this.isThing) {
65
- if (thing.parent) {
66
- thing.parent.remove(thing);
67
- }
68
- thing.parent = this;
69
- this.children.push(thing);
70
- }
71
- else if (thing && force) {
72
- if (thing.parent) {
73
- thing.parent.remove(thing);
74
- }
75
- thing.parent = this;
76
- this.children.push(thing);
77
- }
78
- else {
79
- console.error("Thing.add:不是Thing类型", thing);
80
- }
81
- return this;
82
- };
83
- Thing.prototype.remove = function (thing) {
84
- if (arguments.length > 1) {
85
- for (var i = 0; i < arguments.length; i++) {
86
- this.remove(arguments[i]);
87
- }
88
- return this;
89
- }
90
- var index = this.children.indexOf(thing);
91
- if (index !== -1) {
92
- thing.parent = null;
93
- // thing.dispatchEvent( { type: 'removed' } );
94
- this.children.splice(index, 1);
95
- }
96
- return this;
97
- };
98
- Thing.prototype.foreach = function (cb) {
99
- cb(this);
100
- var children = this.children;
101
- for (var i = 0; i < children.length; i++) {
102
- children[i].foreach(cb);
103
- }
104
- };
105
- Thing.prototype.getObjectByProperty = function (name, value) {
106
- if (this[name] === value)
107
- return this;
108
- for (var i = 0, l = this.children.length; i < l; i++) {
109
- var child = this.children[i];
110
- if (!child.getObjectByProperty)
111
- continue;
112
- var object = child.getObjectByProperty(name, value);
113
- if (object !== undefined) {
114
- return object;
115
- }
116
- }
117
- return undefined;
118
- };
119
- Thing.prototype.getObjectById = function (id) {
120
- return this.getObjectByProperty('id', id);
121
- };
122
- Thing.prototype.getObjectByName = function (name) {
123
- return this.getObjectByProperty('name', name);
124
- };
125
- /**
126
- * 生成属性的set/get方法
127
- * @param {string} name
128
- * @param {function} setFunc
129
- * @param {boolean} skipEqualsCheck
130
- */
131
- Thing.prototype.defineProperty = function (name, setFunc, skipEqualsCheck) {
132
- var _this = this;
133
- if (skipEqualsCheck === void 0) { skipEqualsCheck = true; }
134
- Object.defineProperty(this, name, {
135
- get: function () {
136
- return _this._useData[name];
137
- },
138
- set: function (value) {
139
- var data = _this._useData;
140
- var oldValue = data[name];
141
- if (!skipEqualsCheck && oldValue === value)
142
- return;
143
- data[name] = value;
144
- if (setFunc)
145
- setFunc.call(_this, value, oldValue);
146
- },
147
- configurable: true
148
- });
149
- };
150
- Thing.prototype.buildAccessor = function (name, bindObject) {
151
- if (bindObject === void 0) { bindObject = this; }
152
- if (!bindObject)
153
- return;
154
- Object.defineProperty(bindObject, name, {
155
- get: function () {
156
- return bindObject["_".concat(name)];
157
- },
158
- set: function (value) {
159
- var oldValue = bindObject["_".concat(name)];
160
- bindObject["_".concat(name)] = value;
161
- bindObject.fire('set', name, oldValue, value);
162
- },
163
- configurable: true
164
- });
165
- };
166
- Thing.prototype.buildAccessors = function (schema, bindObject) {
167
- var _this = this;
168
- schema.forEach(function (descriptor) {
169
- _this.buildAccessor(descriptor, bindObject);
170
- });
171
- };
172
- return Thing;
173
- }(eventhandler_1.EventHandler));
174
- exports.Thing = Thing;
175
- function buildAccessor(name, bindObject) {
176
- if (!bindObject)
177
- return;
178
- Object.defineProperty(bindObject, name, {
179
- get: function () {
180
- return bindObject["_".concat(name)];
181
- },
182
- set: function (value) {
183
- var oldValue = bindObject["_".concat(name)];
184
- bindObject["_".concat(name)] = value;
185
- bindObject.fire('set', name, oldValue, value);
186
- },
187
- configurable: true
188
- });
189
- }
190
- exports.buildAccessor = buildAccessor;
191
- function buildAccessors(schema, bindObject) {
192
- schema.forEach(function (descriptor) {
193
- buildAccessor(descriptor, bindObject);
194
- });
195
- }
196
- exports.buildAccessors = buildAccessors;
@@ -1,2 +0,0 @@
1
- export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
- export declare const isBufferArray: (obj: any) => boolean;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBufferArray = void 0;
4
- var isBufferArray = function (obj) {
5
- var types = ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'];
6
- return types.indexOf(obj.constructor.name) > -1;
7
- };
8
- exports.isBufferArray = isBufferArray;
@@ -1,7 +0,0 @@
1
- import { Vec } from './vec';
2
- import Decimal from 'decimal.js';
3
- export declare class Plane {
4
- normal: Vec;
5
- w: Decimal;
6
- constructor(point: Vec, normal: Vec);
7
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Plane = void 0;
7
- var vec_1 = require("./vec");
8
- var decimal_js_1 = __importDefault(require("decimal.js"));
9
- var Plane = /** @class */ (function () {
10
- function Plane(point, normal) {
11
- this.normal = new vec_1.Vec(new decimal_js_1.default(0), new decimal_js_1.default(0), new decimal_js_1.default(0));
12
- this.normal.copy(normal);
13
- this.w = point.dot(normal).negated();
14
- }
15
- return Plane;
16
- }());
17
- exports.Plane = Plane;
@@ -1,15 +0,0 @@
1
- import Decimal from 'decimal.js';
2
- export declare class Vec {
3
- _data: Array<Decimal>;
4
- constructor(..._vs: Decimal[]);
5
- copy(normal: Vec): void;
6
- get dim(): number;
7
- check(v: Vec): boolean;
8
- cross(v: Vec): void;
9
- get extentSq(): Decimal;
10
- /**
11
- * 长度
12
- */
13
- get extent(): Decimal;
14
- dot(v: Vec): Decimal;
15
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Vec = void 0;
7
- var decimal_js_1 = __importDefault(require("decimal.js"));
8
- var Vec = /** @class */ (function () {
9
- function Vec() {
10
- var _vs = [];
11
- for (var _i = 0; _i < arguments.length; _i++) {
12
- _vs[_i] = arguments[_i];
13
- }
14
- this._data = [];
15
- for (var i = 0; i < _vs.length; i++) {
16
- this._data[i] = _vs[i];
17
- }
18
- }
19
- Vec.prototype.copy = function (normal) {
20
- for (var i = 0; i < normal.dim; i++)
21
- this._data[i] = new decimal_js_1.default(normal._data[i]);
22
- };
23
- Object.defineProperty(Vec.prototype, "dim", {
24
- get: function () {
25
- return this._data.length;
26
- },
27
- enumerable: false,
28
- configurable: true
29
- });
30
- Vec.prototype.check = function (v) {
31
- return this.dim === v.dim;
32
- };
33
- Vec.prototype.cross = function (v) {
34
- if (!this.check(v))
35
- return;
36
- };
37
- Object.defineProperty(Vec.prototype, "extentSq", {
38
- get: function () {
39
- var res = new decimal_js_1.default(0);
40
- for (var i = 0; i < this._data.length; i++)
41
- res = res.add(this._data[i].mul(this._data[i]));
42
- return res;
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- Object.defineProperty(Vec.prototype, "extent", {
48
- /**
49
- * 长度
50
- */
51
- get: function () {
52
- var res = this.extentSq;
53
- return res.squareRoot();
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- Vec.prototype.dot = function (v) {
59
- if (!this.check(v))
60
- console.error('dim not equal');
61
- var res = new decimal_js_1.default(0);
62
- for (var i = 0; i < this._data.length; i++) {
63
- var ti = this._data[i];
64
- var vi = v._data[i];
65
- res = res.add(ti.mul(vi));
66
- }
67
- return res;
68
- };
69
- return Vec;
70
- }());
71
- exports.Vec = Vec;
@@ -1,2 +0,0 @@
1
- import { Vec3 } from "../math/Vec3";
2
- export declare function Circle(center: Vec3, radius: number, segment: number, startAngle: number, lenAngle: number): void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /*
3
- * @Description :
4
- * @Author : 赵耀圣
5
- * @QQ : 549184003
6
- * @Date : 2021-03-15 09:40:01
7
- * @LastEditTime : 2021-03-15 09:42:14
8
- * @FilePath : \cga.js\src\shape\arc.ts
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.Circle = void 0;
12
- function Circle(center, radius, segment, startAngle, lenAngle) {
13
- }
14
- exports.Circle = Circle;
@@ -1,23 +0,0 @@
1
- import { BufferAttribute } from "../../render/buffer-attribute";
2
- import { Vec3 } from "../../math/Vec3";
3
- export declare class Box {
4
- min: Vec3;
5
- max: Vec3;
6
- _center: Vec3;
7
- constructor(min?: Vec3, max?: Vec3);
8
- get center(): Vec3;
9
- /**
10
- *
11
- * @param {Array<Vec3>} points
12
- */
13
- setFromPoints(points: any): void;
14
- expand(...points: any[]): void;
15
- makeEmpty(): this;
16
- clone(): Box | undefined;
17
- copy(box: Box): Box;
18
- setFromCenterAndSize(center: Vec3, size: Vec3): this;
19
- setFromBufferAttribute(attribute: BufferAttribute): this;
20
- expandByPoint(point: Vec3): this;
21
- isEmpty(): boolean;
22
- getCenter(target: Vec3): Vec3;
23
- }
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Box = void 0;
4
- var Vec3_1 = require("../../math/Vec3");
5
- var _vector = new Vec3_1.Vec3();
6
- var Box = /** @class */ (function () {
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)();
11
- this.min = min;
12
- this.max = max;
13
- // if (points) {
14
- // this.setFromPoints(points);
15
- // }
16
- }
17
- Object.defineProperty(Box.prototype, "center", {
18
- get: function () {
19
- return this._center.add(this.min, this.max).multiplyScalar(0.5);
20
- },
21
- enumerable: false,
22
- configurable: true
23
- });
24
- /**
25
- *
26
- * @param {Array<Vec3>} points
27
- */
28
- Box.prototype.setFromPoints = function (points) {
29
- this.min.set(Infinity, Infinity, Infinity);
30
- this.max.set(-Infinity, -Infinity, -Infinity);
31
- this.expand.apply(this, points);
32
- };
33
- Box.prototype.expand = function () {
34
- var points = [];
35
- for (var _i = 0; _i < arguments.length; _i++) {
36
- points[_i] = arguments[_i];
37
- }
38
- for (var i = 0; i < points.length; i++) {
39
- var point = points[i];
40
- this.min.min(point);
41
- this.max.max(point);
42
- }
43
- this.center.addVecs(this.min, this.max).multiplyScalar(0.5);
44
- };
45
- Box.prototype.makeEmpty = function () {
46
- this.min.x = this.min.y = this.min.z = +Infinity;
47
- this.max.x = this.max.y = this.max.z = -Infinity;
48
- return this;
49
- };
50
- Box.prototype.clone = function () {
51
- return new Box().copy(this);
52
- };
53
- Box.prototype.copy = function (box) {
54
- this.min.copy(box.min);
55
- this.max.copy(box.max);
56
- return this;
57
- };
58
- Box.prototype.setFromCenterAndSize = function (center, size) {
59
- var halfSize = _vector.copy(size).multiplyScalar(0.5);
60
- this.min.copy(center).sub(halfSize);
61
- this.max.copy(center).add(halfSize);
62
- return this;
63
- };
64
- Box.prototype.setFromBufferAttribute = function (attribute) {
65
- var minX = +Infinity;
66
- var minY = +Infinity;
67
- var minZ = +Infinity;
68
- var maxX = -Infinity;
69
- var maxY = -Infinity;
70
- var maxZ = -Infinity;
71
- for (var i = 0, l = attribute.count; i < l; i++) {
72
- var x = attribute.getX(i);
73
- var y = attribute.getY(i);
74
- var z = attribute.getZ(i);
75
- if (x < minX)
76
- minX = x;
77
- if (y < minY)
78
- minY = y;
79
- if (z < minZ)
80
- minZ = z;
81
- if (x > maxX)
82
- maxX = x;
83
- if (y > maxY)
84
- maxY = y;
85
- if (z > maxZ)
86
- maxZ = z;
87
- }
88
- this.min.set(minX, minY, minZ);
89
- this.max.set(maxX, maxY, maxZ);
90
- return this;
91
- };
92
- Box.prototype.expandByPoint = function (point) {
93
- this.min.min(point);
94
- this.max.max(point);
95
- return this;
96
- };
97
- Box.prototype.isEmpty = function () {
98
- return (this.max.x < this.min.x) || (this.max.y < this.min.y) || (this.max.z < this.min.z);
99
- };
100
- Box.prototype.getCenter = function (target) {
101
- if (target === undefined) {
102
- console.warn('THREE.Box3: .getCenter() target is now required');
103
- target = new Vec3_1.Vec3();
104
- }
105
- return this.isEmpty() ? target.set(0, 0, 0) : target.addVecs(this.min, this.max).multiplyScalar(0.5);
106
- };
107
- return Box;
108
- }());
109
- exports.Box = Box;
@@ -1,12 +0,0 @@
1
- import { Vec3 } from "../../math/Vec3";
2
- import { Segment } from "./Segment";
3
- export declare class Capsule extends Segment {
4
- radius: number;
5
- /**
6
- * 胶囊体
7
- * @param {Point|Vec3} p0 点0
8
- * @param {Point|Vec3} p1 点1
9
- * @param {Number} radius 半径
10
- */
11
- constructor(p0: Vec3, p1: Vec3, radius?: number);
12
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
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]; };
7
- return extendStatics(d, b);
8
- };
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
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.Capsule = void 0;
19
- var Segment_1 = require("./Segment");
20
- var Capsule = /** @class */ (function (_super) {
21
- __extends(Capsule, _super);
22
- /**
23
- * 胶囊体
24
- * @param {Point|Vec3} p0 点0
25
- * @param {Point|Vec3} p1 点1
26
- * @param {Number} radius 半径
27
- */
28
- function Capsule(p0, p1, radius) {
29
- if (radius === void 0) { radius = 0; }
30
- var _this = _super.call(this, p0, p1) || this;
31
- _this.radius = radius;
32
- return _this;
33
- }
34
- return Capsule;
35
- }(Segment_1.Segment));
36
- exports.Capsule = Capsule;