@xort/cga 0.0.77 → 0.0.78

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 (261) 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 +18 -11
  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.d.ts +5 -5
  15. package/dist/math/Color.js +16 -10
  16. package/dist/math/Euler.js +12 -10
  17. package/dist/math/HVec3.js +3 -1
  18. package/dist/math/Mat3.js +1 -1
  19. package/dist/math/Mat4.js +6 -6
  20. package/dist/math/Quat.js +4 -2
  21. package/dist/math/Vec.js +3 -1
  22. package/dist/math/Vec2.js +3 -1
  23. package/dist/math/Vec3.js +7 -5
  24. package/dist/math/Vec4.js +3 -1
  25. package/dist/math/vector.js +9 -7
  26. package/dist/render/buffer-attribute.js +12 -28
  27. package/dist/render/eventhandler.d.ts +1 -1
  28. package/dist/render/eventhandler.js +9 -7
  29. package/dist/render/geometry.js +2 -2
  30. package/dist/render/mesh.js +11 -9
  31. package/dist/render/thing.js +10 -8
  32. package/dist/render/types.js +2 -1
  33. package/dist/struct/3d/Box.js +3 -3
  34. package/dist/struct/3d/Capsule.js +3 -1
  35. package/dist/struct/3d/Circle.js +2 -2
  36. package/dist/struct/3d/Disk.js +1 -1
  37. package/dist/struct/3d/Line.js +4 -4
  38. package/dist/struct/3d/Path.js +13 -11
  39. package/dist/struct/3d/Plane.js +12 -10
  40. package/dist/struct/3d/Point.js +3 -1
  41. package/dist/struct/3d/Polygon.js +3 -1
  42. package/dist/struct/3d/Polyline.js +3 -1
  43. package/dist/struct/3d/Rectangle.js +3 -1
  44. package/dist/struct/3d/Segment.js +9 -7
  45. package/dist/struct/3d/Shape.js +3 -1
  46. package/dist/struct/3d/Sphere.js +1 -1
  47. package/dist/struct/3d/Triangle.js +3 -1
  48. package/dist/struct/data/ArrayList.js +11 -9
  49. package/dist/struct/data/ArrayObject.js +3 -1
  50. package/package.json +1 -1
  51. package/src/app.ts +4 -1
  52. package/src/index.ts +1 -0
  53. package/src/math/Color.ts +13 -6
  54. package/dist/src/IKanimation/Bone.d.ts +0 -9
  55. package/dist/src/IKanimation/Bone.js +0 -40
  56. package/dist/src/IKanimation/CCDSolver.d.ts +0 -37
  57. package/dist/src/IKanimation/CCDSolver.js +0 -93
  58. package/dist/src/IKanimation/Joint.d.ts +0 -3
  59. package/dist/src/IKanimation/Joint.js +0 -17
  60. package/dist/src/IKanimation/constaint/constraint.d.ts +0 -10
  61. package/dist/src/IKanimation/constaint/constraint.js +0 -25
  62. package/dist/src/IKanimation/constaint/hinge.d.ts +0 -12
  63. package/dist/src/IKanimation/constaint/hinge.js +0 -46
  64. package/dist/src/IKanimation/constaint/slider.d.ts +0 -12
  65. package/dist/src/IKanimation/constaint/slider.js +0 -44
  66. package/dist/src/IKanimation/index.d.ts +0 -0
  67. package/dist/src/IKanimation/index.js +0 -9
  68. package/dist/src/IKanimation/isolver.d.ts +0 -4
  69. package/dist/src/IKanimation/isolver.js +0 -10
  70. package/dist/src/IKanimation/skeleton.d.ts +0 -13
  71. package/dist/src/IKanimation/skeleton.js +0 -31
  72. package/dist/src/alg/common.d.ts +0 -114
  73. package/dist/src/alg/common.js +0 -302
  74. package/dist/src/alg/curve.d.ts +0 -4
  75. package/dist/src/alg/curve.js +0 -11
  76. package/dist/src/alg/delaunator.d.ts +0 -29
  77. package/dist/src/alg/delaunator.js +0 -442
  78. package/dist/src/alg/delaunay.d.ts +0 -20
  79. package/dist/src/alg/delaunay.js +0 -199
  80. package/dist/src/alg/delaunayslow.d.ts +0 -18
  81. package/dist/src/alg/delaunayslow.js +0 -140
  82. package/dist/src/alg/extrude/extrude.d.ts +0 -3
  83. package/dist/src/alg/extrude/extrude.js +0 -17
  84. package/dist/src/alg/extrude.d.ts +0 -199
  85. package/dist/src/alg/extrude.js +0 -731
  86. package/dist/src/alg/offset/index.d.ts +0 -0
  87. package/dist/src/alg/offset/index.js +0 -9
  88. package/dist/src/alg/offset.d.ts +0 -0
  89. package/dist/src/alg/offset.js +0 -472
  90. package/dist/src/alg/pointset.d.ts +0 -94
  91. package/dist/src/alg/pointset.js +0 -223
  92. package/dist/src/alg/recognition.d.ts +0 -14
  93. package/dist/src/alg/recognition.js +0 -37
  94. package/dist/src/alg/result.d.ts +0 -22
  95. package/dist/src/alg/result.js +0 -2
  96. package/dist/src/alg/segmentset.d.ts +0 -11
  97. package/dist/src/alg/segmentset.js +0 -45
  98. package/dist/src/alg/sort.d.ts +0 -2
  99. package/dist/src/alg/sort.js +0 -14
  100. package/dist/src/alg/split.d.ts +0 -8
  101. package/dist/src/alg/split.js +0 -10
  102. package/dist/src/alg/trianglution.d.ts +0 -20
  103. package/dist/src/alg/trianglution.js +0 -77
  104. package/dist/src/alg/vol.d.ts +0 -6
  105. package/dist/src/alg/vol.js +0 -18
  106. package/dist/src/alg/voronoi.d.ts +0 -31
  107. package/dist/src/alg/voronoi.js +0 -418
  108. package/dist/src/app.d.ts +0 -1
  109. package/dist/src/app.js +0 -245
  110. package/dist/src/basic/distance.d.ts +0 -12
  111. package/dist/src/basic/distance.js +0 -42
  112. package/dist/src/csg/bsp.d.ts +0 -9
  113. package/dist/src/csg/bsp.js +0 -22
  114. package/dist/src/csg/node.d.ts +0 -12
  115. package/dist/src/csg/node.js +0 -75
  116. package/dist/src/csg/polygon.d.ts +0 -43
  117. package/dist/src/csg/polygon.js +0 -161
  118. package/dist/src/diamondMaterialShader.d.ts +0 -92
  119. package/dist/src/diamondMaterialShader.js +0 -118
  120. package/dist/src/effect/breath-light.d.ts +0 -4
  121. package/dist/src/effect/breath-light.js +0 -39
  122. package/dist/src/extends/geometryaid.d.ts +0 -28
  123. package/dist/src/extends/geometryaid.js +0 -80
  124. package/dist/src/extends/split.d.ts +0 -3
  125. package/dist/src/extends/split.js +0 -13
  126. package/dist/src/glview.d.ts +0 -112
  127. package/dist/src/glview.js +0 -564
  128. package/dist/src/index.d.ts +0 -36
  129. package/dist/src/index.js +0 -54
  130. package/dist/src/math/Euler.d.ts +0 -47
  131. package/dist/src/math/Euler.js +0 -245
  132. package/dist/src/math/HVec3.d.ts +0 -44
  133. package/dist/src/math/HVec3.js +0 -195
  134. package/dist/src/math/Mat3.d.ts +0 -29
  135. package/dist/src/math/Mat3.js +0 -244
  136. package/dist/src/math/Mat4.d.ts +0 -85
  137. package/dist/src/math/Mat4.js +0 -791
  138. package/dist/src/math/Math.d.ts +0 -130
  139. package/dist/src/math/Math.js +0 -198
  140. package/dist/src/math/Quat.d.ts +0 -83
  141. package/dist/src/math/Quat.js +0 -440
  142. package/dist/src/math/Vec.d.ts +0 -7
  143. package/dist/src/math/Vec.js +0 -43
  144. package/dist/src/math/Vec2.d.ts +0 -68
  145. package/dist/src/math/Vec2.js +0 -347
  146. package/dist/src/math/Vec3.d.ts +0 -232
  147. package/dist/src/math/Vec3.js +0 -1089
  148. package/dist/src/math/Vec4.d.ts +0 -81
  149. package/dist/src/math/Vec4.js +0 -494
  150. package/dist/src/math/vector.d.ts +0 -114
  151. package/dist/src/math/vector.js +0 -373
  152. package/dist/src/render/buffer-attribute.d.ts +0 -100
  153. package/dist/src/render/buffer-attribute.js +0 -340
  154. package/dist/src/render/eventhandler.d.ts +0 -78
  155. package/dist/src/render/eventhandler.js +0 -189
  156. package/dist/src/render/geometry.d.ts +0 -89
  157. package/dist/src/render/geometry.js +0 -775
  158. package/dist/src/render/mesh.d.ts +0 -25
  159. package/dist/src/render/mesh.js +0 -82
  160. package/dist/src/render/thing.d.ts +0 -34
  161. package/dist/src/render/thing.js +0 -196
  162. package/dist/src/render/types.d.ts +0 -2
  163. package/dist/src/render/types.js +0 -8
  164. package/dist/src/robust/plane.d.ts +0 -7
  165. package/dist/src/robust/plane.js +0 -17
  166. package/dist/src/robust/vec.d.ts +0 -15
  167. package/dist/src/robust/vec.js +0 -71
  168. package/dist/src/shape/arc.d.ts +0 -2
  169. package/dist/src/shape/arc.js +0 -14
  170. package/dist/src/struct/3d/Box.d.ts +0 -23
  171. package/dist/src/struct/3d/Box.js +0 -109
  172. package/dist/src/struct/3d/Capsule.d.ts +0 -12
  173. package/dist/src/struct/3d/Capsule.js +0 -36
  174. package/dist/src/struct/3d/Circle.d.ts +0 -34
  175. package/dist/src/struct/3d/Circle.js +0 -80
  176. package/dist/src/struct/3d/Disk.d.ts +0 -10
  177. package/dist/src/struct/3d/Disk.js +0 -22
  178. package/dist/src/struct/3d/Frustum.d.ts +0 -35
  179. package/dist/src/struct/3d/Frustum.js +0 -159
  180. package/dist/src/struct/3d/Line.d.ts +0 -40
  181. package/dist/src/struct/3d/Line.js +0 -339
  182. package/dist/src/struct/3d/Path.d.ts +0 -75
  183. package/dist/src/struct/3d/Path.js +0 -308
  184. package/dist/src/struct/3d/Plane.d.ts +0 -74
  185. package/dist/src/struct/3d/Plane.js +0 -295
  186. package/dist/src/struct/3d/Point.d.ts +0 -4
  187. package/dist/src/struct/3d/Point.js +0 -30
  188. package/dist/src/struct/3d/Polygon.d.ts +0 -8
  189. package/dist/src/struct/3d/Polygon.js +0 -55
  190. package/dist/src/struct/3d/Polyline.d.ts +0 -25
  191. package/dist/src/struct/3d/Polyline.js +0 -109
  192. package/dist/src/struct/3d/Ray.d.ts +0 -21
  193. package/dist/src/struct/3d/Ray.js +0 -262
  194. package/dist/src/struct/3d/Rectangle.d.ts +0 -7
  195. package/dist/src/struct/3d/Rectangle.js +0 -35
  196. package/dist/src/struct/3d/Segment.d.ts +0 -32
  197. package/dist/src/struct/3d/Segment.js +0 -334
  198. package/dist/src/struct/3d/Shape.d.ts +0 -4
  199. package/dist/src/struct/3d/Shape.js +0 -27
  200. package/dist/src/struct/3d/Sphere.d.ts +0 -11
  201. package/dist/src/struct/3d/Sphere.js +0 -30
  202. package/dist/src/struct/3d/Triangle.d.ts +0 -8
  203. package/dist/src/struct/3d/Triangle.js +0 -53
  204. package/dist/src/struct/data/ArrayList.d.ts +0 -42
  205. package/dist/src/struct/data/ArrayList.js +0 -172
  206. package/dist/src/struct/data/ArrayObject.d.ts +0 -30
  207. package/dist/src/struct/data/ArrayObject.js +0 -131
  208. package/dist/src/struct/data/type.d.ts +0 -13
  209. package/dist/src/struct/data/type.js +0 -18
  210. package/dist/src/utils/array.d.ts +0 -24
  211. package/dist/src/utils/array.js +0 -89
  212. package/dist/src/utils/types.d.ts +0 -24
  213. package/dist/src/utils/types.js +0 -20
  214. package/dist/src-gis/app.d.ts +0 -1
  215. package/dist/src-gis/app.js +0 -4
  216. package/dist/src-gis/core/Cartographic.d.ts +0 -20
  217. package/dist/src-gis/core/Cartographic.js +0 -52
  218. package/dist/src-gis/core/EllipsoidGeodesic.d.ts +0 -14
  219. package/dist/src-gis/core/EllipsoidGeodesic.js +0 -51
  220. package/dist/src-gis/core/EllipsoidTerrainProvider.d.ts +0 -10
  221. package/dist/src-gis/core/EllipsoidTerrainProvider.js +0 -29
  222. package/dist/src-gis/core/HeightmapTerrainData.d.ts +0 -3
  223. package/dist/src-gis/core/HeightmapTerrainData.js +0 -9
  224. package/dist/src-gis/core/Rectangle.d.ts +0 -45
  225. package/dist/src-gis/core/Rectangle.js +0 -127
  226. package/dist/src-gis/core/TaskProcessor.d.ts +0 -35
  227. package/dist/src-gis/core/TaskProcessor.js +0 -183
  228. package/dist/src-gis/gis.d.ts +0 -5
  229. package/dist/src-gis/gis.js +0 -12
  230. package/dist/src-gis/globe.d.ts +0 -12
  231. package/dist/src-gis/globe.js +0 -61
  232. package/dist/src-gis/math/Cartographic.d.ts +0 -8
  233. package/dist/src-gis/math/Cartographic.js +0 -26
  234. package/dist/src-gis/math/GVec3.d.ts +0 -12
  235. package/dist/src-gis/math/GVec3.js +0 -69
  236. package/dist/src-gis/math/ellipsoid.d.ts +0 -8
  237. package/dist/src-gis/math/ellipsoid.js +0 -14
  238. package/dist/src-gis/provider/DcTerrainProvider.d.ts +0 -15
  239. package/dist/src-gis/provider/DcTerrainProvider.js +0 -19
  240. package/dist/src-gis/provider/TerrainProvider.d.ts +0 -3
  241. package/dist/src-gis/provider/TerrainProvider.js +0 -17
  242. package/dist/src-gis/scene/DcImageryProvider.d.ts +0 -6
  243. package/dist/src-gis/scene/DcImageryProvider.js +0 -35
  244. package/dist/src-gis/scene/GeographicTilingScheme.d.ts +0 -21
  245. package/dist/src-gis/scene/GeographicTilingScheme.js +0 -46
  246. package/dist/src-gis/scene/Globe.d.ts +0 -34
  247. package/dist/src-gis/scene/Globe.js +0 -62
  248. package/dist/src-gis/scene/GlobeSurfaceShaderSet.d.ts +0 -6
  249. package/dist/src-gis/scene/GlobeSurfaceShaderSet.js +0 -11
  250. package/dist/src-gis/scene/GlobeSurfaceTileProvider.d.ts +0 -21
  251. package/dist/src-gis/scene/GlobeSurfaceTileProvider.js +0 -15
  252. package/dist/src-gis/scene/ImageryLayerCollection.d.ts +0 -21
  253. package/dist/src-gis/scene/ImageryLayerCollection.js +0 -87
  254. package/dist/src-gis/scene/ImageryProvider.d.ts +0 -4
  255. package/dist/src-gis/scene/ImageryProvider.js +0 -28
  256. package/dist/src-gis/scene/QuadtreeTile.d.ts +0 -48
  257. package/dist/src-gis/scene/QuadtreeTile.js +0 -137
  258. package/dist/src-gis/scene/UrlTemplateImageryProvider.d.ts +0 -9
  259. package/dist/src-gis/scene/UrlTemplateImageryProvider.js +0 -29
  260. package/dist/src-gis/scene/quadtree_primitive.d.ts +0 -14
  261. 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;