@xort/cga 0.1.0 → 0.1.2

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 (39) hide show
  1. package/THIRD_PARTY_NOTICES.md +26 -39
  2. package/build/@xort_cga.js +10096 -9226
  3. package/build/cga.d.ts +1286 -465
  4. package/build/cga.esm.js +10062 -9228
  5. package/build/shaders/cga.glsl +204 -0
  6. package/build/shaders/common.glsl +36 -0
  7. package/build/shaders/noise/GLSL-Noise.md +1108 -0
  8. package/build/shaders/noise/LICENSE +20 -0
  9. package/build/shaders/noise/cellular2D.glsl +69 -0
  10. package/build/shaders/noise/cellular2x2.glsl +64 -0
  11. package/build/shaders/noise/cellular2x2x2.glsl +88 -0
  12. package/build/shaders/noise/cellular3D.glsl +187 -0
  13. package/build/shaders/noise/classicnoise2D.glsl +113 -0
  14. package/build/shaders/noise/classicnoise3D.glsl +177 -0
  15. package/build/shaders/noise/classicnoise4D.glsl +302 -0
  16. package/build/shaders/noise/noise2D.glsl +71 -0
  17. package/build/shaders/noise/noise3D.glsl +103 -0
  18. package/build/shaders/noise/noise3Dgrad.glsl +111 -0
  19. package/build/shaders/noise/noise4D.glsl +129 -0
  20. package/build/shaders/noise/psrdnoise2D.glsl +463 -0
  21. package/dist/THIRD_PARTY_NOTICES.md +26 -39
  22. package/dist/index.cjs +10096 -9226
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +1286 -465
  25. package/dist/index.d.ts +1286 -465
  26. package/dist/index.js +10062 -9228
  27. package/dist/index.js.map +1 -1
  28. package/dist/shaders.cjs +21 -0
  29. package/dist/shaders.d.cts +20 -0
  30. package/dist/shaders.d.ts +20 -0
  31. package/dist/shaders.js +20 -0
  32. package/dist/three.cjs +3035 -0
  33. package/dist/three.cjs.map +1 -0
  34. package/dist/three.d.cts +311 -0
  35. package/dist/three.d.ts +311 -0
  36. package/dist/three.js +3008 -0
  37. package/dist/three.js.map +1 -0
  38. package/package.json +123 -83
  39. package/readme.md +74 -119
package/build/cga.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import Decimal from 'decimal.js';
2
+
1
3
  declare class Quat {
2
4
  _x: number;
3
5
  _y: number;
@@ -82,6 +84,9 @@ declare function quat(x?: number, y?: number, z?: number, w?: number): Quat;
82
84
 
83
85
  type DistanceParameter = number | number[];
84
86
  interface DistanceResult {
87
+ /** Absolute bound on numerical distance error for iterative curved queries. */
88
+ errorBound?: number;
89
+ iterations?: number;
85
90
  rayParameter?: number;
86
91
  lineParameter?: number;
87
92
  closests: [Vec3, Vec3];
@@ -110,9 +115,10 @@ interface GeometryQuery<T> {
110
115
  copy(source: T): this;
111
116
  clone(): T;
112
117
  distancePoint(point: Vec3): DistanceResult;
118
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
113
119
  toJSON(): GeometryData;
114
120
  }
115
- type GeometryKind = 'Point' | 'Line' | 'Ray' | 'Segment' | 'Triangle' | 'Plane' | 'Rectangle' | 'Circle' | 'Disk' | 'Sphere' | 'Capsule' | 'Box' | 'Polyline' | 'Polygon';
121
+ type GeometryKind = 'Point' | 'Line' | 'Ray' | 'Segment' | 'Triangle' | 'Plane' | 'Rectangle' | 'Circle' | 'Disk' | 'Sphere' | 'Capsule' | 'Box' | 'Polyline' | 'Polygon' | 'Shape';
116
122
  interface GeometryData {
117
123
  kind: GeometryKind;
118
124
  vertices: number[][];
@@ -122,31 +128,102 @@ interface GeometryData {
122
128
  startAngle?: number;
123
129
  lengthAngle?: number;
124
130
  empty?: boolean;
131
+ holes?: number[][][];
125
132
  }
126
133
 
127
- type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
128
- type TypedArrayLike = number[] | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
129
-
130
- declare enum IntersectType {
131
- None = 0,
132
- Parallel = 1,
133
- Perpendicular = 2,
134
- Collineation = 3
135
- }
136
- declare enum Orientation {
137
- None = -1,
138
- Positive = 1,
139
- Negative = 2,
140
- Common = 3,//共面
141
- Intersect = 3
134
+ declare class Circle implements GeometryQuery<Circle> {
135
+ center: Vec3;
136
+ radius: number;
137
+ normal: Vec3;
138
+ queryCurved(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
139
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
140
+ basis(): [Vec3, Vec3];
141
+ pointAt(angle: number): Vec3;
142
+ containsAngle(angle: number): boolean;
143
+ closestPoint(point: Vec3): Vec3;
144
+ startAngle: number;
145
+ lengthAngle: number;
146
+ radiusSqr: number;
147
+ /**
148
+ * 圆圈
149
+ * @param {Vec3} center 中心点
150
+ * @param {Vec3} normal 法线
151
+ * @param {Number} radius 半径
152
+ */
153
+ constructor(center?: Vec3, radius?: number, startAngle?: number, lengthAngle?: number, normal?: Vec3);
154
+ area(): number;
155
+ /**
156
+ * 两个点
157
+ * @param fixp0
158
+ * @param fixp1
159
+ * @param movep
160
+ * @param normal
161
+ */
162
+ arc1(fixp0: Vec3, fixp1: Vec3, movep: Vec3, normal?: Vec3): this;
163
+ /**
164
+ * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
165
+ * @param fixp0
166
+ * @param fixp1
167
+ * @param movep
168
+ */
169
+ arc2(center: Vec3, fixp1: Vec3, movep: Vec3, ccw?: boolean, normal?: Vec3): this;
170
+ setFrom3Points(p0: Vec3, p1: Vec3, p2: Vec3, normal?: Vec3): this;
171
+ /**
172
+ * 将圆环或者圆弧转化为路径点,生成XY平面上得三维点
173
+ * @param center 中心点
174
+ * @param radius 半径
175
+ * @param startAngle 起始角 右手坐标系 以X正坐标轴为起点 单位弧度
176
+ * @param lengthAngle 弧度长度 单位弧度
177
+ * @param segment 分段
178
+ */
179
+ static toVecs(center: Vec3, radius: number, startAngle?: number, lengthAngle?: number, up?: Vec3, segment?: number): Vec3[];
180
+ /**
181
+ * 在p点延伸a,b两个方向,生成半径为r的圆弧,圆弧所在位置在a,b向量的内夹角
182
+ * @param p 位置
183
+ * @param a a方向
184
+ * @param b b方向
185
+ * @param r 圆弧半径
186
+ */
187
+ static PAdBdtoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
188
+ static PApBptoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
189
+ set(center: Vec3, radius: number, normal?: Vec3): this;
190
+ copy(source: Circle): this;
191
+ clone(): Circle;
192
+ distancePoint(point: Vec3): DistanceResult;
193
+ readonly kind: GeometryKind;
194
+ toJSON(): GeometryData;
142
195
  }
196
+ declare function circle(center?: Vec3, radius?: number): Circle;
143
197
 
144
- interface ISplitResult {
145
- negative: Vec3[];
146
- positive: Vec3[];
147
- common: Vec3[];
148
- orientation: Orientation;
198
+ declare class Disk implements GeometryQuery<Disk> {
199
+ queryCurved(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
200
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
201
+ center: Vec3;
202
+ normal: Vec3;
203
+ radius: number;
204
+ w: number;
205
+ constructor(center: Vec3, radius: number, normal?: Vec3);
206
+ area(): number;
207
+ set(center: Vec3, radius: number, normal?: Vec3): this;
208
+ copy(source: Disk): this;
209
+ clone(): Disk;
210
+ distancePoint(point: Vec3): DistanceResult;
211
+ readonly kind: GeometryKind;
212
+ toJSON(): GeometryData;
149
213
  }
214
+ declare function disk(center: Vec3, radius: number, normal: Vec3): Disk;
215
+
216
+ type Geometry = GeometryQuery<any>;
217
+ interface CurvedQueryOptions {
218
+ tolerance?: number;
219
+ maximumIterations?: number;
220
+ }
221
+ /** Certified adaptive arc/chord bounds. errorBound is an absolute distance bound. */
222
+ declare function circleDistance(circle: Circle, other: Geometry, options?: CurvedQueryOptions): DistanceResult;
223
+ declare function diskDistance(disk: Disk, other: Geometry, options?: CurvedQueryOptions): DistanceResult;
224
+
225
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
226
+ type TypedArrayLike = number[] | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
150
227
 
151
228
  declare class Mat3 {
152
229
  elements: number[];
@@ -325,6 +402,22 @@ declare class Vec4 {
325
402
  }
326
403
  declare function v4(x?: number, y?: number, z?: number, w?: number): Vec4;
327
404
 
405
+ declare enum JoinType {
406
+ Square = 0,
407
+ Round = 1,
408
+ Miter = 2,
409
+ Bevel = 0
410
+ }
411
+ declare enum EndType {
412
+ Square = 0,
413
+ Round = 1,
414
+ Butt = 2,
415
+ etClosedLine = 3,
416
+ etClosedPolygon = 4,
417
+ etOpenButt = 5,
418
+ etOpenSquare = 6
419
+ }
420
+
328
421
  declare class ArrayList<T> {
329
422
  protected _array: Array<T>;
330
423
  isArrayList: boolean;
@@ -368,221 +461,12 @@ declare class ArrayList<T> {
368
461
  unique(uniqueMethod: (arg0: T, arg1: T) => boolean, sortMethod?: (a: T, b: T) => number): this;
369
462
  }
370
463
 
371
- type AxisPlane = 'xy' | 'xz' | 'yz' | 'xyz';
372
- interface ITriangulationOption {
373
- feature?: AxisPlane;
374
- dim?: number;
375
- normal?: Vec3;
376
- }
377
- /**
378
- * 三角剖分 earcut.js
379
- * @param {Array} boundary 边界
380
- * @param {Array<Array>} holes 洞的数组
381
- * @param {options:{feature,dim,normal}} feature 选择平平面
382
- * @returns {Array<Number>} 三角形索引数组
383
- */
384
- declare function triangulation(boundary: Vec3[], holes?: Vec3[][], options?: ITriangulationOption): number[];
385
-
386
- interface ILinkSideOption {
387
- side0: {
388
- x: number;
389
- y: number;
390
- z: number;
391
- index?: number;
392
- }[] | number[];
393
- side1: {
394
- x: number;
395
- y: number;
396
- z: number;
397
- index?: number;
398
- }[] | number[];
399
- holes0?: Array<Array<Vec3>>;
400
- holes1?: Array<Array<Vec3>>;
401
- shapeClosed?: boolean;
402
- autoUV?: boolean;
403
- uvScalars?: number[];
404
- segs?: [];
405
- }
406
- /**
407
- * 常用shape几何操作
408
- */
409
- /**
410
- * @description : 缝合两个边 不提供uv生成 uv有@linkSides 生成
411
- * @param { ILinkSideOption } options
412
- * @returns { Array<Vec3>} 三角形数组,每三个为一个三角形
413
- * @example :
414
- */
415
- declare function linkSide(options: ILinkSideOption): number[];
416
- /**
417
- * 缝合shape集合
418
- * @param {Array<Array<Point|Vec3>} shapes 路基 点集的集合, 每个shape的点数量一致
419
- * @param {Boolean} sealStart 每一个shape是否是封闭的界面 默认false
420
- * @param {Boolean} isClosed 每一个shape是否是封闭的界面 默认false
421
- * @param {Boolean} isClosed2 每一个shape是否是封闭的首尾 默认false
422
- * @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
423
- */
424
- interface ILinkSideOptions {
425
- shapes: Array<Array<IVec3 | any | IVec3>>;
426
- orgShape?: Array<IVec3 | any | IVec3>;
427
- orgHoles?: any;
428
- sealStart?: boolean;
429
- sealEnd?: boolean;
430
- shapeClosed?: boolean;
431
- pathClosed?: boolean;
432
- index?: {
433
- index: number;
434
- };
435
- autoIndex?: boolean;
436
- generateUV?: boolean;
437
- axisPlane?: AxisPlane;
438
- holes?: Array<Array<IVec3 | any | IVec3>>[];
439
- }
440
- /**
441
- * @description : 链接多个shape 生成几何体
442
- * @param {ILinkSideOptions} optionsILinkSideOptions {
443
- * shapes: Array<Array<IVec3 | number | any>>;
444
- * sealStart?: boolean,//开始封面
445
- * sealEnd?: boolean;//结束封面
446
- * shapeClosed?: boolean,//shape是否闭合
447
- * pathClosed?: boolean,//路径是否闭合
448
- * index?: { index: number },
449
- * generateUV?: boolean
450
- * }
451
- *
452
- * @return {*}
453
- * @example :
454
- *
455
- */
456
- declare function linkSides(options: ILinkSideOptions): IGeometry;
457
- interface IExtrudeOptions {
458
- fixedY?: boolean;
459
- shapeClosed?: boolean;
460
- isClosed2?: boolean;
461
- textureEnable?: boolean;
462
- textureScale?: Vec2;
463
- smoothAngle?: number;
464
- sealStart?: boolean;
465
- sealEnd?: boolean;
466
- normal?: Vec3;
467
- }
468
- interface IExtrudeOptionsEx {
469
- shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;
470
- path: Array<Vec3 | IVec3>;
471
- ups?: Array<Vec3 | IVec3>;
472
- up?: Vec3 | IVec3;
473
- right?: Vec3;
474
- shapeClosed?: boolean;
475
- pathClosed?: boolean;
476
- textureEnable?: boolean;
477
- smoothAngle?: number;
478
- enableSmooth?: boolean;
479
- sealStart?: boolean;
480
- sealEnd?: boolean;
481
- normal?: Vec3;
482
- autoIndex?: boolean;
483
- axisPlane?: AxisPlane;
484
- generateUV?: boolean;
485
- index?: {
486
- index: number;
487
- };
488
- holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
489
- }
490
- /**
491
- * @description : 挤压形状生成几何体
492
- * @param {IExtrudeOptionsEx} options
493
- * IExtrudeOptionsEx {
494
- * shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;//shape默认的矩阵为正交矩阵
495
- * path: Array<Vec3 | IVec3>;//挤压路径
496
- * ups?: Array<Vec3 | IVec3>;
497
- * up?: Vec3 | IVec3;
498
- * shapeClosed?: boolean;//闭合为多边形 界面
499
- * pathClosed?: boolean;//首尾闭合为圈
500
- * textureEnable?: boolean;
501
- * smoothAngle?: number;
502
- * sealStart?: boolean;
503
- * sealEnd?: boolean;
504
- * normal?: Vec3,//面的法线
505
- * autoIndex?: boolean,
506
- * index?: { index: number }
507
- * holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[]
508
- *}
509
- * @return {IGeometry}
510
- * @example :
511
- *
512
- */
513
- declare function extrude(options: IExtrudeOptionsEx): IGeometry;
514
- /**
515
- * 挤压
516
- * @param {Polygon|Array<Point|Vec3> } shape 多边形或顶点数组
517
- * @param {Path|Array<Point|Vec3> } path 路径或者或顶点数组
518
- * @param {Object} options {
519
- * isClosed: false,闭合为多边形 界面
520
- * isClosed2: false, 闭合为圈
521
- * textureEnable: true, 计算纹理坐标
522
- * textureScale: new Vec2(1, 1),纹理坐标缩放
523
- * smoothAngle: Math.PI / 180 * 30,大于这个角度则不平滑
524
- * sealStart: true, 是否密封开始面
525
- * sealEnd: true,是否密封结束面}
526
- */
527
- declare function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, arg_path: Array<Vec3> | any, options?: IExtrudeOptions): {
528
- vertices: any[];
529
- index: number[] | undefined;
530
- uvs: any[];
531
- };
532
- declare enum JoinType {
533
- Square = 0,
534
- Round = 1,
535
- Miter = 2,
536
- Bevel = 0
537
- }
538
- declare enum EndType {
539
- Square = 0,
540
- Round = 1,
541
- Butt = 2,
542
- etClosedLine = 3,
543
- etClosedPolygon = 4,
544
- etOpenButt = 5,
545
- etOpenSquare = 6
546
- }
547
- interface IExtrudeOptionsNext {
548
- shape: Array<Vec3>;
549
- path: Array<Vec3 | IVec3>;
550
- up?: Array<Vec3 | IVec3> | Vec3 | IVec3;
551
- right?: Array<Vec3> | Vec3;
552
- shapeClosed?: boolean;
553
- pathClosed?: boolean;
554
- textureEnable?: boolean;
555
- shapeCenter?: Vec3;
556
- smoothAngle?: number;
557
- enableSmooth?: boolean;
558
- sealStart?: boolean;
559
- sealEnd?: boolean;
560
- normal?: Vec3;
561
- autoIndex?: boolean;
562
- axisPlane?: AxisPlane;
563
- generateUV?: boolean;
564
- index?: {
565
- index: number;
566
- };
567
- holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
568
- jtType?: JoinType;
569
- etType?: EndType;
570
- bevelSize?: any;
571
- }
572
- /**
573
- * 将路径看做挤压操作中心
574
- *
575
- * @param shape
576
- * @param followPath
577
- * @param options
578
- */
579
- declare function extrudeNext(options: IExtrudeOptionsNext): IGeometry;
580
-
581
- declare class Polygon<T> extends Polyline<T> {
464
+ declare class Polygon$1<T> extends Polyline<T> {
465
+ queryCompound(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
582
466
  readonly kind: GeometryKind;
583
467
  isPolygon: boolean;
584
468
  constructor(vs?: any[], normal?: Vec3);
585
- offset(distance: number, normal?: Vec3): Polygon<T>;
469
+ offset(distance: number, normal?: Vec3): Polygon$1<T>;
586
470
  containPoint(point: Vec3, tolerance?: number): boolean;
587
471
  containsPoint(point: Vec3, tolerance?: number): boolean;
588
472
  distancePoint(point: Vec3): DistanceResult;
@@ -598,11 +482,13 @@ declare enum ClipType {
598
482
  * 线段正反原则:右手坐标系中,所在平面为XZ平面,把指向方向看着负Z轴,x正为正方向,x负为负方向
599
483
  */
600
484
  declare class Polyline<T> extends ArrayList<T> implements GeometryQuery<Polyline<T>> {
485
+ queryCompound(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
486
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
601
487
  readonly kind: GeometryKind;
602
488
  isCoPlanar: boolean;
603
489
  isPolyline: boolean;
604
490
  normal: Vec3;
605
- constructor(vs?: Array<T> | Polyline<T> | Polygon<T>, normal?: Vec3);
491
+ constructor(vs?: Array<T> | Polyline<T> | Polygon$1<T>, normal?: Vec3);
606
492
  static CleanPolygon(points: Vec3[], delta?: number): Vec3[];
607
493
  static OffsetPaths(paths: Vec3[][], delta: number, jointype?: JoinType, endtype?: EndType, limit?: number): Vec3[][];
608
494
  static SimplifyPolygon(points: Vec3[]): Vec3[][];
@@ -627,6 +513,7 @@ declare class Polyline<T> extends ArrayList<T> implements GeometryQuery<Polyline
627
513
 
628
514
  /** A fixed-size geometry owns its vertices; array operations cannot change its arity. */
629
515
  declare abstract class FixedVertices implements Iterable<Vec3> {
516
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
630
517
  readonly [index: number]: Vec3;
631
518
  protected readonly vertices: Vec3[];
632
519
  protected constructor(points: readonly Vec3[]);
@@ -646,7 +533,7 @@ declare class Triangle extends FixedVertices implements GeometryQuery<Triangle>
646
533
  distanceTriangle(triangle: Triangle): DistanceResult;
647
534
  distancePoint(point: Vec3): DistanceResult;
648
535
  distanceSegment(segment: Segment): DistanceResult;
649
- distancePlane(plane: Plane): DistanceResult;
536
+ distancePlane(plane: Plane$1): DistanceResult;
650
537
  set(a: Vec3, b: Vec3, c: Vec3): this;
651
538
  copy(source: Triangle): this;
652
539
  clone(): Triangle;
@@ -655,7 +542,7 @@ declare class Triangle extends FixedVertices implements GeometryQuery<Triangle>
655
542
  readonly kind: GeometryKind;
656
543
  distanceSphere(sphere: Sphere): DistanceResult;
657
544
  distanceCapsule(capsule: Capsule): DistanceResult;
658
- distanceRectangle(rectangle: Rectangle): DistanceResult;
545
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
659
546
  toJSON(): GeometryData;
660
547
  }
661
548
 
@@ -683,11 +570,10 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
683
570
  * @param {Segment} segment
684
571
  */
685
572
  distanceSegment(segment: Segment): DistanceResult;
686
- distancePlane(plane: Plane): DistanceResult;
573
+ distancePlane(plane: Plane$1): DistanceResult;
687
574
  intersectSegment(segment: Segment, tolerance?: number): {
688
- colinear: boolean;
689
- intersected: boolean;
690
- points: Vec3[];
575
+ errorBound?: number;
576
+ iterations?: number;
691
577
  rayParameter?: number;
692
578
  lineParameter?: number;
693
579
  closests: [Vec3, Vec3];
@@ -702,44 +588,48 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
702
588
  signedDistance?: number;
703
589
  segmentIndex?: number;
704
590
  diskClosest?: Vec3;
591
+ colinear: boolean;
592
+ intersected: boolean;
593
+ points: Vec3[];
705
594
  };
706
595
  distancePoint(point: Vec3): DistanceResult;
707
596
  distanceLine(line: Line): DistanceResult;
708
597
  distanceRay(ray: Ray): DistanceResult;
709
598
  distanceTriangle(triangle: Triangle): DistanceResult;
710
- intersectPlane(plane: Plane): Vec3 | Vec3[] | null;
599
+ intersectPlane(plane: Plane$1): Vec3 | Vec3[] | null;
711
600
  distanceSphere(sphere: Sphere): DistanceResult;
712
601
  distanceCapsule(capsule: Capsule): DistanceResult;
713
602
  copy(source: Segment): this;
714
603
  clone(): Segment;
715
604
  readonly kind: GeometryKind;
716
605
  distanceBox(box: Box): DistanceResult;
717
- distanceRectangle(rectangle: Rectangle): DistanceResult;
606
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
718
607
  toJSON(): GeometryData;
719
608
  }
720
609
  declare function segment(p0: Vec3, p1: Vec3): Segment;
721
610
 
722
- declare class Rectangle extends FixedVertices implements GeometryQuery<Rectangle> {
611
+ declare class Rectangle$1 extends FixedVertices implements GeometryQuery<Rectangle$1> {
723
612
  constructor(a: Vec3, b: Vec3, c: Vec3, d?: Vec3);
724
613
  set(a: Vec3, b: Vec3, c: Vec3, d?: Vec3): this;
725
614
  get center(): Vec3;
726
615
  get axis(): Vec3[];
727
616
  get extent(): number[];
728
- copy(source: Rectangle): this;
729
- clone(): Rectangle;
617
+ copy(source: Rectangle$1): this;
618
+ clone(): Rectangle$1;
730
619
  distancePoint(point: Vec3): DistanceResult;
731
620
  private query;
732
621
  distanceLine(line: Line): DistanceResult;
733
622
  distanceRay(ray: Ray): DistanceResult;
734
623
  distanceSegment(segment: Segment): DistanceResult;
735
624
  distanceTriangle(triangle: Triangle): DistanceResult;
736
- distancePlane(plane: Plane): DistanceResult;
737
- distanceRectangle(rectangle: Rectangle): DistanceResult;
625
+ distancePlane(plane: Plane$1): DistanceResult;
626
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
738
627
  readonly kind: GeometryKind;
739
628
  toJSON(): GeometryData;
740
629
  }
741
630
 
742
631
  declare class Ray implements GeometryQuery<Ray> {
632
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
743
633
  origin: Vec3;
744
634
  direction: Vec3;
745
635
  constructor(origin: Vec3, direction: Vec3);
@@ -758,8 +648,8 @@ declare class Ray implements GeometryQuery<Ray> {
758
648
  distancePloyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
759
649
  distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
760
650
  distancePoint(point: Vec3): DistanceResult;
761
- intersectPlane(plane: Plane, result?: Vec3): Vec3 | undefined;
762
- distancePlane(plane: Plane): DistanceResult;
651
+ intersectPlane(plane: Plane$1, result?: Vec3): Vec3 | undefined;
652
+ distancePlane(plane: Plane$1): DistanceResult;
763
653
  distanceSphere(sphere: Sphere): DistanceResult;
764
654
  distanceCapsule(capsule: Capsule): DistanceResult;
765
655
  set(origin: Vec3, direction: Vec3): this;
@@ -768,11 +658,12 @@ declare class Ray implements GeometryQuery<Ray> {
768
658
  distanceLine(line: Line): DistanceResult;
769
659
  readonly kind: GeometryKind;
770
660
  distanceBox(box: Box): DistanceResult;
771
- distanceRectangle(rectangle: Rectangle): DistanceResult;
661
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
772
662
  toJSON(): GeometryData;
773
663
  }
774
664
 
775
665
  declare class Sphere implements GeometryQuery<Sphere> {
666
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
776
667
  applyMat4(mat: Mat4): this;
777
668
  center: Vec3;
778
669
  radius: number;
@@ -785,14 +676,14 @@ declare class Sphere implements GeometryQuery<Sphere> {
785
676
  distanceLine(line: Line): DistanceResult;
786
677
  distanceRay(ray: Ray): DistanceResult;
787
678
  distanceSegment(segment: Segment): DistanceResult;
788
- distancePlane(plane: Plane): DistanceResult;
679
+ distancePlane(plane: Plane$1): DistanceResult;
789
680
  distanceTriangle(triangle: Triangle): DistanceResult;
790
681
  distanceSphere(sphere: Sphere): DistanceResult;
791
682
  distanceCapsule(capsule: Capsule): DistanceResult;
792
683
  containsPoint(point: Vec3): boolean;
793
684
  readonly kind: GeometryKind;
794
685
  distanceBox(box: Box): DistanceResult;
795
- distanceRectangle(rectangle: Rectangle): DistanceResult;
686
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
796
687
  toJSON(): GeometryData;
797
688
  }
798
689
 
@@ -918,6 +809,7 @@ interface IBufferGeometry {
918
809
  * BufferType 几何体,用于独立计算几何体
919
810
  */
920
811
  declare class BufferGeometry {
812
+ userData: Record<string, unknown>;
921
813
  name: string;
922
814
  boundingBox: Box | undefined;
923
815
  boundingSphere: Sphere | undefined;
@@ -973,24 +865,50 @@ declare class BufferGeometry {
973
865
  toFlat(): BufferGeometry;
974
866
  toNonIndexed(): BufferGeometry;
975
867
  toJSON(): any;
976
- userData(userData: any): void;
977
868
  clone(): BufferGeometry;
978
869
  copy(source: BufferGeometry): this;
979
870
  }
980
871
 
981
- /** Plane equation: normal.dot(point) + w = 0. */
982
- declare class Plane implements GeometryQuery<Plane> {
983
- normal: Vec3;
984
- w: number;
985
- constructor(normal?: Vec3, w?: number);
986
- private validate;
987
- get origin(): Vec3;
988
- static setFromPointNormal(point: Vec3, normal: Vec3): Plane;
989
- setFromPointNormal(point: Vec3, normal: Vec3): this;
990
- set(normal: Vec3, w: number): this;
991
- copy(plane: Plane): this;
992
- clone(): Plane;
993
- setComponents(x: number, y: number, z: number, w: number): this;
872
+ interface MeshSplitOptions {
873
+ cap?: boolean;
874
+ tolerance?: number;
875
+ }
876
+
877
+ declare enum IntersectType {
878
+ None = 0,
879
+ Parallel = 1,
880
+ Perpendicular = 2,
881
+ Collineation = 3
882
+ }
883
+ declare enum Orientation {
884
+ None = -1,
885
+ Positive = 1,
886
+ Negative = 2,
887
+ Common = 3,//共面
888
+ Intersect = 3
889
+ }
890
+
891
+ interface ISplitResult {
892
+ negative: Vec3[];
893
+ positive: Vec3[];
894
+ common: Vec3[];
895
+ orientation: Orientation;
896
+ }
897
+
898
+ /** Plane equation: normal.dot(point) + w = 0. */
899
+ declare class Plane$1 implements GeometryQuery<Plane$1> {
900
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
901
+ normal: Vec3;
902
+ w: number;
903
+ constructor(normal?: Vec3, w?: number);
904
+ private validate;
905
+ get origin(): Vec3;
906
+ static setFromPointNormal(point: Vec3, normal: Vec3): Plane$1;
907
+ setFromPointNormal(point: Vec3, normal: Vec3): this;
908
+ set(normal: Vec3, w: number): this;
909
+ copy(plane: Plane$1): this;
910
+ clone(): Plane$1;
911
+ setComponents(x: number, y: number, z: number, w: number): this;
994
912
  normalize(): this;
995
913
  setFromThreePoint(a: Vec3, b: Vec3, c: Vec3): this;
996
914
  negate(): this;
@@ -1001,23 +919,23 @@ declare class Plane implements GeometryQuery<Plane> {
1001
919
  distanceLine(line: Line): DistanceResult;
1002
920
  distanceSegment(segment: Segment): DistanceResult;
1003
921
  distanceTriangle(triangle: Triangle): DistanceResult;
1004
- distancePlane(plane: Plane): DistanceResult;
922
+ distancePlane(plane: Plane$1): DistanceResult;
1005
923
  intersectSegmentLw(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
1006
924
  intersectLine(line: Line, result?: Vec3): Vec3 | undefined;
1007
925
  intersectRay(ray: Ray, result?: Vec3): Vec3 | undefined;
1008
926
  splitSegment(segment: Segment | Vec3[]): {
1009
- intersectPoint: Vec3 | undefined;
1010
927
  negative: Vec3[];
1011
928
  positive: Vec3[];
1012
929
  common: Vec3[];
1013
930
  orientation: Orientation;
931
+ intersectPoint: Vec3 | undefined;
1014
932
  };
1015
- splitTriangle(triangle: Triangle | Vec3[]): ISplitResult;
933
+ splitTriangle(triangle: Triangle | Vec3[], tolerance?: number): ISplitResult;
1016
934
  /** Ordered polygons on either side; cut vertices are included in both. */
1017
- splitConvexPolygon(polygon: Vec3[]): ISplitResult;
935
+ splitConvexPolygon(polygon: Vec3[], tolerance?: number): ISplitResult;
1018
936
  orientationPoint(point: Vec3): Orientation;
1019
- /** Split a triangle mesh surface, interpolating attributes. Does not cap cuts. */
1020
- static splitGeometry(plane: Plane, geometry: IGeometry): {
937
+ /** Split a triangle mesh, interpolating attributes; optional closed manifold caps. */
938
+ static splitGeometry(plane: Plane$1, geometry: IGeometry, options?: MeshSplitOptions): {
1021
939
  positive: IGeometry;
1022
940
  negative: IGeometry;
1023
941
  common: IGeometry;
@@ -1029,6 +947,7 @@ declare class Plane implements GeometryQuery<Plane> {
1029
947
  declare class Line implements GeometryQuery<Line> {
1030
948
  origin: Vec3;
1031
949
  end: Vec3;
950
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
1032
951
  direction: Vec3;
1033
952
  constructor(origin?: Vec3, end?: Vec3);
1034
953
  set(origin: Vec3, end: Vec3): this;
@@ -1056,15 +975,15 @@ declare class Line implements GeometryQuery<Line> {
1056
975
  * @param plane
1057
976
  * @param result
1058
977
  */
1059
- intersectPlane(plane: Plane, result?: Vec3): Vec3 | undefined;
1060
- distancePlane(plane: Plane): DistanceResult;
978
+ intersectPlane(plane: Plane$1, result?: Vec3): Vec3 | undefined;
979
+ distancePlane(plane: Plane$1): DistanceResult;
1061
980
  distanceSphere(sphere: Sphere): DistanceResult;
1062
981
  distanceCapsule(capsule: Capsule): DistanceResult;
1063
982
  copy(source: Line): this;
1064
983
  clone(): Line;
1065
984
  readonly kind: GeometryKind;
1066
985
  distanceBox(box: Box): DistanceResult;
1067
- distanceRectangle(rectangle: Rectangle): DistanceResult;
986
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
1068
987
  toJSON(): GeometryData;
1069
988
  }
1070
989
  declare function line(start?: Vec3, end?: Vec3): Line;
@@ -1087,16 +1006,17 @@ declare class Capsule extends Segment implements GeometryQuery<Capsule> {
1087
1006
  distanceSegment(segment: Segment): DistanceResult;
1088
1007
  distanceLine(line: Line): DistanceResult;
1089
1008
  distanceRay(ray: Ray): DistanceResult;
1090
- distancePlane(plane: Plane): DistanceResult;
1009
+ distancePlane(plane: Plane$1): DistanceResult;
1091
1010
  distanceTriangle(triangle: Triangle): DistanceResult;
1092
1011
  containsPoint(point: Vec3): boolean;
1093
1012
  readonly kind: GeometryKind;
1094
1013
  distanceBox(box: Box): DistanceResult;
1095
- distanceRectangle(rectangle: Rectangle): DistanceResult;
1014
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
1096
1015
  toJSON(): GeometryData;
1097
1016
  }
1098
1017
 
1099
1018
  declare class Box implements GeometryQuery<Box> {
1019
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
1100
1020
  min: Vec3;
1101
1021
  max: Vec3;
1102
1022
  _center: Vec3;
@@ -1126,85 +1046,11 @@ declare class Box implements GeometryQuery<Box> {
1126
1046
  distanceSegment(segment: Segment): DistanceResult;
1127
1047
  distanceSphere(sphere: Sphere): DistanceResult;
1128
1048
  distanceCapsule(capsule: Capsule): DistanceResult;
1129
- distancePlane(plane: Plane): DistanceResult;
1049
+ distancePlane(plane: Plane$1): DistanceResult;
1130
1050
  distanceTriangle(triangle: Triangle): DistanceResult;
1131
- distanceRectangle(rectangle: Rectangle): DistanceResult;
1132
- toJSON(): GeometryData;
1133
- }
1134
-
1135
- declare class Circle implements GeometryQuery<Circle> {
1136
- center: Vec3;
1137
- radius: number;
1138
- normal: Vec3;
1139
- startAngle: number;
1140
- lengthAngle: number;
1141
- radiusSqr: number;
1142
- /**
1143
- * 圆圈
1144
- * @param {Vec3} center 中心点
1145
- * @param {Vec3} normal 法线
1146
- * @param {Number} radius 半径
1147
- */
1148
- constructor(center?: Vec3, radius?: number, startAngle?: number, lengthAngle?: number, normal?: Vec3);
1149
- area(): number;
1150
- /**
1151
- * 两个点
1152
- * @param fixp0
1153
- * @param fixp1
1154
- * @param movep
1155
- * @param normal
1156
- */
1157
- arc1(fixp0: Vec3, fixp1: Vec3, movep: Vec3, normal?: Vec3): void;
1158
- /**
1159
- * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
1160
- * @param fixp0
1161
- * @param fixp1
1162
- * @param movep
1163
- */
1164
- arc2(center: Vec3, fixp1: Vec3, movep: Vec3, ccw?: boolean, normal?: Vec3): this;
1165
- setFrom3Points(p0: Vec3, p1: Vec3, p2: Vec3, normal?: Vec3): this;
1166
- /**
1167
- * 将圆环或者圆弧转化为路径点,生成XY平面上得三维点
1168
- * @param center 中心点
1169
- * @param radius 半径
1170
- * @param startAngle 起始角 右手坐标系 以X正坐标轴为起点 单位弧度
1171
- * @param lengthAngle 弧度长度 单位弧度
1172
- * @param segment 分段
1173
- */
1174
- static toVecs(center: Vec3, radius: number, startAngle?: number, lengthAngle?: number, up?: Vec3, segment?: number): Vec3[];
1175
- /**
1176
- * 在p点延伸a,b两个方向,生成半径为r的圆弧,圆弧所在位置在a,b向量的内夹角
1177
- * @param p 位置
1178
- * @param a a方向
1179
- * @param b b方向
1180
- * @param r 圆弧半径
1181
- */
1182
- static PAdBdtoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1183
- static PApBptoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1184
- set(center: Vec3, radius: number, normal?: Vec3): this;
1185
- copy(source: Circle): this;
1186
- clone(): Circle;
1187
- distancePoint(point: Vec3): DistanceResult;
1188
- readonly kind: GeometryKind;
1189
- toJSON(): GeometryData;
1190
- }
1191
- declare function circle(center?: Vec3, radius?: number): Circle;
1192
-
1193
- declare class Disk implements GeometryQuery<Disk> {
1194
- center: Vec3;
1195
- normal: Vec3;
1196
- radius: number;
1197
- w: number;
1198
- constructor(center: Vec3, radius: number, normal?: Vec3);
1199
- area(): number;
1200
- set(center: Vec3, radius: number, normal?: Vec3): this;
1201
- copy(source: Disk): this;
1202
- clone(): Disk;
1203
- distancePoint(point: Vec3): DistanceResult;
1204
- readonly kind: GeometryKind;
1051
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
1205
1052
  toJSON(): GeometryData;
1206
1053
  }
1207
- declare function disk(center: Vec3, radius: number, normal: Vec3): Disk;
1208
1054
 
1209
1055
  interface IVec2 {
1210
1056
  x: number;
@@ -1220,6 +1066,7 @@ declare class Vec3 implements IVec3 {
1220
1066
  private _x;
1221
1067
  private _y;
1222
1068
  private _z;
1069
+ queryDistance(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
1223
1070
  constructor(_x?: number, _y?: number, _z?: number);
1224
1071
  get x(): number;
1225
1072
  set x(value: number);
@@ -1315,13 +1162,13 @@ declare class Vec3 implements IVec3 {
1315
1162
  * @param plane 平面
1316
1163
  * @returns
1317
1164
  */
1318
- projectOnPlane(plane: Plane): this;
1165
+ projectOnPlane(plane: Plane$1): this;
1319
1166
  /**
1320
1167
  * 从指定方向线(斜线,也可能是法线)上投影到平面
1321
1168
  * @param planeNormal
1322
1169
  * @param dir
1323
1170
  */
1324
- projectDirectionOnPlane(plane: Plane, dir: Vec3): this;
1171
+ projectDirectionOnPlane(plane: Plane$1, dir: Vec3): this;
1325
1172
  reflect(normal: any): this;
1326
1173
  /**
1327
1174
  * 两个向量的夹角
@@ -1394,7 +1241,7 @@ declare class Vec3 implements IVec3 {
1394
1241
  * 点与线段的距离
1395
1242
  * @param plane
1396
1243
  */
1397
- distancePlane(plane: Plane): DistanceResult;
1244
+ distancePlane(plane: Plane$1): DistanceResult;
1398
1245
  /**
1399
1246
  * 点与圆圈的距离
1400
1247
  * @param {*} circle
@@ -1423,7 +1270,7 @@ declare class Vec3 implements IVec3 {
1423
1270
  * 点到矩形的距离
1424
1271
  * @param {Rectangle} rectangle
1425
1272
  */
1426
- distanceRectangle(rectangle: Rectangle): DistanceResult;
1273
+ distanceRectangle(rectangle: Rectangle$1): DistanceResult;
1427
1274
  /**
1428
1275
  * 点到胶囊的距离
1429
1276
  * @param {Capsule} capsule
@@ -1431,7 +1278,7 @@ declare class Vec3 implements IVec3 {
1431
1278
  distanceCapsule(capsule: Capsule): DistanceResult;
1432
1279
  distanceSphere(sphere: Sphere): DistanceResult;
1433
1280
  distanceBox(box: Box): DistanceResult;
1434
- readonly kind: "Point";
1281
+ readonly kind: 'Point';
1435
1282
  toJSON(): GeometryData;
1436
1283
  }
1437
1284
  declare function v3(x?: number, y?: number, z?: number): Vec3;
@@ -1654,7 +1501,7 @@ declare const DEGREES_PER_RADIAN: number;
1654
1501
  * @constant
1655
1502
  */
1656
1503
  declare const RADIANS_PER_ARCSECOND: number;
1657
- declare function sign(value: number): 1 | -1;
1504
+ declare function sign(value: number): -1 | 1;
1658
1505
  declare function approximateEqual(v1: number, v2: number, precision?: number): boolean;
1659
1506
  declare function clamp(value: number, min: number, max: number): number;
1660
1507
  declare function lerp(x: number, y: number, t: number): number;
@@ -1677,23 +1524,19 @@ declare function ToDegrees(radians: number): number;
1677
1524
  * @param {Object} obj 数字或者向量
1678
1525
  * @param {*} fractionDigits
1679
1526
  */
1680
- declare function toFixed(obj: {
1681
- toFixed: (arg0: any) => string;
1682
- x: number | undefined;
1683
- y: number | undefined;
1684
- z: number | undefined;
1685
- }, fractionDigits: number | undefined): number | {
1686
- toFixed: (arg0: any) => string;
1687
- x: number | undefined;
1688
- y: number | undefined;
1689
- z: number | undefined;
1690
- };
1527
+ declare function toFixed(obj: number, fractionDigits?: number): number;
1528
+ declare function toFixed<T extends {
1529
+ x?: number;
1530
+ y?: number;
1531
+ z?: number;
1532
+ w?: number;
1533
+ }>(obj: T, fractionDigits?: number): T;
1691
1534
  /**
1692
1535
  * 数组中所有数字或者向量固定位数
1693
1536
  * @param {Array} array
1694
1537
  * @param {Number} precision
1695
1538
  */
1696
- declare function toFixedAry(array: Array<any>, precision?: number): void;
1539
+ declare function toFixedAry(array: Array<any>, precision?: number): any[];
1697
1540
 
1698
1541
  /**
1699
1542
  * 遍历多级数组中所有对象
@@ -1711,7 +1554,7 @@ declare function flat(array: any[]): any[];
1711
1554
  * @param {Array} array
1712
1555
  * @param {Function} classifyMethod 分类方法
1713
1556
  */
1714
- declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any;
1557
+ declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any[][];
1715
1558
  /**
1716
1559
  * 去掉重复元素
1717
1560
  * @param {Array} array
@@ -1740,6 +1583,8 @@ declare class Color {
1740
1583
  setHexCssString(style: string): this | undefined;
1741
1584
  setRGB(r: number, g: number, b: number, a?: number): this;
1742
1585
  clone(): any;
1586
+ lerp(other: Color, t: number): this;
1587
+ getHex(): number;
1743
1588
  copy(color: this): this;
1744
1589
  equals(c: this): boolean;
1745
1590
  toArray(array?: number[], offset?: number): number[];
@@ -1868,7 +1713,7 @@ declare class vecs {
1868
1713
  * @returns {Array<Number>} 数字数组
1869
1714
  */
1870
1715
  static verctorToNumbers(vectors: Array<Vec4 | Vec3 | Vec2 | any> | any, comSort?: string): number[];
1871
- static vec(component?: number): Vec3 | Vec2 | Vec4;
1716
+ static vec(component?: number): Vec2 | Vec3 | Vec4;
1872
1717
  /**
1873
1718
  * 数字数组 转 适量数组
1874
1719
  * @param vss 数字数组
@@ -1958,26 +1803,26 @@ declare function simplifyPointList(points: any | Vec3[], maxDistance?: number, m
1958
1803
  * @param {*} points 点集
1959
1804
  * @param {*} plane 对称镜像平面
1960
1805
  */
1961
- declare function reverseOnPlane(points: Vec3[], plane: Plane, ref?: boolean): Vec3[];
1806
+ declare function reverseOnPlane(points: Vec3[], plane: Plane$1, ref?: boolean): Vec3[];
1962
1807
  /**
1963
1808
  * 投影到平面
1964
1809
  * @param {*} points 点集
1965
1810
  * @param {*} plane 投影平面
1966
1811
  * @param {*} projectDirect 默认是法线的方向
1967
1812
  */
1968
- declare function projectOnPlane(points: Vec3[], plane: Plane, direction?: Vec3, ref?: boolean): Vec3[];
1813
+ declare function projectOnPlane(points: Vec3[], plane: Plane$1, direction?: Vec3, ref?: boolean): Vec3[];
1969
1814
  /**
1970
1815
  * 计算共面点集所在的平面
1971
1816
  * @param {Array<Vec3|Point>} points
1972
1817
  */
1973
- declare function recognitionPlane(points: Vec3[]): Plane;
1818
+ declare function recognitionPlane(points: Vec3[]): Plane$1;
1974
1819
  /**
1975
1820
  * 判断所有点是否在同一个平面
1976
1821
  * @param {Array<Vec3|Point>} points
1977
1822
  * @param {*} precision
1978
1823
  * @returns {Boolean|Plane} 如果在同一个平面返回所在平面,否则返回false
1979
1824
  */
1980
- declare function isInOnePlane(points: Vec3[], precision?: number): Plane | false;
1825
+ declare function isInOnePlane(points: Vec3[], precision?: number): Plane$1 | false;
1981
1826
  /**
1982
1827
  * 判断多边是否共线:
1983
1828
  * 考虑情况点之间的距离应该大于最小容忍值
@@ -2071,6 +1916,134 @@ declare class Delaunay {
2071
1916
  _step(i: number, x: number, y: number): number;
2072
1917
  }
2073
1918
 
1919
+ interface IDistanceResut {
1920
+ isNode: boolean;
1921
+ point: Vec3;
1922
+ direction: Vec3;
1923
+ }
1924
+ /** Polyline with mileage and frame caches. Call init after editing coordinates through array. */
1925
+ declare class Path<T extends Vec3 = Vec3> extends ArrayList<T> {
1926
+ _closed: boolean;
1927
+ _calcNoraml: boolean;
1928
+ constructor(vs?: T[] | ArrayList<T>, closed?: boolean, calcNormal?: boolean);
1929
+ init(calcNormal?: boolean): this;
1930
+ set closed(value: boolean);
1931
+ get closed(): boolean;
1932
+ get tlen(): any;
1933
+ applyMat4(matrix: Mat4): this;
1934
+ scale(x: number, y: number, z: number): this;
1935
+ getPointByDistance(distance: number, left?: number, right?: number): IDistanceResut | null;
1936
+ getPointByDistancePure(distance: number, left?: number, right?: number): Vec3 | null;
1937
+ splitByFromToDistance(from?: number, to?: number): Path<Vec3> | null;
1938
+ splitAverage(count: number): Path<T>;
1939
+ splitAverageLength(length: number, integer?: boolean): Path<T>;
1940
+ add(...points: T[]): this;
1941
+ push(...points: T[]): void;
1942
+ pop(): T | undefined;
1943
+ unshift(...points: T[]): number;
1944
+ insertAt(index: number, ...points: T[]): void;
1945
+ splice(start: number, deleteCount: number, ...points: T[]): void;
1946
+ reverse(): this;
1947
+ clone(): Path<T>;
1948
+ static totalMileages(points: ArrayLike<Vec3>): number;
1949
+ static getPerMileages(points: ArrayLike<Vec3>, normalize?: boolean, totalMileage?: number): number[];
1950
+ }
1951
+
1952
+ type AxisPlane = 'xy' | 'xz' | 'yz' | 'xyz';
1953
+ interface ITriangulationOption {
1954
+ feature?: AxisPlane;
1955
+ dim?: number;
1956
+ normal?: Vec3;
1957
+ }
1958
+ /**
1959
+ * 自有 TypeScript 三角剖分:耳切法与可见桥孔洞连接。
1960
+ * @param {Array} boundary 边界
1961
+ * @param {Array<Array>} holes 洞的数组
1962
+ * @param {options:{feature,dim,normal}} feature 选择平平面
1963
+ * @returns {Array<Number>} 三角形索引数组
1964
+ */
1965
+ declare function triangulation(boundary: Vec3[], holes?: Vec3[][], options?: ITriangulationOption): number[];
1966
+
1967
+ type Position = IVec3 | IVec2;
1968
+ interface ILinkSideOption {
1969
+ side0: Position[] | number[];
1970
+ side1: Position[] | number[];
1971
+ holes0?: Vec3[][];
1972
+ holes1?: Vec3[][];
1973
+ shapeClosed?: boolean;
1974
+ autoUV?: boolean;
1975
+ uvScalars?: number[];
1976
+ segs?: number[];
1977
+ }
1978
+ declare function linkSide(options: ILinkSideOption): Array<number | Vec3>;
1979
+ interface ILinkSideOptions {
1980
+ shapes: Position[][];
1981
+ orgShape?: Position[];
1982
+ orgHoles?: Position[][];
1983
+ sealStart?: boolean;
1984
+ sealEnd?: boolean;
1985
+ shapeClosed?: boolean;
1986
+ pathClosed?: boolean;
1987
+ index?: {
1988
+ index: number;
1989
+ };
1990
+ autoIndex?: boolean;
1991
+ generateUV?: boolean;
1992
+ axisPlane?: AxisPlane;
1993
+ holes?: Position[][][];
1994
+ enableSmooth?: boolean;
1995
+ smoothAngle?: number;
1996
+ }
1997
+ /** Stitch profiles and holes, adding oriented caps and complete vertex attributes. */
1998
+ declare function linkSides(options: ILinkSideOptions): IGeometry;
1999
+ interface IExtrudeOptions {
2000
+ fixedY?: boolean;
2001
+ shapeClosed?: boolean;
2002
+ isClosed2?: boolean;
2003
+ textureEnable?: boolean;
2004
+ textureScale?: Vec2;
2005
+ smoothAngle?: number;
2006
+ sealStart?: boolean;
2007
+ sealEnd?: boolean;
2008
+ normal?: Vec3;
2009
+ }
2010
+ interface IExtrudeOptionsEx {
2011
+ shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;
2012
+ path: Array<Vec3 | IVec3>;
2013
+ holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
2014
+ ups?: Array<Vec3 | IVec3>;
2015
+ up?: Vec3 | IVec3;
2016
+ right?: Vec3;
2017
+ shapeClosed?: boolean;
2018
+ pathClosed?: boolean;
2019
+ textureEnable?: boolean;
2020
+ smoothAngle?: number;
2021
+ enableSmooth?: boolean;
2022
+ sealStart?: boolean;
2023
+ sealEnd?: boolean;
2024
+ normal?: Vec3;
2025
+ autoIndex?: boolean;
2026
+ axisPlane?: AxisPlane;
2027
+ generateUV?: boolean;
2028
+ index?: {
2029
+ index: number;
2030
+ };
2031
+ }
2032
+ interface IExtrudeOptionsNext extends Omit<IExtrudeOptionsEx, 'up' | 'right'> {
2033
+ up?: Array<Vec3 | IVec3> | Vec3 | IVec3;
2034
+ right?: Vec3[] | Vec3;
2035
+ shapeCenter?: Vec3;
2036
+ jtType?: JoinType;
2037
+ etType?: EndType;
2038
+ bevelSize?: number;
2039
+ roundSegments?: number;
2040
+ miterLimit?: number;
2041
+ }
2042
+ declare function extrude(options: IExtrudeOptionsEx): IGeometry;
2043
+ declare function extrudeNext(options: IExtrudeOptionsNext): IGeometry;
2044
+ /** @deprecated Use extrude with explicit options. */
2045
+ declare function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, path: Vec3[] | Path<Vec3>, options?: IExtrudeOptions): IGeometry;
2046
+
2074
2047
  /** Monotone-chain convex hull of coplanar points, without a repeated end point. */
2075
2048
  declare function convexHull(points: Vec3[], normal?: Vec3): Vec3[];
2076
2049
  /** Compatibility wrapper for the class historically shown in the README. */
@@ -2080,11 +2053,18 @@ declare class ConvexHull {
2080
2053
  planeNormal?: Vec3;
2081
2054
  });
2082
2055
  }
2083
- /** Exact 3D closest pair. Sweep pruning; worst-case O(n²), O(n) storage. */
2056
+ /** 3D closest pair, divide-and-conquer with a packed YZ strip grid: O(n log n). */
2084
2057
  declare function closestPair(points: Vec3[]): DistanceResult;
2058
+ interface ConvexHull3DResult {
2059
+ dimension: 0 | 1 | 2 | 3;
2060
+ vertices: Vec3[];
2061
+ faces: number[][];
2062
+ }
2063
+ /** Incremental outward oriented 3D hull. Degenerate inputs report their affine dimension. */
2064
+ declare function convexHull3D(points: readonly Vec3[], tolerance?: number): ConvexHull3DResult;
2085
2065
 
2086
2066
  /** Uniform entry point; also resolves symmetric queries defined on one operand. */
2087
- declare function distance(a: GeometryQuery<any>, b: GeometryQuery<any>): DistanceResult;
2067
+ declare function distance(a: GeometryQuery<any>, b: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
2088
2068
  declare function intersects(a: GeometryQuery<any>, b: GeometryQuery<any>, tolerance?: number): boolean;
2089
2069
 
2090
2070
  /**
@@ -2134,14 +2114,14 @@ declare class MeshTool {
2134
2114
  * 视锥体
2135
2115
  */
2136
2116
  declare class Frustum {
2137
- planes: Plane[];
2117
+ planes: Plane$1[];
2138
2118
  constructor();
2139
- get front(): Plane;
2140
- get back(): Plane;
2141
- get top(): Plane;
2142
- get bottom(): Plane;
2143
- get left(): Plane;
2144
- get right(): Plane;
2119
+ get front(): Plane$1;
2120
+ get back(): Plane$1;
2121
+ get top(): Plane$1;
2122
+ get bottom(): Plane$1;
2123
+ get left(): Plane$1;
2124
+ get right(): Plane$1;
2145
2125
  /**
2146
2126
  * 从投影矩阵计算视锥体
2147
2127
  * @param m
@@ -2149,12 +2129,14 @@ declare class Frustum {
2149
2129
  */
2150
2130
  setFromProjectionMatrix(m: Mat4): this;
2151
2131
  static fromProjectionMatrix(m: Mat4): Frustum;
2152
- setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): void;
2132
+ /** fov is the vertical field of view in radians. OpenGL depth range [-1, 1]. */
2133
+ setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): this;
2153
2134
  intersectsObject(geometry: BufferGeometry, mat: Mat4): boolean;
2154
2135
  intersectsSphere(sphere: Sphere): boolean;
2155
2136
  intersectsSphereComponents(cx: number, cy: number, cz: number, radius: number): boolean;
2156
2137
  containsPoint(point: Vec3): boolean;
2157
- intersectSegment(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
2138
+ /** Clip a segment against all six half spaces. Returns independent endpoints, or null. */
2139
+ intersectSegment(segment: Segment | Vec3[]): Vec3[] | null;
2158
2140
  simpleIntersectVS(vs: Vec3[]): Vec3[];
2159
2141
  copy(frustum: Frustum): this;
2160
2142
  clone(): any;
@@ -2165,78 +2147,6 @@ declare class Point extends Vec3 implements GeometryQuery<Point> {
2165
2147
  clone(): Point;
2166
2148
  }
2167
2149
 
2168
- interface IDistanceResut {
2169
- isNode: boolean;
2170
- point: Vec3;
2171
- direction: Vec3;
2172
- }
2173
- declare class Path<T extends Vec3> extends ArrayList<T> {
2174
- _closed: boolean;
2175
- _calcNoraml: boolean;
2176
- /**
2177
- *
2178
- * @param vs 假定是没有重复的点集
2179
- * @param closed
2180
- * @param calcNormal
2181
- */
2182
- constructor(vs: Array<T> | ArrayList<T>, closed?: boolean, calcNormal?: boolean);
2183
- init(calcNormal: boolean): void;
2184
- set closed(val: boolean);
2185
- get closed(): boolean;
2186
- get tlen(): number;
2187
- applyMat4(mat4: Mat4): void;
2188
- scale(x: number, y: number, z: number): void;
2189
- /**
2190
- * 截取一段从from到to的path
2191
- * @param {Number} from
2192
- * @param {Number} to
2193
- */
2194
- splitByFromToDistance(from?: number, to?: number): Path<never> | null;
2195
- /**
2196
- * 从起点出发到距离等于distance位置 的坐标 二分查找
2197
- * @param {Number} distance
2198
- */
2199
- getPointByDistance(arg_distance: number, left?: number, right?: number): IDistanceResut | null;
2200
- /**
2201
- * 从起点出发到距离等于distance位置 的坐标 二分查找
2202
- * @param {Number} distance
2203
- */
2204
- getPointByDistancePure(arg_distance: number, left?: number, right?: number): Vec3 | null;
2205
- /**
2206
- * 平均切割为 splitCount 段
2207
- * @param {Number} splitCount
2208
- * @returns {Path} 新的path
2209
- */
2210
- splitAverage(splitCount: number): Path<T>;
2211
- /**
2212
- * 通过测试
2213
- * 平均切割为 splitCount 段
2214
- * @param {Number} splitCount
2215
- * @param {Boolean} integer 是否取整
2216
- * @returns {Path} 新的path
2217
- */
2218
- splitAverageLength(splitLength: number, integer?: boolean): Path<T>;
2219
- /**
2220
- *
2221
- * @param {...any} ps
2222
- */
2223
- add(...ps: Vec3[] | Point[]): void;
2224
- /**
2225
- * @description : 计算一段线段的总长度
2226
- * @param {ArrayLike} ps
2227
- * @return {number} 总长度
2228
- */
2229
- static totalMileages(ps: ArrayLike<Vec3>): number;
2230
- /**
2231
- * @description : 获取没一点的里程 里程是指从第一个点出发的长度
2232
- * @param {ArrayLike} ps 里程上的点集
2233
- * @param {boolean} normalize 是否归一化
2234
- * @return {number[]} 每一个点的里程数组
2235
- * @example :
2236
- */
2237
- static getPerMileages(ps: ArrayLike<Vec3>, normalize?: boolean, totalMileage?: number): number[];
2238
- }
2239
-
2240
2150
  declare function toGeometryBuffer(geo: IGeometry): BufferGeometry;
2241
2151
  /**
2242
2152
  * shape 挤压后转几何体
@@ -2288,10 +2198,16 @@ declare class Tree<T = any> {
2288
2198
  /**
2289
2199
  *
2290
2200
  */
2291
- declare class BSP extends Tree {
2201
+ declare class BSP$1<T = any> extends Tree<T> {
2202
+ plane?: Plane$1;
2292
2203
  constructor();
2293
- get pos(): Tree<any> | undefined;
2294
- get neg(): Tree<any> | undefined;
2204
+ /** Classify whole objects; straddling objects stay at the dividing node. */
2205
+ partition(plane: Plane$1, classify: (value: T, plane: Plane$1) => number): this;
2206
+ static fromPoints(points: readonly Vec3[], leafSize?: number): BSP$1<Vec3>;
2207
+ /** Visit the containing leaf plus every ancestor's straddling objects. */
2208
+ queryPoint(point: Vec3): T[];
2209
+ get pos(): Tree<T> | undefined;
2210
+ get neg(): Tree<T> | undefined;
2295
2211
  add(obj: any): this;
2296
2212
  remove(obj: any): boolean;
2297
2213
  find(condition: any): any[];
@@ -2323,7 +2239,17 @@ declare class KdTree extends Tree<Vec3> {
2323
2239
  range(min: Vec3, max: Vec3): Vec3[];
2324
2240
  }
2325
2241
 
2242
+ interface PolyNode {
2243
+ contour: Vec3[];
2244
+ parent?: PolyNode;
2245
+ children: PolyNode[];
2246
+ depth: number;
2247
+ isHole: boolean;
2248
+ }
2326
2249
  declare class PolyTree extends Tree {
2250
+ contours: PolyNode[];
2251
+ buildContours(rings: readonly (readonly Vec3[])[], tolerance?: number): this;
2252
+ containsPoint(point: Vec3, tolerance?: number): boolean;
2327
2253
  constructor();
2328
2254
  add(obj: any): this;
2329
2255
  remove(obj: any): boolean;
@@ -2346,7 +2272,10 @@ declare class QuadTree extends Tree<Vec3> {
2346
2272
  nearest(point: Vec3, count?: number): Vec3[];
2347
2273
  }
2348
2274
 
2275
+ /** Even-odd Boolean clipping, including self intersections, holes and shared edges.
2276
+ * Project-owned TypeScript arrangement, O(E²) edge intersection phase. */
2349
2277
  declare function clipPolygons(subject: Vec3[][], clip: Vec3[][], operation?: 'intersection' | 'union' | 'difference' | 'xor', normal?: Vec3, scale?: number): Vec3[][];
2278
+ /** Offset with miter/square/round joins. Round arcs use at most 7.5° steps. */
2350
2279
  declare function offsetPaths(rings: Vec3[][], delta: number, normal?: Vec3, join?: number, end?: number, miterLimit?: number, scale?: number): Vec3[][];
2351
2280
  declare function cleanPolygon(points: Vec3[], tolerance?: number, normal?: Vec3): Vec3[];
2352
2281
  declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
@@ -2354,5 +2283,897 @@ declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
2354
2283
  /** Restore owned geometry from plain data. Never trusts a serialized prototype. */
2355
2284
  declare function geometryFromJSON(data: GeometryData): GeometryQuery<any>;
2356
2285
 
2357
- export { BSP, BTree, Box, BufferAttribute, BufferGeometry, Capsule, Circle, ClipType, Color, ConvexHull, DEGREES_PER_RADIAN, Delaunator, Delaunay, Disk, Distance, EndType, Euler, Float32BufferAttribute, Float64BufferAttribute, Frustum, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectType, JoinType, KdTree, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, Orientation, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane, Point, PolyTree, Polygon, Polyline, QuadTree, Quat, QuadTree as QuatTree, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Rectangle, Segment, Sphere, THREE_PI_OVER_TWO, ToDegrees, Tree, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, calculateVolume, ceilPowerOfTwo, circle, clamp, classify, cleanPolygon, clipPolygons, clone, closestPair, convexHull, delta4, delta5, delta6, delta7, delta8, delta9, disk, distance, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, geometryFromJSON, intersects, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, offsetPaths, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, simplifyPolygon, smootherstep, smoothstep, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
2358
- export type { AxisPlane, DistanceParameter, DistanceResult, GeometryData, GeometryKind, GeometryQuery, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, IntersectResult };
2286
+ interface IHVec2 {
2287
+ x: Decimal;
2288
+ y: Decimal;
2289
+ }
2290
+ interface IHVec3 extends IHVec2 {
2291
+ z: Decimal;
2292
+ }
2293
+ interface IHVec4 extends IHVec3 {
2294
+ w: Decimal;
2295
+ }
2296
+ /** Mutable decimal vector. Pass strings to preserve more precision than a JS number. */
2297
+ declare class HVec3 implements IHVec3 {
2298
+ x: Decimal;
2299
+ y: Decimal;
2300
+ z: Decimal;
2301
+ constructor(x?: Decimal.Value, y?: Decimal.Value, z?: Decimal.Value);
2302
+ static isVec3(v: unknown): v is IHVec3;
2303
+ get isVec3(): boolean;
2304
+ static get Up(): HVec3;
2305
+ static get Down(): HVec3;
2306
+ static get UnitX(): HVec3;
2307
+ static get UnitY(): HVec3;
2308
+ static get UnitZ(): HVec3;
2309
+ set(x: Decimal.Value, y: Decimal.Value, z: Decimal.Value): this;
2310
+ setScalar(s: Decimal.Value): this;
2311
+ setComponent(index: number, value: Decimal.Value): this;
2312
+ getComponent(index: number): Decimal;
2313
+ copy(v: IHVec3): this;
2314
+ clone(): HVec3;
2315
+ add(v: IHVec3, w?: IHVec3): this;
2316
+ addVecs(a: IHVec3, b: IHVec3): this;
2317
+ sub(v: IHVec3, w?: IHVec3): this;
2318
+ subVecs(a: IHVec3, b: IHVec3): this;
2319
+ multiplyScalar(s: Decimal.Value): this;
2320
+ divideScalar(s: Decimal.Value): this;
2321
+ cross(v: IHVec3, w?: IHVec3): this;
2322
+ crossVecs(a: IHVec3, b: IHVec3): this;
2323
+ dot(v: IHVec3): Decimal;
2324
+ lengthSq(): Decimal;
2325
+ length(): Decimal;
2326
+ normalize(): this;
2327
+ lerp(v: IHVec3, alpha: Decimal.Value): this;
2328
+ distanceTo(v: IHVec3): Decimal;
2329
+ equals(v: IHVec3): boolean;
2330
+ toArray(): Decimal[];
2331
+ toJSON(): string[];
2332
+ }
2333
+
2334
+ declare class Vec {
2335
+ _data: Decimal[];
2336
+ constructor(...values: Decimal.Value[]);
2337
+ get dim(): number;
2338
+ check(v: Vec): boolean;
2339
+ private requireDimension;
2340
+ copy(v: Vec): this;
2341
+ clone(): Vec;
2342
+ add(v: Vec): this;
2343
+ sub(v: Vec): this;
2344
+ multiplyScalar(s: Decimal.Value): this;
2345
+ cross(v: Vec): this;
2346
+ get extentSq(): Decimal;
2347
+ get extent(): Decimal;
2348
+ normalize(): this;
2349
+ dot(v: Vec): Decimal;
2350
+ toJSON(): string[];
2351
+ }
2352
+
2353
+ /** n·p + w = 0; normals are normalized on construction. */
2354
+ declare class Plane {
2355
+ normal: Vec;
2356
+ w: Decimal;
2357
+ constructor(point: Vec, normal: Vec);
2358
+ signedDistanceTo(point: Vec): Decimal;
2359
+ projectPoint(point: Vec): Vec;
2360
+ clone(): Plane;
2361
+ flip(): this;
2362
+ }
2363
+
2364
+ type index_d$3_HVec3 = HVec3;
2365
+ declare const index_d$3_HVec3: typeof HVec3;
2366
+ type index_d$3_Plane = Plane;
2367
+ declare const index_d$3_Plane: typeof Plane;
2368
+ type index_d$3_Vec = Vec;
2369
+ declare const index_d$3_Vec: typeof Vec;
2370
+ declare namespace index_d$3 {
2371
+ export {
2372
+ index_d$3_HVec3 as HVec3,
2373
+ index_d$3_Plane as Plane,
2374
+ index_d$3_Vec as Vec,
2375
+ };
2376
+ }
2377
+
2378
+ declare enum Side {
2379
+ COPLANAR = 0,
2380
+ FRONT = 1,
2381
+ BACK = 2,
2382
+ SPANNING = 3
2383
+ }
2384
+ declare class Polygon {
2385
+ w: Decimal;
2386
+ normal: HVec3;
2387
+ vertices: HVec3[];
2388
+ readonly epsilon: Decimal;
2389
+ constructor(vertices?: readonly HVec3[], epsilon?: Decimal.Value);
2390
+ calcPlane(): this;
2391
+ flip(): this;
2392
+ classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
2393
+ classifySide(p: Polygon): Side;
2394
+ splitPolygon(p: Polygon, coplanarFront?: Polygon[], coplanarBack?: Polygon[], front?: Polygon[], back?: Polygon[]): void;
2395
+ clone(): Polygon;
2396
+ }
2397
+
2398
+ declare class Node {
2399
+ front?: Node;
2400
+ back?: Node;
2401
+ divider?: Polygon;
2402
+ polygons: Polygon[];
2403
+ constructor(polygons?: readonly Polygon[]);
2404
+ clone(): Node;
2405
+ invert(): this;
2406
+ clipPolygons(polygons: readonly Polygon[]): Polygon[];
2407
+ clipTo(node: Node): this;
2408
+ allPolygons(): Polygon[];
2409
+ build(polygons: readonly Polygon[]): this;
2410
+ }
2411
+
2412
+ /** BSP solid booleans on closed, consistently outward oriented convex polygon faces. */
2413
+ declare class BSP {
2414
+ tree: Node;
2415
+ constructor(faces?: readonly Polygon[]);
2416
+ toPolygons(): Polygon[];
2417
+ clone(): BSP;
2418
+ inverse(): BSP;
2419
+ sub(other: BSP): BSP;
2420
+ subtract(other: BSP): BSP;
2421
+ union(other: BSP): BSP;
2422
+ intersect(other: BSP): BSP;
2423
+ }
2424
+
2425
+ type index_d$2_BSP = BSP;
2426
+ declare const index_d$2_BSP: typeof BSP;
2427
+ type index_d$2_Node = Node;
2428
+ declare const index_d$2_Node: typeof Node;
2429
+ type index_d$2_Polygon = Polygon;
2430
+ declare const index_d$2_Polygon: typeof Polygon;
2431
+ type index_d$2_Side = Side;
2432
+ declare const index_d$2_Side: typeof Side;
2433
+ declare namespace index_d$2 {
2434
+ export {
2435
+ index_d$2_BSP as BSP,
2436
+ BSP as CSG,
2437
+ Polygon as CSGPolygon,
2438
+ index_d$2_Node as Node,
2439
+ index_d$2_Polygon as Polygon,
2440
+ index_d$2_Side as Side,
2441
+ };
2442
+ }
2443
+
2444
+ declare class Joint {
2445
+ position: Vec3;
2446
+ rotation: Quat;
2447
+ constructor(position?: Vec3);
2448
+ }
2449
+
2450
+ declare enum ISpace {
2451
+ Globe = 0,
2452
+ Local = 1
2453
+ }
2454
+ declare abstract class TypedConstraint {
2455
+ space: ISpace;
2456
+ matrix: Mat4;
2457
+ abstract readonly kind: 'hinge' | 'slider';
2458
+ abstract axis: Vec3;
2459
+ worldAxis(bone: Bone): Vec3;
2460
+ }
2461
+
2462
+ declare class Bone {
2463
+ constraints: TypedConstraint[];
2464
+ matrix: Mat4;
2465
+ rotation: Quat;
2466
+ start: Joint;
2467
+ end: Joint;
2468
+ readonly restDirection: Vec3;
2469
+ constructor(start?: Joint | Vec3, end?: Joint | Vec3);
2470
+ /** @deprecated Typo retained for source compatibility. */
2471
+ get contraints(): TypedConstraint[];
2472
+ set contraints(value: TypedConstraint[]);
2473
+ get length(): number;
2474
+ updateMatrix(): this;
2475
+ }
2476
+
2477
+ /** One connected chain; distinct branches use distinct Skeleton instances. */
2478
+ declare class Skeleton {
2479
+ bones: Bone[][];
2480
+ constructor(chain?: readonly Bone[]);
2481
+ static fromPoints(points: readonly Vec3[]): Skeleton;
2482
+ get chain(): Bone[];
2483
+ get rootBone(): Bone;
2484
+ get boneNum(): number;
2485
+ get effector(): Vec3 | undefined;
2486
+ }
2487
+
2488
+ interface SolveOptions {
2489
+ iterations?: number;
2490
+ tolerance?: number;
2491
+ }
2492
+ interface SolveResult {
2493
+ converged: boolean;
2494
+ iterations: number;
2495
+ distance: number;
2496
+ }
2497
+ interface ISolver {
2498
+ updateTarget(target: Vec3): this;
2499
+ solveIK(skeleton: Skeleton, target?: Vec3, options?: SolveOptions): SolveResult;
2500
+ }
2501
+
2502
+ declare class CCDSolver implements ISolver {
2503
+ target: Vec3;
2504
+ constructor(target?: Vec3);
2505
+ updateTarget(target: Vec3): this;
2506
+ projectPlane(v: Vec3, normal: Vec3): Vec3;
2507
+ calcAngle(a: Vec3, b: Vec3, axis: Vec3): number;
2508
+ solveTranslate(target: Vec3, zeroPos: Vec3, effector: Vec3): Vec3;
2509
+ solveRotation(target: Vec3, origin: Vec3, effector: Vec3, constraints?: TypedConstraint[], bone?: Bone): Quat;
2510
+ solveIK(skeleton: Skeleton, target?: Vec3, options?: SolveOptions): SolveResult;
2511
+ solve(bones: Skeleton | readonly Bone[], target?: Vec3, options?: SolveOptions): SolveResult;
2512
+ }
2513
+
2514
+ declare class HingeConstraint extends TypedConstraint {
2515
+ axis: Vec3;
2516
+ minAngle: number;
2517
+ maxAngle: number;
2518
+ readonly kind = "hinge";
2519
+ angle: number;
2520
+ constructor(axis?: Vec3, minAngle?: number, maxAngle?: number);
2521
+ clampDelta(delta: number): number;
2522
+ }
2523
+
2524
+ declare class SliderConstraint extends TypedConstraint {
2525
+ axis: Vec3;
2526
+ min: number;
2527
+ max: number;
2528
+ readonly kind = "slider";
2529
+ position: number;
2530
+ constructor(axis?: Vec3, min?: number, max?: number);
2531
+ clampDelta(delta: number): number;
2532
+ }
2533
+
2534
+ type index_d$1_Bone = Bone;
2535
+ declare const index_d$1_Bone: typeof Bone;
2536
+ type index_d$1_CCDSolver = CCDSolver;
2537
+ declare const index_d$1_CCDSolver: typeof CCDSolver;
2538
+ type index_d$1_HingeConstraint = HingeConstraint;
2539
+ declare const index_d$1_HingeConstraint: typeof HingeConstraint;
2540
+ type index_d$1_ISolver = ISolver;
2541
+ type index_d$1_ISpace = ISpace;
2542
+ declare const index_d$1_ISpace: typeof ISpace;
2543
+ type index_d$1_Joint = Joint;
2544
+ declare const index_d$1_Joint: typeof Joint;
2545
+ type index_d$1_Skeleton = Skeleton;
2546
+ declare const index_d$1_Skeleton: typeof Skeleton;
2547
+ type index_d$1_SliderConstraint = SliderConstraint;
2548
+ declare const index_d$1_SliderConstraint: typeof SliderConstraint;
2549
+ type index_d$1_SolveOptions = SolveOptions;
2550
+ type index_d$1_SolveResult = SolveResult;
2551
+ type index_d$1_TypedConstraint = TypedConstraint;
2552
+ declare const index_d$1_TypedConstraint: typeof TypedConstraint;
2553
+ declare namespace index_d$1 {
2554
+ export { index_d$1_Bone as Bone, index_d$1_CCDSolver as CCDSolver, index_d$1_HingeConstraint as HingeConstraint, HingeConstraint as HingeContraint, index_d$1_ISpace as ISpace, index_d$1_Joint as Joint, index_d$1_Skeleton as Skeleton, index_d$1_SliderConstraint as SliderConstraint, index_d$1_TypedConstraint as TypedConstraint };
2555
+ export type { index_d$1_ISolver as ISolver, index_d$1_SolveOptions as SolveOptions, index_d$1_SolveResult as SolveResult };
2556
+ }
2557
+
2558
+ /** Earth centered, Earth fixed frame: X at 0°E, Y at 90°E, Z north. */
2559
+ declare class Ellipsoid {
2560
+ readonly x: number;
2561
+ readonly y: number;
2562
+ readonly z: number;
2563
+ static readonly WGS84: Readonly<Ellipsoid>;
2564
+ static readonly UNIT_SPHERE: Readonly<Ellipsoid>;
2565
+ constructor(x: number, y: number, z: number);
2566
+ get radii(): Vec3;
2567
+ get radiiSquared(): Vec3;
2568
+ get maximumRadius(): number;
2569
+ get minimumRadius(): number;
2570
+ geodeticSurfaceNormal(p: Vec3, result?: Vec3): Vec3;
2571
+ cartographicToCartesian(c: Cartographic, result?: Vec3): Vec3;
2572
+ scaleToGeodeticSurface(p: Vec3, result?: Vec3): Vec3 | undefined;
2573
+ cartesianToCartographic(p: Vec3, result?: Cartographic): Cartographic | undefined;
2574
+ }
2575
+
2576
+ declare const wgs84Radii: Vec3;
2577
+ declare const wgs84RadiiSquared: Vec3;
2578
+ declare const wgs84OneOverRadii: Vec3;
2579
+ declare const wgs84OneOverRadiiSquared: Vec3;
2580
+
2581
+ /** Longitude / geodetic latitude in radians; height in meters for WGS84. */
2582
+ declare class Cartographic {
2583
+ longitude: number;
2584
+ latitude: number;
2585
+ height: number;
2586
+ constructor(longitude?: number, latitude?: number, height?: number);
2587
+ validate(): this;
2588
+ static fromRadians(longitude?: number, latitude?: number, height?: number, result?: Cartographic): Cartographic;
2589
+ static fromDegrees(longitude?: number, latitude?: number, height?: number, result?: Cartographic): Cartographic;
2590
+ static fromGVec3(vec: Vec3, ellipsoid?: Readonly<Ellipsoid>): Cartographic | undefined;
2591
+ clone(): Cartographic;
2592
+ }
2593
+
2594
+ /**
2595
+ * A two dimensional region specified as longitude and latitude coordinates.
2596
+ *
2597
+ * @alias Rectangle
2598
+ * @constructor
2599
+ *
2600
+ * @param {Number} [west=0.0] The westernmost longitude, in radians, in the range [-Pi, Pi].
2601
+ * @param {Number} [south=0.0] The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
2602
+ * @param {Number} [east=0.0] The easternmost longitude, in radians, in the range [-Pi, Pi].
2603
+ * @param {Number} [north=0.0] The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
2604
+ *
2605
+ * @see Packable
2606
+ */
2607
+ declare class Rectangle {
2608
+ west: number;
2609
+ south: number;
2610
+ east: number;
2611
+ north: number;
2612
+ validate(): this;
2613
+ clone(): Rectangle;
2614
+ contains(position: Cartographic): boolean;
2615
+ constructor(west?: number, south?: number, east?: number, north?: number);
2616
+ /**
2617
+ * 计算宽度 单位弧度
2618
+ */
2619
+ static computeWidth: (rectangle: Rectangle) => number;
2620
+ /**
2621
+ * 计算高度弧度
2622
+ */
2623
+ static computeHeight: (rectangle: Rectangle) => number;
2624
+ static fromDegrees(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle;
2625
+ static fromRadians(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle;
2626
+ get width(): number;
2627
+ get height(): number;
2628
+ /**
2629
+ * Computes the northeast corner of a rectangle.
2630
+ *
2631
+ * @param {Rectangle} rectangle The rectangle for which to find the corner
2632
+ * @param {Cartographic} [result] The object onto which to store the result.
2633
+ * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided.
2634
+ */
2635
+ northeast(result?: Cartographic): Cartographic;
2636
+ /**
2637
+ * Computes the southeast corner of a rectangle.
2638
+ */
2639
+ southeast(result?: Cartographic): Cartographic;
2640
+ }
2641
+
2642
+ /** Karney geodesics via GeographicLib; antipodal inputs are supported. */
2643
+ declare class EllipsoidGeodesic {
2644
+ ellipsoid: Ellipsoid;
2645
+ start: Cartographic;
2646
+ end: Cartographic;
2647
+ surfaceDistance: number;
2648
+ startHeading: number;
2649
+ endHeading: number;
2650
+ private geodesic;
2651
+ constructor(ellipsoid?: Ellipsoid, start?: Cartographic, end?: Cartographic);
2652
+ private createGeodesic;
2653
+ setEndPoints(start: Cartographic, end: Cartographic): this;
2654
+ computeProperties(ellipsoid?: Ellipsoid): this;
2655
+ interpolateUsingSurfaceDistance(distance: number, result?: Cartographic): Cartographic;
2656
+ interpolateUsingFraction(fraction: number, result?: Cartographic): Cartographic;
2657
+ }
2658
+
2659
+ declare class GVec3 extends Vec3 {
2660
+ static fromDegrees(longitude: number, latitude: number, height?: number, ellipsoid?: Vec3 | Ellipsoid): GVec3;
2661
+ static fromRadians(longitude: number, latitude: number, height?: number, ellipsoid?: Vec3 | Ellipsoid): GVec3;
2662
+ static toCartographic(point: Vec3, ellipsoid?: Readonly<Ellipsoid>): Cartographic | undefined;
2663
+ toCartographic(ellipsoid?: Readonly<Ellipsoid>): Cartographic | undefined;
2664
+ }
2665
+
2666
+ interface IGeographicTilingScheme {
2667
+ ellipsoid?: Ellipsoid;
2668
+ rectangle?: Rectangle;
2669
+ numberOfLevelZeroTilesX?: number;
2670
+ numberOfLevelZeroTilesY?: number;
2671
+ }
2672
+ declare class GeographicTilingScheme {
2673
+ static readonly MAX_VALUE: Readonly<Rectangle>;
2674
+ readonly ellipsoid: Ellipsoid;
2675
+ readonly rectangle: Rectangle;
2676
+ private nx;
2677
+ private ny;
2678
+ constructor(options?: IGeographicTilingScheme);
2679
+ private count;
2680
+ getNumberOfXTilesAtLevel(level: number): number;
2681
+ getNumberOfYTilesAtLevel(level: number): number;
2682
+ tileXYToRectangle(x: number, y: number, level: number, result?: Rectangle): Rectangle;
2683
+ positionToTileXY(position: Cartographic, level: number): {
2684
+ x: number;
2685
+ y: number;
2686
+ } | undefined;
2687
+ }
2688
+
2689
+ interface TaskMessage<Result = unknown> {
2690
+ id: number;
2691
+ result?: Result;
2692
+ error?: {
2693
+ name?: string;
2694
+ message?: string;
2695
+ stack?: string;
2696
+ } | string;
2697
+ }
2698
+ interface TaskWorker {
2699
+ postMessage(message: unknown, transfer: Transferable[]): void;
2700
+ addEventListener(type: 'message' | 'error', listener: (event: any) => void): void;
2701
+ removeEventListener(type: 'message' | 'error', listener: (event: any) => void): void;
2702
+ terminate(): unknown;
2703
+ }
2704
+ type TaskExecutor<Input, Output> = (input: Input) => Output | Promise<Output>;
2705
+ declare class TaskProcessor<Input = unknown, Output = unknown> {
2706
+ private executor;
2707
+ private maximumActiveTasks;
2708
+ private workerFactory;
2709
+ private nextID;
2710
+ private worker?;
2711
+ private destroyed;
2712
+ private pending;
2713
+ constructor(executor: string | URL | TaskExecutor<Input, Output> | TaskWorker, maximumActiveTasks?: number, workerFactory?: (url: string | URL) => TaskWorker);
2714
+ get activeTasks(): number;
2715
+ private complete;
2716
+ private fail;
2717
+ private detachWorker;
2718
+ scheduleTask(parameters: Input, transferableObjects?: Transferable[]): Promise<Output> | undefined;
2719
+ isDestroyed(): boolean;
2720
+ destroy(): void;
2721
+ }
2722
+
2723
+ interface HeightmapOptions {
2724
+ buffer: ArrayLike<number>;
2725
+ width: number;
2726
+ height: number;
2727
+ heightScale?: number;
2728
+ heightOffset?: number;
2729
+ }
2730
+ /** Samples run west to east, rows north to south. Heights are meters on WGS84. */
2731
+ declare class HeightmapTerrainData {
2732
+ readonly buffer: Float64Array;
2733
+ readonly width: number;
2734
+ readonly height: number;
2735
+ constructor(options: HeightmapOptions);
2736
+ interpolateHeight(rectangle: Rectangle, longitude: number, latitude: number): number | undefined;
2737
+ createMesh(rectangle: Rectangle, ellipsoid?: Ellipsoid): IGeometry;
2738
+ }
2739
+
2740
+ interface TileRequest {
2741
+ signal?: AbortSignal;
2742
+ }
2743
+ declare abstract class TerrainProvider {
2744
+ abstract readonly tilingScheme: GeographicTilingScheme;
2745
+ abstract readonly ready: boolean;
2746
+ abstract requestTileGeometry(x: number, y: number, level: number, request?: TileRequest): Promise<HeightmapTerrainData>;
2747
+ getTileDataAvailable(x: number, y: number, level: number): boolean;
2748
+ }
2749
+
2750
+ interface IEllipsoidTerrainProviderOprion {
2751
+ ellipsoid?: Ellipsoid;
2752
+ }
2753
+ declare class EllipsoidTerrainProvider extends TerrainProvider {
2754
+ readonly ready = true;
2755
+ readonly tilingScheme: GeographicTilingScheme;
2756
+ constructor(options?: IEllipsoidTerrainProviderOprion);
2757
+ requestTileGeometry(x: number, y: number, level: number, request?: TileRequest): Promise<HeightmapTerrainData>;
2758
+ }
2759
+
2760
+ interface IDcTerrainProviderParamters {
2761
+ url: string;
2762
+ ellipsoid?: Ellipsoid;
2763
+ fetch?: typeof fetch;
2764
+ minimumLevel?: number;
2765
+ maximumLevel?: number;
2766
+ }
2767
+ /** URL template returning JSON { width, height, buffer: number[], heightScale?, heightOffset? }. */
2768
+ declare class DcTerrainProvider extends TerrainProvider {
2769
+ private options;
2770
+ readonly ready = true;
2771
+ readonly tilingScheme: GeographicTilingScheme;
2772
+ private fetcher;
2773
+ constructor(options: IDcTerrainProviderParamters);
2774
+ getTileDataAvailable(x: number, y: number, level: number): boolean;
2775
+ requestTileGeometry(x: number, y: number, level: number, request?: TileRequest): Promise<HeightmapTerrainData>;
2776
+ }
2777
+
2778
+ type ImageResource = ImageBitmap | HTMLImageElement | Blob;
2779
+ interface ImageLoaderOptions {
2780
+ fetch?: typeof fetch;
2781
+ decodeImage?: (blob: Blob, url: string) => ImageResource | Promise<ImageResource>;
2782
+ }
2783
+ declare abstract class ImageryProvider {
2784
+ abstract readonly ready: boolean;
2785
+ abstract readonly tilingScheme: GeographicTilingScheme;
2786
+ abstract requestImage(x: number, y: number, level: number, request?: TileRequest): Promise<ImageResource>;
2787
+ static loadImage(options: ImageLoaderOptions, url: string, request?: TileRequest): Promise<ImageResource>;
2788
+ }
2789
+
2790
+ interface UrlTemplateOptions extends ImageLoaderOptions {
2791
+ url: string;
2792
+ tilingScheme?: GeographicTilingScheme;
2793
+ tileWidth?: number;
2794
+ tileHeight?: number;
2795
+ minimumLevel?: number;
2796
+ maximumLevel?: number;
2797
+ subdomains?: readonly string[];
2798
+ }
2799
+ declare class UrlTemplateImageryProvider extends ImageryProvider {
2800
+ readonly options: UrlTemplateOptions;
2801
+ readonly ready = true;
2802
+ readonly tilingScheme: GeographicTilingScheme;
2803
+ readonly tileWidth: number;
2804
+ readonly tileHeight: number;
2805
+ constructor(options: UrlTemplateOptions);
2806
+ get rectangle(): Rectangle;
2807
+ buildImageUrl(x: number, y: number, level: number): string;
2808
+ requestImage(x: number, y: number, level: number, request?: TileRequest): Promise<ImageResource>;
2809
+ }
2810
+
2811
+ declare class DcImageryProvider extends ImageryProvider {
2812
+ private provider;
2813
+ constructor(options: UrlTemplateOptions | ImageryProvider);
2814
+ get ready(): boolean;
2815
+ get tilingScheme(): GeographicTilingScheme;
2816
+ requestImage(x: number, y: number, level: number, request?: TileRequest): Promise<ImageResource>;
2817
+ }
2818
+
2819
+ type EventListener<T = unknown> = (data: T) => void;
2820
+ declare class EventHandler<Events extends object = Record<string, unknown>> {
2821
+ private listeners;
2822
+ on<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
2823
+ off<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): this;
2824
+ once<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
2825
+ fire<K extends keyof Events>(type: K, data: Events[K]): this;
2826
+ removeAllListeners(): void;
2827
+ }
2828
+
2829
+ declare class ImageryLayer {
2830
+ imageryProvider: ImageryProvider;
2831
+ show: boolean;
2832
+ alpha: number;
2833
+ layerIndex: number;
2834
+ constructor(imageryProvider: ImageryProvider);
2835
+ destroy(): void;
2836
+ }
2837
+ interface LayerEvent {
2838
+ layer: ImageryLayer;
2839
+ index: number;
2840
+ previousIndex?: number;
2841
+ }
2842
+ interface LayerEvents {
2843
+ layerAdded: LayerEvent;
2844
+ layerRemoved: LayerEvent;
2845
+ layerMoved: LayerEvent;
2846
+ layerShownOrHidden: LayerEvent;
2847
+ }
2848
+ declare class ImageryLayerCollection extends EventHandler<LayerEvents> {
2849
+ static readonly EventType: {
2850
+ readonly layerAdded: 'layerAdded';
2851
+ readonly layerRemoved: 'layerRemoved';
2852
+ readonly layerMoved: 'layerMoved';
2853
+ readonly layerShownOrHidden: 'layerShownOrHidden';
2854
+ };
2855
+ private layers;
2856
+ revision: number;
2857
+ get length(): number;
2858
+ get(index: number): ImageryLayer;
2859
+ [Symbol.iterator](): ArrayIterator<ImageryLayer>;
2860
+ add(layer: ImageryLayer, index?: number): ImageryLayer;
2861
+ addImageryProvider(provider: ImageryProvider, index?: number): ImageryLayer;
2862
+ remove(layer: ImageryLayer, destroy?: boolean): boolean;
2863
+ removeAll(destroy?: boolean): void;
2864
+ contains(layer: ImageryLayer): boolean;
2865
+ indexOf(layer: ImageryLayer): number;
2866
+ move(layer: ImageryLayer, index: number): void;
2867
+ raise(layer: ImageryLayer): void;
2868
+ lower(layer: ImageryLayer): void;
2869
+ show(layer: ImageryLayer, value: boolean): void;
2870
+ _update(): void;
2871
+ }
2872
+
2873
+ /**
2874
+ * Defines a member that can have a value or be undefined.
2875
+ */
2876
+ type Undefinable<T> = undefined | T;
2877
+
2878
+ declare enum QuadtreeTileLoadState {
2879
+ /**
2880
+ * The tile is new and loading has not yet begun.
2881
+ */
2882
+ START = 0,
2883
+ /**
2884
+ * Loading is in progress.
2885
+ */
2886
+ LOADING = 1,
2887
+ /**
2888
+ * Loading is complete.
2889
+ */
2890
+ DONE = 2,
2891
+ /**
2892
+ * The tile has failed to load.
2893
+ */
2894
+ FAILED = 3
2895
+ }
2896
+ interface IQuadtreeTileOptions {
2897
+ tilingScheme: GeographicTilingScheme;
2898
+ x: number;
2899
+ y: number;
2900
+ level: number;
2901
+ parent?: QuadtreeTile;
2902
+ }
2903
+ declare class QuadtreeTile {
2904
+ get x(): number;
2905
+ get y(): number;
2906
+ get level(): number;
2907
+ get parent(): Undefinable<QuadtreeTile>;
2908
+ get rectangle(): Rectangle;
2909
+ get tilingScheme(): GeographicTilingScheme;
2910
+ get key(): string;
2911
+ private _tilingScheme;
2912
+ private _x;
2913
+ private _y;
2914
+ private _level;
2915
+ private _parent;
2916
+ private _rectangle;
2917
+ private _southwestChild;
2918
+ private _southeastChild;
2919
+ private _northwestChild;
2920
+ private _northeastChild;
2921
+ replacementPrevious: any;
2922
+ replacementNext: any;
2923
+ state: QuadtreeTileLoadState;
2924
+ constructor(options: IQuadtreeTileOptions);
2925
+ get northwestChild(): QuadtreeTile;
2926
+ get southwestChild(): QuadtreeTile;
2927
+ get southeastChild(): QuadtreeTile;
2928
+ get northeastChild(): QuadtreeTile;
2929
+ get children(): QuadtreeTile[];
2930
+ static createLevelZeroTiles(tilingScheme: GeographicTilingScheme): QuadtreeTile[];
2931
+ }
2932
+
2933
+ interface SurfaceShader {
2934
+ vertex: string;
2935
+ fragment: string;
2936
+ }
2937
+ /** GLSL ES 1.00 source; the host renderer owns compilation and GPU resources. */
2938
+ declare class GlobeSurfaceShaderSet {
2939
+ baseVertexShaderSource: string;
2940
+ baseFragmentShaderSource: string;
2941
+ private cache;
2942
+ getShader(textureCount?: number): SurfaceShader;
2943
+ clear(): void;
2944
+ destroy(): void;
2945
+ }
2946
+
2947
+ interface SurfaceTile {
2948
+ tile: QuadtreeTile;
2949
+ terrain: HeightmapTerrainData;
2950
+ mesh: IGeometry;
2951
+ imagery: Array<{
2952
+ layer: ImageryLayer;
2953
+ image: ImageResource;
2954
+ }>;
2955
+ }
2956
+ interface IGlobeSurfaceTileProviderOption {
2957
+ terrainProvider: TerrainProvider;
2958
+ imageryLayers: ImageryLayerCollection;
2959
+ surfaceShaderSet?: GlobeSurfaceShaderSet;
2960
+ }
2961
+ declare class GlobeSurfaceTileProvider {
2962
+ quadtree?: QuadtreePrimitive;
2963
+ readonly imageryLayers: ImageryLayerCollection;
2964
+ readonly surfaceShaderSet: GlobeSurfaceShaderSet;
2965
+ private terrain;
2966
+ private cache;
2967
+ private pending;
2968
+ private controller;
2969
+ private revision;
2970
+ private generation;
2971
+ private destroyed;
2972
+ constructor(options: IGlobeSurfaceTileProviderOption);
2973
+ get terrainProvider(): TerrainProvider;
2974
+ set terrainProvider(provider: TerrainProvider);
2975
+ get tilingScheme(): GeographicTilingScheme;
2976
+ get ready(): boolean;
2977
+ get tilesLoaded(): boolean;
2978
+ get loadedTiles(): SurfaceTile[];
2979
+ private dispose;
2980
+ invalidate(): void;
2981
+ loadTile(tile: QuadtreeTile): Promise<SurfaceTile>;
2982
+ trimCache(limit: number, keep?: ReadonlySet<string>): void;
2983
+ destroy(): void;
2984
+ }
2985
+
2986
+ interface IQuadtreePrimitiveOption {
2987
+ tileProvider: GlobeSurfaceTileProvider;
2988
+ }
2989
+ interface TileFrameState {
2990
+ maximumConcurrentLoads?: number;
2991
+ maximumLevel?: number;
2992
+ maximumTiles?: number;
2993
+ isVisible?: (tile: QuadtreeTile) => boolean;
2994
+ shouldRefine?: (tile: QuadtreeTile) => boolean;
2995
+ renderTile?: (tile: SurfaceTile) => void;
2996
+ }
2997
+ declare class QuadtreePrimitive {
2998
+ private roots;
2999
+ private selected;
3000
+ tileCacheSize: number;
3001
+ private activeUpdates;
3002
+ get tilesLoaded(): boolean;
3003
+ readonly tileProvider: GlobeSurfaceTileProvider;
3004
+ constructor(options: IQuadtreePrimitiveOption);
3005
+ get tilesToRender(): QuadtreeTile[];
3006
+ reset(): void;
3007
+ selectTilesForRendering(frameState?: TileFrameState): QuadtreeTile[];
3008
+ update(frameState?: TileFrameState): Promise<SurfaceTile[]>;
3009
+ destroy(): void;
3010
+ }
3011
+
3012
+ declare class Globe extends EventHandler<{
3013
+ terrainProviderChanged: TerrainProvider;
3014
+ }> {
3015
+ readonly ellipsoid: Ellipsoid;
3016
+ readonly imageLayers: ImageryLayerCollection;
3017
+ readonly _surfaceShaderSet: GlobeSurfaceShaderSet;
3018
+ readonly _surface: QuadtreePrimitive;
3019
+ constructor(ellipsoid?: Ellipsoid);
3020
+ get imageryLayers(): ImageryLayerCollection;
3021
+ get terrainProvider(): TerrainProvider;
3022
+ set terrainProvider(value: TerrainProvider);
3023
+ get tileCacheSize(): number;
3024
+ set tileCacheSize(value: number);
3025
+ get tilesLoaded(): boolean;
3026
+ update(frameState?: TileFrameState): Promise<SurfaceTile[]>;
3027
+ getHeight(cartographic: Cartographic): number | undefined;
3028
+ /** Ray intersection with the reference ellipsoid (terrain sampling is getHeight). */
3029
+ pick(ray: Ray, _scene?: unknown, result?: Vec3): Vec3 | undefined;
3030
+ destroy(): void;
3031
+ }
3032
+
3033
+ type index_d_Cartographic = Cartographic;
3034
+ declare const index_d_Cartographic: typeof Cartographic;
3035
+ type index_d_DcImageryProvider = DcImageryProvider;
3036
+ declare const index_d_DcImageryProvider: typeof DcImageryProvider;
3037
+ type index_d_DcTerrainProvider = DcTerrainProvider;
3038
+ declare const index_d_DcTerrainProvider: typeof DcTerrainProvider;
3039
+ type index_d_Ellipsoid = Ellipsoid;
3040
+ declare const index_d_Ellipsoid: typeof Ellipsoid;
3041
+ type index_d_EllipsoidGeodesic = EllipsoidGeodesic;
3042
+ declare const index_d_EllipsoidGeodesic: typeof EllipsoidGeodesic;
3043
+ type index_d_EllipsoidTerrainProvider = EllipsoidTerrainProvider;
3044
+ declare const index_d_EllipsoidTerrainProvider: typeof EllipsoidTerrainProvider;
3045
+ type index_d_GVec3 = GVec3;
3046
+ declare const index_d_GVec3: typeof GVec3;
3047
+ type index_d_GeographicTilingScheme = GeographicTilingScheme;
3048
+ declare const index_d_GeographicTilingScheme: typeof GeographicTilingScheme;
3049
+ type index_d_Globe = Globe;
3050
+ declare const index_d_Globe: typeof Globe;
3051
+ type index_d_GlobeSurfaceShaderSet = GlobeSurfaceShaderSet;
3052
+ declare const index_d_GlobeSurfaceShaderSet: typeof GlobeSurfaceShaderSet;
3053
+ type index_d_GlobeSurfaceTileProvider = GlobeSurfaceTileProvider;
3054
+ declare const index_d_GlobeSurfaceTileProvider: typeof GlobeSurfaceTileProvider;
3055
+ type index_d_HeightmapOptions = HeightmapOptions;
3056
+ type index_d_HeightmapTerrainData = HeightmapTerrainData;
3057
+ declare const index_d_HeightmapTerrainData: typeof HeightmapTerrainData;
3058
+ type index_d_IDcTerrainProviderParamters = IDcTerrainProviderParamters;
3059
+ type index_d_IEllipsoidTerrainProviderOprion = IEllipsoidTerrainProviderOprion;
3060
+ type index_d_IGeographicTilingScheme = IGeographicTilingScheme;
3061
+ type index_d_IGlobeSurfaceTileProviderOption = IGlobeSurfaceTileProviderOption;
3062
+ type index_d_IQuadtreePrimitiveOption = IQuadtreePrimitiveOption;
3063
+ type index_d_IQuadtreeTileOptions = IQuadtreeTileOptions;
3064
+ type index_d_ImageLoaderOptions = ImageLoaderOptions;
3065
+ type index_d_ImageResource = ImageResource;
3066
+ type index_d_ImageryLayer = ImageryLayer;
3067
+ declare const index_d_ImageryLayer: typeof ImageryLayer;
3068
+ type index_d_ImageryLayerCollection = ImageryLayerCollection;
3069
+ declare const index_d_ImageryLayerCollection: typeof ImageryLayerCollection;
3070
+ type index_d_ImageryProvider = ImageryProvider;
3071
+ declare const index_d_ImageryProvider: typeof ImageryProvider;
3072
+ type index_d_LayerEvent = LayerEvent;
3073
+ type index_d_QuadtreePrimitive = QuadtreePrimitive;
3074
+ declare const index_d_QuadtreePrimitive: typeof QuadtreePrimitive;
3075
+ type index_d_QuadtreeTile = QuadtreeTile;
3076
+ declare const index_d_QuadtreeTile: typeof QuadtreeTile;
3077
+ type index_d_QuadtreeTileLoadState = QuadtreeTileLoadState;
3078
+ declare const index_d_QuadtreeTileLoadState: typeof QuadtreeTileLoadState;
3079
+ type index_d_Rectangle = Rectangle;
3080
+ declare const index_d_Rectangle: typeof Rectangle;
3081
+ type index_d_SurfaceShader = SurfaceShader;
3082
+ type index_d_SurfaceTile = SurfaceTile;
3083
+ type index_d_TaskExecutor<Input, Output> = TaskExecutor<Input, Output>;
3084
+ type index_d_TaskMessage<Result = unknown> = TaskMessage<Result>;
3085
+ type index_d_TaskProcessor<Input = unknown, Output = unknown> = TaskProcessor<Input, Output>;
3086
+ declare const index_d_TaskProcessor: typeof TaskProcessor;
3087
+ type index_d_TaskWorker = TaskWorker;
3088
+ type index_d_TerrainProvider = TerrainProvider;
3089
+ declare const index_d_TerrainProvider: typeof TerrainProvider;
3090
+ type index_d_TileFrameState = TileFrameState;
3091
+ type index_d_TileRequest = TileRequest;
3092
+ type index_d_UrlTemplateImageryProvider = UrlTemplateImageryProvider;
3093
+ declare const index_d_UrlTemplateImageryProvider: typeof UrlTemplateImageryProvider;
3094
+ type index_d_UrlTemplateOptions = UrlTemplateOptions;
3095
+ declare const index_d_wgs84OneOverRadii: typeof wgs84OneOverRadii;
3096
+ declare const index_d_wgs84OneOverRadiiSquared: typeof wgs84OneOverRadiiSquared;
3097
+ declare const index_d_wgs84Radii: typeof wgs84Radii;
3098
+ declare const index_d_wgs84RadiiSquared: typeof wgs84RadiiSquared;
3099
+ declare namespace index_d {
3100
+ export { index_d_Cartographic as Cartographic, index_d_DcImageryProvider as DcImageryProvider, index_d_DcTerrainProvider as DcTerrainProvider, index_d_Ellipsoid as Ellipsoid, index_d_EllipsoidGeodesic as EllipsoidGeodesic, index_d_EllipsoidTerrainProvider as EllipsoidTerrainProvider, index_d_GVec3 as GVec3, index_d_GeographicTilingScheme as GeographicTilingScheme, index_d_Globe as Globe, index_d_GlobeSurfaceShaderSet as GlobeSurfaceShaderSet, index_d_GlobeSurfaceTileProvider as GlobeSurfaceTileProvider, index_d_HeightmapTerrainData as HeightmapTerrainData, index_d_ImageryLayer as ImageryLayer, index_d_ImageryLayerCollection as ImageryLayerCollection, index_d_ImageryProvider as ImageryProvider, index_d_QuadtreePrimitive as QuadtreePrimitive, index_d_QuadtreeTile as QuadtreeTile, index_d_QuadtreeTileLoadState as QuadtreeTileLoadState, index_d_Rectangle as Rectangle, index_d_TaskProcessor as TaskProcessor, index_d_TerrainProvider as TerrainProvider, index_d_UrlTemplateImageryProvider as UrlTemplateImageryProvider, index_d_wgs84OneOverRadii as wgs84OneOverRadii, index_d_wgs84OneOverRadiiSquared as wgs84OneOverRadiiSquared, index_d_wgs84Radii as wgs84Radii, index_d_wgs84RadiiSquared as wgs84RadiiSquared };
3101
+ export type { index_d_HeightmapOptions as HeightmapOptions, index_d_IDcTerrainProviderParamters as IDcTerrainProviderParamters, index_d_IEllipsoidTerrainProviderOprion as IEllipsoidTerrainProviderOprion, index_d_IGeographicTilingScheme as IGeographicTilingScheme, index_d_IGlobeSurfaceTileProviderOption as IGlobeSurfaceTileProviderOption, index_d_IQuadtreePrimitiveOption as IQuadtreePrimitiveOption, index_d_IQuadtreeTileOptions as IQuadtreeTileOptions, index_d_ImageLoaderOptions as ImageLoaderOptions, index_d_ImageResource as ImageResource, index_d_LayerEvent as LayerEvent, index_d_SurfaceShader as SurfaceShader, index_d_SurfaceTile as SurfaceTile, index_d_TaskExecutor as TaskExecutor, index_d_TaskMessage as TaskMessage, index_d_TaskWorker as TaskWorker, index_d_TileFrameState as TileFrameState, index_d_TileRequest as TileRequest, index_d_UrlTemplateOptions as UrlTemplateOptions };
3102
+ }
3103
+
3104
+ interface CatmullRomOptions {
3105
+ closed?: boolean;
3106
+ alpha?: number;
3107
+ }
3108
+ declare class Curve {
3109
+ /** Barry-Goldman interpolation; alpha=0 uniform, .5 centripetal, 1 chordal. */
3110
+ static catmullRom(points: readonly Vec3[], t: number, options?: CatmullRomOptions): Vec3;
3111
+ /** @deprecated Historical spelling. */
3112
+ static cutmull(points: readonly Vec3[], t: number, options?: CatmullRomOptions): Vec3;
3113
+ static sample(points: readonly Vec3[], segments?: number, options?: CatmullRomOptions): Vec3[];
3114
+ }
3115
+
3116
+ declare function splitPlaneGeometry(plane: Plane$1, geometry: BufferGeometry, options?: MeshSplitOptions): {
3117
+ positive: BufferGeometry;
3118
+ negative: BufferGeometry;
3119
+ common: BufferGeometry;
3120
+ };
3121
+
3122
+ declare class Shape<T extends Vec3 = Vec3> extends Polygon$1<T> {
3123
+ readonly kind: GeometryKind;
3124
+ holes: T[][];
3125
+ constructor(points?: T[], holes?: T[][], normal?: Vec3);
3126
+ triangulate(): number[];
3127
+ toGeometry(): IGeometry;
3128
+ toBufferGeometry(): BufferGeometry;
3129
+ clone(): this;
3130
+ copy(source: Shape<T>): this;
3131
+ containPoint(point: Vec3, tolerance?: number): boolean;
3132
+ queryCompound(other: GeometryQuery<any>, options?: CurvedQueryOptions): DistanceResult;
3133
+ private queryTriangles;
3134
+ distancePoint(point: Vec3): DistanceResult;
3135
+ toJSON(): GeometryData;
3136
+ }
3137
+
3138
+ /** @deprecated Use ArrayList for new collections. Native array behavior is retained. */
3139
+ declare class ArrayObject<T = any> extends Array<T> {
3140
+ static get [Symbol.species](): ArrayConstructor;
3141
+ get(index: number): T | undefined;
3142
+ get first(): T;
3143
+ get last(): T | undefined;
3144
+ forall(callback: (value: T) => void): void;
3145
+ clone(): ArrayObject<T>;
3146
+ classify(predicate: (value: T, representative: T, group: T[]) => boolean): T[][];
3147
+ unique(equal: (a: T, b: T) => boolean, compare?: (a: T, b: T) => number): this;
3148
+ }
3149
+
3150
+ /** Object-oriented facade over the maintained sweep implementation. */
3151
+ declare class Extrude {
3152
+ options: IExtrudeOptionsEx;
3153
+ constructor(options: IExtrudeOptionsEx);
3154
+ toGeometry(): IGeometry;
3155
+ toBufferGeometry(): BufferGeometry;
3156
+ }
3157
+
3158
+ /** Compose unordered segments into oriented chains, preserving all input objects. */
3159
+ declare function compose(segments: readonly Segment[], tolerance?: number): Segment[][];
3160
+
3161
+ declare class DelaunaySlow {
3162
+ private vs?;
3163
+ constructor(vs?: Vec3[] | undefined);
3164
+ supertriangle(vertices: Vec3[]): Vec3[];
3165
+ triangulation(vs: Vec3[]): number[];
3166
+ /**
3167
+ * 外接圆
3168
+ * @param vertices 点击
3169
+ * @param i
3170
+ * @param j
3171
+ * @param k
3172
+ */
3173
+ circumcircle(vertices: Vec3[], i: number, j: number, k: number): Circle;
3174
+ dedup(edges: any[]): void;
3175
+ contains(tri: Vec3[], p: Vec3): number[] | null;
3176
+ }
3177
+
3178
+ export { ArrayObject, BSP$1 as BSP, BTree, Box, BufferAttribute, BufferGeometry, index_d$2 as CSG, Capsule, Circle, ClipType, Color, ConvexHull, Curve, DEGREES_PER_RADIAN, Delaunator, Delaunay, DelaunaySlow, Disk, Distance, EndType, Euler, EventHandler, Extrude, Float32BufferAttribute, Float64BufferAttribute, Frustum, index_d as GIS, HVec3, index_d$1 as IK, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectType, JoinType, KdTree, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, Orientation, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane$1 as Plane, Point, PolyTree, Polygon$1 as Polygon, Polyline, QuadTree, Quat, QuadTree as QuatTree, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Rectangle$1 as Rectangle, index_d$3 as Robust, Segment, Shape, Sphere, THREE_PI_OVER_TWO, ToDegrees, Tree, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, calculateVolume, ceilPowerOfTwo, circle, circleDistance, clamp, classify, cleanPolygon, clipPolygons, clone, closestPair, compose, convexHull, convexHull3D, delta4, delta5, delta6, delta7, delta8, delta9, disk, diskDistance, distance, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, geometryFromJSON, intersects, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, offsetPaths, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, simplifyPolygon, smootherstep, smoothstep, splitPlaneGeometry, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
3179
+ export type { AxisPlane, CatmullRomOptions, ConvexHull3DResult, CurvedQueryOptions, DistanceParameter, DistanceResult, EventListener, GeometryData, GeometryKind, GeometryQuery, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, IHVec2, IHVec3, IHVec4, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, IntersectResult, MeshSplitOptions, PolyNode };