@xort/cga 0.1.1 → 0.1.3

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,3 @@
1
- import Decimal from 'decimal.js';
2
-
3
1
  declare class Quat {
4
2
  _x: number;
5
3
  _y: number;
@@ -572,9 +570,6 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
572
570
  distanceSegment(segment: Segment): DistanceResult;
573
571
  distancePlane(plane: Plane$1): DistanceResult;
574
572
  intersectSegment(segment: Segment, tolerance?: number): {
575
- colinear: boolean;
576
- intersected: boolean;
577
- points: Vec3[];
578
573
  errorBound?: number;
579
574
  iterations?: number;
580
575
  rayParameter?: number;
@@ -591,6 +586,9 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
591
586
  signedDistance?: number;
592
587
  segmentIndex?: number;
593
588
  diskClosest?: Vec3;
589
+ colinear: boolean;
590
+ intersected: boolean;
591
+ points: Vec3[];
594
592
  };
595
593
  distancePoint(point: Vec3): DistanceResult;
596
594
  distanceLine(line: Line): DistanceResult;
@@ -924,11 +922,11 @@ declare class Plane$1 implements GeometryQuery<Plane$1> {
924
922
  intersectLine(line: Line, result?: Vec3): Vec3 | undefined;
925
923
  intersectRay(ray: Ray, result?: Vec3): Vec3 | undefined;
926
924
  splitSegment(segment: Segment | Vec3[]): {
927
- intersectPoint: Vec3 | undefined;
928
925
  negative: Vec3[];
929
926
  positive: Vec3[];
930
927
  common: Vec3[];
931
928
  orientation: Orientation;
929
+ intersectPoint: Vec3 | undefined;
932
930
  };
933
931
  splitTriangle(triangle: Triangle | Vec3[], tolerance?: number): ISplitResult;
934
932
  /** Ordered polygons on either side; cut vertices are included in both. */
@@ -1278,7 +1276,7 @@ declare class Vec3 implements IVec3 {
1278
1276
  distanceCapsule(capsule: Capsule): DistanceResult;
1279
1277
  distanceSphere(sphere: Sphere): DistanceResult;
1280
1278
  distanceBox(box: Box): DistanceResult;
1281
- readonly kind: "Point";
1279
+ readonly kind: 'Point';
1282
1280
  toJSON(): GeometryData;
1283
1281
  }
1284
1282
  declare function v3(x?: number, y?: number, z?: number): Vec3;
@@ -1501,7 +1499,7 @@ declare const DEGREES_PER_RADIAN: number;
1501
1499
  * @constant
1502
1500
  */
1503
1501
  declare const RADIANS_PER_ARCSECOND: number;
1504
- declare function sign(value: number): 1 | -1;
1502
+ declare function sign(value: number): -1 | 1;
1505
1503
  declare function approximateEqual(v1: number, v2: number, precision?: number): boolean;
1506
1504
  declare function clamp(value: number, min: number, max: number): number;
1507
1505
  declare function lerp(x: number, y: number, t: number): number;
@@ -1524,23 +1522,19 @@ declare function ToDegrees(radians: number): number;
1524
1522
  * @param {Object} obj 数字或者向量
1525
1523
  * @param {*} fractionDigits
1526
1524
  */
1527
- declare function toFixed(obj: {
1528
- toFixed: (arg0: any) => string;
1529
- x: number | undefined;
1530
- y: number | undefined;
1531
- z: number | undefined;
1532
- }, fractionDigits: number | undefined): number | {
1533
- toFixed: (arg0: any) => string;
1534
- x: number | undefined;
1535
- y: number | undefined;
1536
- z: number | undefined;
1537
- };
1525
+ declare function toFixed(obj: number, fractionDigits?: number): number;
1526
+ declare function toFixed<T extends {
1527
+ x?: number;
1528
+ y?: number;
1529
+ z?: number;
1530
+ w?: number;
1531
+ }>(obj: T, fractionDigits?: number): T;
1538
1532
  /**
1539
1533
  * 数组中所有数字或者向量固定位数
1540
1534
  * @param {Array} array
1541
1535
  * @param {Number} precision
1542
1536
  */
1543
- declare function toFixedAry(array: Array<any>, precision?: number): void;
1537
+ declare function toFixedAry(array: Array<any>, precision?: number): any[];
1544
1538
 
1545
1539
  /**
1546
1540
  * 遍历多级数组中所有对象
@@ -1558,7 +1552,7 @@ declare function flat(array: any[]): any[];
1558
1552
  * @param {Array} array
1559
1553
  * @param {Function} classifyMethod 分类方法
1560
1554
  */
1561
- declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any;
1555
+ declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any[][];
1562
1556
  /**
1563
1557
  * 去掉重复元素
1564
1558
  * @param {Array} array
@@ -1587,6 +1581,8 @@ declare class Color {
1587
1581
  setHexCssString(style: string): this | undefined;
1588
1582
  setRGB(r: number, g: number, b: number, a?: number): this;
1589
1583
  clone(): any;
1584
+ lerp(other: Color, t: number): this;
1585
+ getHex(): number;
1590
1586
  copy(color: this): this;
1591
1587
  equals(c: this): boolean;
1592
1588
  toArray(array?: number[], offset?: number): number[];
@@ -1715,7 +1711,7 @@ declare class vecs {
1715
1711
  * @returns {Array<Number>} 数字数组
1716
1712
  */
1717
1713
  static verctorToNumbers(vectors: Array<Vec4 | Vec3 | Vec2 | any> | any, comSort?: string): number[];
1718
- static vec(component?: number): Vec3 | Vec2 | Vec4;
1714
+ static vec(component?: number): Vec2 | Vec3 | Vec4;
1719
1715
  /**
1720
1716
  * 数字数组 转 适量数组
1721
1717
  * @param vss 数字数组
@@ -1958,7 +1954,7 @@ interface ITriangulationOption {
1958
1954
  normal?: Vec3;
1959
1955
  }
1960
1956
  /**
1961
- * 三角剖分 earcut.js
1957
+ * 自有 TypeScript 三角剖分:耳切法与可见桥孔洞连接。
1962
1958
  * @param {Array} boundary 边界
1963
1959
  * @param {Array<Array>} holes 洞的数组
1964
1960
  * @param {options:{feature,dim,normal}} feature 选择平平面
@@ -2131,12 +2127,14 @@ declare class Frustum {
2131
2127
  */
2132
2128
  setFromProjectionMatrix(m: Mat4): this;
2133
2129
  static fromProjectionMatrix(m: Mat4): Frustum;
2134
- setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): void;
2130
+ /** fov is the vertical field of view in radians. OpenGL depth range [-1, 1]. */
2131
+ setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): this;
2135
2132
  intersectsObject(geometry: BufferGeometry, mat: Mat4): boolean;
2136
2133
  intersectsSphere(sphere: Sphere): boolean;
2137
2134
  intersectsSphereComponents(cx: number, cy: number, cz: number, radius: number): boolean;
2138
2135
  containsPoint(point: Vec3): boolean;
2139
- intersectSegment(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
2136
+ /** Clip a segment against all six half spaces. Returns independent endpoints, or null. */
2137
+ intersectSegment(segment: Segment | Vec3[]): Vec3[] | null;
2140
2138
  simpleIntersectVS(vs: Vec3[]): Vec3[];
2141
2139
  copy(frustum: Frustum): this;
2142
2140
  clone(): any;
@@ -2272,7 +2270,10 @@ declare class QuadTree extends Tree<Vec3> {
2272
2270
  nearest(point: Vec3, count?: number): Vec3[];
2273
2271
  }
2274
2272
 
2273
+ /** Even-odd Boolean clipping, including self intersections, holes and shared edges.
2274
+ * Project-owned TypeScript arrangement, O(E²) edge intersection phase. */
2275
2275
  declare function clipPolygons(subject: Vec3[][], clip: Vec3[][], operation?: 'intersection' | 'union' | 'difference' | 'xor', normal?: Vec3, scale?: number): Vec3[][];
2276
+ /** Offset with miter/square/round joins. Round arcs use at most 7.5° steps. */
2276
2277
  declare function offsetPaths(rings: Vec3[][], delta: number, normal?: Vec3, join?: number, end?: number, miterLimit?: number, scale?: number): Vec3[][];
2277
2278
  declare function cleanPolygon(points: Vec3[], tolerance?: number, normal?: Vec3): Vec3[];
2278
2279
  declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
@@ -2280,6 +2281,72 @@ declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
2280
2281
  /** Restore owned geometry from plain data. Never trusts a serialized prototype. */
2281
2282
  declare function geometryFromJSON(data: GeometryData): GeometryQuery<any>;
2282
2283
 
2284
+ /** Decimal arithmetic owned by cga.js: signed BigInt coefficient × 10^exponent. */
2285
+ type DecimalValue = Decimal | string | number | bigint | {
2286
+ toString(): string;
2287
+ };
2288
+ interface DecimalConfig {
2289
+ precision?: number;
2290
+ /** 0 up, 1 down, 2 ceil, 3 floor, 4 half-up, 5 half-down,
2291
+ * 6 half-even, 7 half-ceil, 8 half-floor. */
2292
+ rounding?: number;
2293
+ }
2294
+ /** Finite decimal subset used by HVec3, Robust and CSG.
2295
+ * Constructors preserve input digits; arithmetic rounds to configured significant digits.
2296
+ * Instances are immutable. Unsupported/non-finite inputs and division by zero throw.
2297
+ */
2298
+ declare class Decimal {
2299
+ static precision: number;
2300
+ static rounding: number;
2301
+ static readonly ROUND_UP = 0;
2302
+ static readonly ROUND_DOWN = 1;
2303
+ static readonly ROUND_CEIL = 2;
2304
+ static readonly ROUND_FLOOR = 3;
2305
+ static readonly ROUND_HALF_UP = 4;
2306
+ static readonly ROUND_HALF_DOWN = 5;
2307
+ static readonly ROUND_HALF_EVEN = 6;
2308
+ static readonly ROUND_HALF_CEIL = 7;
2309
+ static readonly ROUND_HALF_FLOOR = 8;
2310
+ private coefficient;
2311
+ private exponent;
2312
+ constructor(value?: DecimalValue);
2313
+ static set(config: DecimalConfig): typeof Decimal;
2314
+ static config(config: DecimalConfig): typeof Decimal;
2315
+ static isDecimal(value: unknown): value is Decimal;
2316
+ private normalize;
2317
+ private static make;
2318
+ add(value: DecimalValue): Decimal;
2319
+ plus(value: DecimalValue): Decimal;
2320
+ sub(value: DecimalValue): Decimal;
2321
+ minus(value: DecimalValue): Decimal;
2322
+ mul(value: DecimalValue): Decimal;
2323
+ times(value: DecimalValue): Decimal;
2324
+ div(value: DecimalValue): Decimal;
2325
+ dividedBy(value: DecimalValue): Decimal;
2326
+ sqrt(): Decimal;
2327
+ negated(): Decimal;
2328
+ neg(): Decimal;
2329
+ abs(): Decimal;
2330
+ comparedTo(value: DecimalValue): number;
2331
+ cmp(value: DecimalValue): number;
2332
+ eq(value: DecimalValue): boolean;
2333
+ equals(value: DecimalValue): boolean;
2334
+ lt(value: DecimalValue): boolean;
2335
+ lte(value: DecimalValue): boolean;
2336
+ gt(value: DecimalValue): boolean;
2337
+ gte(value: DecimalValue): boolean;
2338
+ isZero(): boolean;
2339
+ isNegative(): boolean;
2340
+ isPositive(): boolean;
2341
+ isFinite(): boolean;
2342
+ isNaN(): boolean;
2343
+ toNumber(): number;
2344
+ toString(): string;
2345
+ toFixed(decimalPlaces?: number, rounding?: number): string;
2346
+ toJSON(): string;
2347
+ valueOf(): string;
2348
+ }
2349
+
2283
2350
  interface IHVec2 {
2284
2351
  x: Decimal;
2285
2352
  y: Decimal;
@@ -2295,7 +2362,7 @@ declare class HVec3 implements IHVec3 {
2295
2362
  x: Decimal;
2296
2363
  y: Decimal;
2297
2364
  z: Decimal;
2298
- constructor(x?: Decimal.Value, y?: Decimal.Value, z?: Decimal.Value);
2365
+ constructor(x?: DecimalValue, y?: DecimalValue, z?: DecimalValue);
2299
2366
  static isVec3(v: unknown): v is IHVec3;
2300
2367
  get isVec3(): boolean;
2301
2368
  static get Up(): HVec3;
@@ -2303,9 +2370,9 @@ declare class HVec3 implements IHVec3 {
2303
2370
  static get UnitX(): HVec3;
2304
2371
  static get UnitY(): HVec3;
2305
2372
  static get UnitZ(): HVec3;
2306
- set(x: Decimal.Value, y: Decimal.Value, z: Decimal.Value): this;
2307
- setScalar(s: Decimal.Value): this;
2308
- setComponent(index: number, value: Decimal.Value): this;
2373
+ set(x: DecimalValue, y: DecimalValue, z: DecimalValue): this;
2374
+ setScalar(s: DecimalValue): this;
2375
+ setComponent(index: number, value: DecimalValue): this;
2309
2376
  getComponent(index: number): Decimal;
2310
2377
  copy(v: IHVec3): this;
2311
2378
  clone(): HVec3;
@@ -2313,15 +2380,15 @@ declare class HVec3 implements IHVec3 {
2313
2380
  addVecs(a: IHVec3, b: IHVec3): this;
2314
2381
  sub(v: IHVec3, w?: IHVec3): this;
2315
2382
  subVecs(a: IHVec3, b: IHVec3): this;
2316
- multiplyScalar(s: Decimal.Value): this;
2317
- divideScalar(s: Decimal.Value): this;
2383
+ multiplyScalar(s: DecimalValue): this;
2384
+ divideScalar(s: DecimalValue): this;
2318
2385
  cross(v: IHVec3, w?: IHVec3): this;
2319
2386
  crossVecs(a: IHVec3, b: IHVec3): this;
2320
2387
  dot(v: IHVec3): Decimal;
2321
2388
  lengthSq(): Decimal;
2322
2389
  length(): Decimal;
2323
2390
  normalize(): this;
2324
- lerp(v: IHVec3, alpha: Decimal.Value): this;
2391
+ lerp(v: IHVec3, alpha: DecimalValue): this;
2325
2392
  distanceTo(v: IHVec3): Decimal;
2326
2393
  equals(v: IHVec3): boolean;
2327
2394
  toArray(): Decimal[];
@@ -2330,7 +2397,7 @@ declare class HVec3 implements IHVec3 {
2330
2397
 
2331
2398
  declare class Vec {
2332
2399
  _data: Decimal[];
2333
- constructor(...values: Decimal.Value[]);
2400
+ constructor(...values: DecimalValue[]);
2334
2401
  get dim(): number;
2335
2402
  check(v: Vec): boolean;
2336
2403
  private requireDimension;
@@ -2338,7 +2405,7 @@ declare class Vec {
2338
2405
  clone(): Vec;
2339
2406
  add(v: Vec): this;
2340
2407
  sub(v: Vec): this;
2341
- multiplyScalar(s: Decimal.Value): this;
2408
+ multiplyScalar(s: DecimalValue): this;
2342
2409
  cross(v: Vec): this;
2343
2410
  get extentSq(): Decimal;
2344
2411
  get extent(): Decimal;
@@ -2383,7 +2450,7 @@ declare class Polygon {
2383
2450
  normal: HVec3;
2384
2451
  vertices: HVec3[];
2385
2452
  readonly epsilon: Decimal;
2386
- constructor(vertices?: readonly HVec3[], epsilon?: Decimal.Value);
2453
+ constructor(vertices?: readonly HVec3[], epsilon?: DecimalValue);
2387
2454
  calcPlane(): this;
2388
2455
  flip(): this;
2389
2456
  classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
@@ -2636,7 +2703,7 @@ declare class Rectangle {
2636
2703
  southeast(result?: Cartographic): Cartographic;
2637
2704
  }
2638
2705
 
2639
- /** Karney geodesics via GeographicLib; antipodal inputs are supported. */
2706
+ /** Internal TypeScript Karney geodesics; antipodal inputs are supported. */
2640
2707
  declare class EllipsoidGeodesic {
2641
2708
  ellipsoid: Ellipsoid;
2642
2709
  start: Cartographic;
@@ -2844,10 +2911,10 @@ interface LayerEvents {
2844
2911
  }
2845
2912
  declare class ImageryLayerCollection extends EventHandler<LayerEvents> {
2846
2913
  static readonly EventType: {
2847
- readonly layerAdded: "layerAdded";
2848
- readonly layerRemoved: "layerRemoved";
2849
- readonly layerMoved: "layerMoved";
2850
- readonly layerShownOrHidden: "layerShownOrHidden";
2914
+ readonly layerAdded: 'layerAdded';
2915
+ readonly layerRemoved: 'layerRemoved';
2916
+ readonly layerMoved: 'layerMoved';
2917
+ readonly layerShownOrHidden: 'layerShownOrHidden';
2851
2918
  };
2852
2919
  private layers;
2853
2920
  revision: number;
@@ -3172,5 +3239,5 @@ declare class DelaunaySlow {
3172
3239
  contains(tri: Vec3[], p: Vec3): number[] | null;
3173
3240
  }
3174
3241
 
3175
- 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 };
3176
- 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 };
3242
+ export { ArrayObject, BSP$1 as BSP, BTree, Box, BufferAttribute, BufferGeometry, index_d$2 as CSG, Capsule, Circle, ClipType, Color, ConvexHull, Curve, DEGREES_PER_RADIAN, Decimal, 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 };
3243
+ export type { AxisPlane, CatmullRomOptions, ConvexHull3DResult, CurvedQueryOptions, DecimalConfig, DecimalValue, DistanceParameter, DistanceResult, EventListener, GeometryData, GeometryKind, GeometryQuery, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, IHVec2, IHVec3, IHVec4, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, IntersectResult, MeshSplitOptions, PolyNode };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import Decimal from 'decimal.js';
2
-
3
1
  declare class Quat {
4
2
  _x: number;
5
3
  _y: number;
@@ -572,9 +570,6 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
572
570
  distanceSegment(segment: Segment): DistanceResult;
573
571
  distancePlane(plane: Plane$1): DistanceResult;
574
572
  intersectSegment(segment: Segment, tolerance?: number): {
575
- colinear: boolean;
576
- intersected: boolean;
577
- points: Vec3[];
578
573
  errorBound?: number;
579
574
  iterations?: number;
580
575
  rayParameter?: number;
@@ -591,6 +586,9 @@ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
591
586
  signedDistance?: number;
592
587
  segmentIndex?: number;
593
588
  diskClosest?: Vec3;
589
+ colinear: boolean;
590
+ intersected: boolean;
591
+ points: Vec3[];
594
592
  };
595
593
  distancePoint(point: Vec3): DistanceResult;
596
594
  distanceLine(line: Line): DistanceResult;
@@ -924,11 +922,11 @@ declare class Plane$1 implements GeometryQuery<Plane$1> {
924
922
  intersectLine(line: Line, result?: Vec3): Vec3 | undefined;
925
923
  intersectRay(ray: Ray, result?: Vec3): Vec3 | undefined;
926
924
  splitSegment(segment: Segment | Vec3[]): {
927
- intersectPoint: Vec3 | undefined;
928
925
  negative: Vec3[];
929
926
  positive: Vec3[];
930
927
  common: Vec3[];
931
928
  orientation: Orientation;
929
+ intersectPoint: Vec3 | undefined;
932
930
  };
933
931
  splitTriangle(triangle: Triangle | Vec3[], tolerance?: number): ISplitResult;
934
932
  /** Ordered polygons on either side; cut vertices are included in both. */
@@ -1278,7 +1276,7 @@ declare class Vec3 implements IVec3 {
1278
1276
  distanceCapsule(capsule: Capsule): DistanceResult;
1279
1277
  distanceSphere(sphere: Sphere): DistanceResult;
1280
1278
  distanceBox(box: Box): DistanceResult;
1281
- readonly kind: "Point";
1279
+ readonly kind: 'Point';
1282
1280
  toJSON(): GeometryData;
1283
1281
  }
1284
1282
  declare function v3(x?: number, y?: number, z?: number): Vec3;
@@ -1501,7 +1499,7 @@ declare const DEGREES_PER_RADIAN: number;
1501
1499
  * @constant
1502
1500
  */
1503
1501
  declare const RADIANS_PER_ARCSECOND: number;
1504
- declare function sign(value: number): 1 | -1;
1502
+ declare function sign(value: number): -1 | 1;
1505
1503
  declare function approximateEqual(v1: number, v2: number, precision?: number): boolean;
1506
1504
  declare function clamp(value: number, min: number, max: number): number;
1507
1505
  declare function lerp(x: number, y: number, t: number): number;
@@ -1524,23 +1522,19 @@ declare function ToDegrees(radians: number): number;
1524
1522
  * @param {Object} obj 数字或者向量
1525
1523
  * @param {*} fractionDigits
1526
1524
  */
1527
- declare function toFixed(obj: {
1528
- toFixed: (arg0: any) => string;
1529
- x: number | undefined;
1530
- y: number | undefined;
1531
- z: number | undefined;
1532
- }, fractionDigits: number | undefined): number | {
1533
- toFixed: (arg0: any) => string;
1534
- x: number | undefined;
1535
- y: number | undefined;
1536
- z: number | undefined;
1537
- };
1525
+ declare function toFixed(obj: number, fractionDigits?: number): number;
1526
+ declare function toFixed<T extends {
1527
+ x?: number;
1528
+ y?: number;
1529
+ z?: number;
1530
+ w?: number;
1531
+ }>(obj: T, fractionDigits?: number): T;
1538
1532
  /**
1539
1533
  * 数组中所有数字或者向量固定位数
1540
1534
  * @param {Array} array
1541
1535
  * @param {Number} precision
1542
1536
  */
1543
- declare function toFixedAry(array: Array<any>, precision?: number): void;
1537
+ declare function toFixedAry(array: Array<any>, precision?: number): any[];
1544
1538
 
1545
1539
  /**
1546
1540
  * 遍历多级数组中所有对象
@@ -1558,7 +1552,7 @@ declare function flat(array: any[]): any[];
1558
1552
  * @param {Array} array
1559
1553
  * @param {Function} classifyMethod 分类方法
1560
1554
  */
1561
- declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any;
1555
+ declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any[][];
1562
1556
  /**
1563
1557
  * 去掉重复元素
1564
1558
  * @param {Array} array
@@ -1587,6 +1581,8 @@ declare class Color {
1587
1581
  setHexCssString(style: string): this | undefined;
1588
1582
  setRGB(r: number, g: number, b: number, a?: number): this;
1589
1583
  clone(): any;
1584
+ lerp(other: Color, t: number): this;
1585
+ getHex(): number;
1590
1586
  copy(color: this): this;
1591
1587
  equals(c: this): boolean;
1592
1588
  toArray(array?: number[], offset?: number): number[];
@@ -1715,7 +1711,7 @@ declare class vecs {
1715
1711
  * @returns {Array<Number>} 数字数组
1716
1712
  */
1717
1713
  static verctorToNumbers(vectors: Array<Vec4 | Vec3 | Vec2 | any> | any, comSort?: string): number[];
1718
- static vec(component?: number): Vec3 | Vec2 | Vec4;
1714
+ static vec(component?: number): Vec2 | Vec3 | Vec4;
1719
1715
  /**
1720
1716
  * 数字数组 转 适量数组
1721
1717
  * @param vss 数字数组
@@ -1958,7 +1954,7 @@ interface ITriangulationOption {
1958
1954
  normal?: Vec3;
1959
1955
  }
1960
1956
  /**
1961
- * 三角剖分 earcut.js
1957
+ * 自有 TypeScript 三角剖分:耳切法与可见桥孔洞连接。
1962
1958
  * @param {Array} boundary 边界
1963
1959
  * @param {Array<Array>} holes 洞的数组
1964
1960
  * @param {options:{feature,dim,normal}} feature 选择平平面
@@ -2131,12 +2127,14 @@ declare class Frustum {
2131
2127
  */
2132
2128
  setFromProjectionMatrix(m: Mat4): this;
2133
2129
  static fromProjectionMatrix(m: Mat4): Frustum;
2134
- setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): void;
2130
+ /** fov is the vertical field of view in radians. OpenGL depth range [-1, 1]. */
2131
+ setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): this;
2135
2132
  intersectsObject(geometry: BufferGeometry, mat: Mat4): boolean;
2136
2133
  intersectsSphere(sphere: Sphere): boolean;
2137
2134
  intersectsSphereComponents(cx: number, cy: number, cz: number, radius: number): boolean;
2138
2135
  containsPoint(point: Vec3): boolean;
2139
- intersectSegment(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
2136
+ /** Clip a segment against all six half spaces. Returns independent endpoints, or null. */
2137
+ intersectSegment(segment: Segment | Vec3[]): Vec3[] | null;
2140
2138
  simpleIntersectVS(vs: Vec3[]): Vec3[];
2141
2139
  copy(frustum: Frustum): this;
2142
2140
  clone(): any;
@@ -2272,7 +2270,10 @@ declare class QuadTree extends Tree<Vec3> {
2272
2270
  nearest(point: Vec3, count?: number): Vec3[];
2273
2271
  }
2274
2272
 
2273
+ /** Even-odd Boolean clipping, including self intersections, holes and shared edges.
2274
+ * Project-owned TypeScript arrangement, O(E²) edge intersection phase. */
2275
2275
  declare function clipPolygons(subject: Vec3[][], clip: Vec3[][], operation?: 'intersection' | 'union' | 'difference' | 'xor', normal?: Vec3, scale?: number): Vec3[][];
2276
+ /** Offset with miter/square/round joins. Round arcs use at most 7.5° steps. */
2276
2277
  declare function offsetPaths(rings: Vec3[][], delta: number, normal?: Vec3, join?: number, end?: number, miterLimit?: number, scale?: number): Vec3[][];
2277
2278
  declare function cleanPolygon(points: Vec3[], tolerance?: number, normal?: Vec3): Vec3[];
2278
2279
  declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
@@ -2280,6 +2281,72 @@ declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
2280
2281
  /** Restore owned geometry from plain data. Never trusts a serialized prototype. */
2281
2282
  declare function geometryFromJSON(data: GeometryData): GeometryQuery<any>;
2282
2283
 
2284
+ /** Decimal arithmetic owned by cga.js: signed BigInt coefficient × 10^exponent. */
2285
+ type DecimalValue = Decimal | string | number | bigint | {
2286
+ toString(): string;
2287
+ };
2288
+ interface DecimalConfig {
2289
+ precision?: number;
2290
+ /** 0 up, 1 down, 2 ceil, 3 floor, 4 half-up, 5 half-down,
2291
+ * 6 half-even, 7 half-ceil, 8 half-floor. */
2292
+ rounding?: number;
2293
+ }
2294
+ /** Finite decimal subset used by HVec3, Robust and CSG.
2295
+ * Constructors preserve input digits; arithmetic rounds to configured significant digits.
2296
+ * Instances are immutable. Unsupported/non-finite inputs and division by zero throw.
2297
+ */
2298
+ declare class Decimal {
2299
+ static precision: number;
2300
+ static rounding: number;
2301
+ static readonly ROUND_UP = 0;
2302
+ static readonly ROUND_DOWN = 1;
2303
+ static readonly ROUND_CEIL = 2;
2304
+ static readonly ROUND_FLOOR = 3;
2305
+ static readonly ROUND_HALF_UP = 4;
2306
+ static readonly ROUND_HALF_DOWN = 5;
2307
+ static readonly ROUND_HALF_EVEN = 6;
2308
+ static readonly ROUND_HALF_CEIL = 7;
2309
+ static readonly ROUND_HALF_FLOOR = 8;
2310
+ private coefficient;
2311
+ private exponent;
2312
+ constructor(value?: DecimalValue);
2313
+ static set(config: DecimalConfig): typeof Decimal;
2314
+ static config(config: DecimalConfig): typeof Decimal;
2315
+ static isDecimal(value: unknown): value is Decimal;
2316
+ private normalize;
2317
+ private static make;
2318
+ add(value: DecimalValue): Decimal;
2319
+ plus(value: DecimalValue): Decimal;
2320
+ sub(value: DecimalValue): Decimal;
2321
+ minus(value: DecimalValue): Decimal;
2322
+ mul(value: DecimalValue): Decimal;
2323
+ times(value: DecimalValue): Decimal;
2324
+ div(value: DecimalValue): Decimal;
2325
+ dividedBy(value: DecimalValue): Decimal;
2326
+ sqrt(): Decimal;
2327
+ negated(): Decimal;
2328
+ neg(): Decimal;
2329
+ abs(): Decimal;
2330
+ comparedTo(value: DecimalValue): number;
2331
+ cmp(value: DecimalValue): number;
2332
+ eq(value: DecimalValue): boolean;
2333
+ equals(value: DecimalValue): boolean;
2334
+ lt(value: DecimalValue): boolean;
2335
+ lte(value: DecimalValue): boolean;
2336
+ gt(value: DecimalValue): boolean;
2337
+ gte(value: DecimalValue): boolean;
2338
+ isZero(): boolean;
2339
+ isNegative(): boolean;
2340
+ isPositive(): boolean;
2341
+ isFinite(): boolean;
2342
+ isNaN(): boolean;
2343
+ toNumber(): number;
2344
+ toString(): string;
2345
+ toFixed(decimalPlaces?: number, rounding?: number): string;
2346
+ toJSON(): string;
2347
+ valueOf(): string;
2348
+ }
2349
+
2283
2350
  interface IHVec2 {
2284
2351
  x: Decimal;
2285
2352
  y: Decimal;
@@ -2295,7 +2362,7 @@ declare class HVec3 implements IHVec3 {
2295
2362
  x: Decimal;
2296
2363
  y: Decimal;
2297
2364
  z: Decimal;
2298
- constructor(x?: Decimal.Value, y?: Decimal.Value, z?: Decimal.Value);
2365
+ constructor(x?: DecimalValue, y?: DecimalValue, z?: DecimalValue);
2299
2366
  static isVec3(v: unknown): v is IHVec3;
2300
2367
  get isVec3(): boolean;
2301
2368
  static get Up(): HVec3;
@@ -2303,9 +2370,9 @@ declare class HVec3 implements IHVec3 {
2303
2370
  static get UnitX(): HVec3;
2304
2371
  static get UnitY(): HVec3;
2305
2372
  static get UnitZ(): HVec3;
2306
- set(x: Decimal.Value, y: Decimal.Value, z: Decimal.Value): this;
2307
- setScalar(s: Decimal.Value): this;
2308
- setComponent(index: number, value: Decimal.Value): this;
2373
+ set(x: DecimalValue, y: DecimalValue, z: DecimalValue): this;
2374
+ setScalar(s: DecimalValue): this;
2375
+ setComponent(index: number, value: DecimalValue): this;
2309
2376
  getComponent(index: number): Decimal;
2310
2377
  copy(v: IHVec3): this;
2311
2378
  clone(): HVec3;
@@ -2313,15 +2380,15 @@ declare class HVec3 implements IHVec3 {
2313
2380
  addVecs(a: IHVec3, b: IHVec3): this;
2314
2381
  sub(v: IHVec3, w?: IHVec3): this;
2315
2382
  subVecs(a: IHVec3, b: IHVec3): this;
2316
- multiplyScalar(s: Decimal.Value): this;
2317
- divideScalar(s: Decimal.Value): this;
2383
+ multiplyScalar(s: DecimalValue): this;
2384
+ divideScalar(s: DecimalValue): this;
2318
2385
  cross(v: IHVec3, w?: IHVec3): this;
2319
2386
  crossVecs(a: IHVec3, b: IHVec3): this;
2320
2387
  dot(v: IHVec3): Decimal;
2321
2388
  lengthSq(): Decimal;
2322
2389
  length(): Decimal;
2323
2390
  normalize(): this;
2324
- lerp(v: IHVec3, alpha: Decimal.Value): this;
2391
+ lerp(v: IHVec3, alpha: DecimalValue): this;
2325
2392
  distanceTo(v: IHVec3): Decimal;
2326
2393
  equals(v: IHVec3): boolean;
2327
2394
  toArray(): Decimal[];
@@ -2330,7 +2397,7 @@ declare class HVec3 implements IHVec3 {
2330
2397
 
2331
2398
  declare class Vec {
2332
2399
  _data: Decimal[];
2333
- constructor(...values: Decimal.Value[]);
2400
+ constructor(...values: DecimalValue[]);
2334
2401
  get dim(): number;
2335
2402
  check(v: Vec): boolean;
2336
2403
  private requireDimension;
@@ -2338,7 +2405,7 @@ declare class Vec {
2338
2405
  clone(): Vec;
2339
2406
  add(v: Vec): this;
2340
2407
  sub(v: Vec): this;
2341
- multiplyScalar(s: Decimal.Value): this;
2408
+ multiplyScalar(s: DecimalValue): this;
2342
2409
  cross(v: Vec): this;
2343
2410
  get extentSq(): Decimal;
2344
2411
  get extent(): Decimal;
@@ -2383,7 +2450,7 @@ declare class Polygon {
2383
2450
  normal: HVec3;
2384
2451
  vertices: HVec3[];
2385
2452
  readonly epsilon: Decimal;
2386
- constructor(vertices?: readonly HVec3[], epsilon?: Decimal.Value);
2453
+ constructor(vertices?: readonly HVec3[], epsilon?: DecimalValue);
2387
2454
  calcPlane(): this;
2388
2455
  flip(): this;
2389
2456
  classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
@@ -2636,7 +2703,7 @@ declare class Rectangle {
2636
2703
  southeast(result?: Cartographic): Cartographic;
2637
2704
  }
2638
2705
 
2639
- /** Karney geodesics via GeographicLib; antipodal inputs are supported. */
2706
+ /** Internal TypeScript Karney geodesics; antipodal inputs are supported. */
2640
2707
  declare class EllipsoidGeodesic {
2641
2708
  ellipsoid: Ellipsoid;
2642
2709
  start: Cartographic;
@@ -2844,10 +2911,10 @@ interface LayerEvents {
2844
2911
  }
2845
2912
  declare class ImageryLayerCollection extends EventHandler<LayerEvents> {
2846
2913
  static readonly EventType: {
2847
- readonly layerAdded: "layerAdded";
2848
- readonly layerRemoved: "layerRemoved";
2849
- readonly layerMoved: "layerMoved";
2850
- readonly layerShownOrHidden: "layerShownOrHidden";
2914
+ readonly layerAdded: 'layerAdded';
2915
+ readonly layerRemoved: 'layerRemoved';
2916
+ readonly layerMoved: 'layerMoved';
2917
+ readonly layerShownOrHidden: 'layerShownOrHidden';
2851
2918
  };
2852
2919
  private layers;
2853
2920
  revision: number;
@@ -3172,5 +3239,5 @@ declare class DelaunaySlow {
3172
3239
  contains(tri: Vec3[], p: Vec3): number[] | null;
3173
3240
  }
3174
3241
 
3175
- 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 };
3176
- 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 };
3242
+ export { ArrayObject, BSP$1 as BSP, BTree, Box, BufferAttribute, BufferGeometry, index_d$2 as CSG, Capsule, Circle, ClipType, Color, ConvexHull, Curve, DEGREES_PER_RADIAN, Decimal, 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 };
3243
+ export type { AxisPlane, CatmullRomOptions, ConvexHull3DResult, CurvedQueryOptions, DecimalConfig, DecimalValue, DistanceParameter, DistanceResult, EventListener, GeometryData, GeometryKind, GeometryQuery, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, IHVec2, IHVec3, IHVec4, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, IntersectResult, MeshSplitOptions, PolyNode };